question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Set the powerShell.scriptAnalysis.settingsFilePath setting to a default for auto-discoverability

See original GitHub issue

Summary of the new feature

Most linter tools automatically pick up the config file from the root of your workspace. We should do the same.

I’d like to set the default value for powerShell.scriptAnalysis.settingsFilePath to PSScriptAnalyzerSettings.psd1 which means that if there is a PSScriptAnalyzerSettings.psd1 in the root of the workspace, we will automatically use it.

If a user doesn’t want this, they can opt out via:

"powerShell.scriptAnalysis.settingsFilePath":""

but PSSA integration is one of our flagship features so we should streamline the experience.

Also, the user can still set it to something else if they so choose.

Proposed technical implementation details (optional)

Setting the default value for powerShell.scriptAnalysis.settingsFilePath to PSScriptAnalyzerSettings.psd1. Making sure our code is resilient if the file doesn’t exist.

I need to hear what @bergmeister has to say about this. Among anyone else 😃

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
TylerLeonhardtcommented, Jan 31, 2020

@bgelens your issue was fixed in https://github.com/PowerShell/PowerShellEditorServices/pull/1161 - a fix I made a few days after the last release… so it’s pending a release. Sorry about that. [System.Uri] is a nightmare in a cross-plat world lol

1reaction
bgelenscommented, Jan 29, 2020

I have an issue with relative path with version 2020.1.0 preview extension on mac with PSv7rc2

I can only use the full path. Relative won’t work. I tried both ./PSScriptAnalyzerSettings.psd1 and PSScriptAnalyzerSettings.psd1. The file is in the root of the folder I opened.

From pses output:

[Error - 8:20:05 PM] Cannot find the path '/Users/bengelens/OneDrive/Documenten/Projecten/demo/file:/Users/bengelens/OneDrive/Documenten/Projecten/demo/PSScriptAnalyzerSettings.psd1'.

Note file: in the middle

When specifying the full path, it works correctly.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using PSScriptAnalyzer - PowerShell - Microsoft Learn
This article describes various features of PSScriptAnalyzer and how to use them.
Read more >
Where do I place the PSScriptAnalyzerSettings.psd1 file so ...
Set the powerShell.scriptAnalysis.settingsFilePath setting to a default for auto-discoverability · Issue #2190 ...
Read more >
PowerShell editing with Visual Studio Code
The PowerShell extension includes PSScriptAnalyzer by default, and automatically performs analysis on PowerShell script files you edit in VS ...
Read more >
How to add PowerShell linting to projects in Visual Studio Code
Click manage (gear icon), then configure extension settings. Under the workspace settings find: PowerShell › Script Analysis: Settings Path. Add ...
Read more >
Using PSScriptAnalyzer to check PowerShell version ...
However, because they require more targeted configuration, the compatibility rules are not enabled by default. Instead, we need to supply some ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found