-
Notifications
You must be signed in to change notification settings - Fork 389
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Settings file needs to have a exclude / ignore mechanism #1230
Comments
I think you need to see the section titled, Suppressing Rules. I think it would accomplish what you are looking for. |
@msftrncs , I'm well aware of how to surpress a rule , going to a folder with many files and many subfolders and pasting lines for each every impacted rule into every file is the only way this works at the moment. But this is a very long way from optimal, and the issue was opened at the request of @JamesWTruher after we discussed how this could be done at the PowerShell Summit last week. There are multiple ways it might be done, but after our discussion we thought the one above was probably better than finding many issues and supressing the message. |
The current approach also doesnt work when copying files from another source into a repository -- I do not want to be changing those files; not to fix the lint, nor to decorate the lint. They are not my files - I want exact copies only - I sync them periodically. I want the linter to exclude specific files I nominate. Almost every other linter implements this feature very early on. |
I'll go a step further. I'd like to control what rules are run, rather than just flat out suppressing. I'd propose something more like this. @{
FileRules = @{
"*.tests.ps1" = @{ Exclude = @("*") }
"build.ps1" = @{ Exclude = @("PSAvoidUsingCmdletAliases") }
}
} I know there are other ways to suppress, but there are reasons to want to do this via settings.
|
This issue seems like a duplicate of #561 |
**There needs to be an "exclude" option e.g. "exclude .tests.ps1" **
I have a module with ~ 200 pester tests attached. In VSCode if I attach a settings file the analyzer reports each pester command in each file is not found, by default, in each of the profiles where pester is not present. This reports so many false positives it is impossible to see the things which should be fixed. (VS code just says "> 1000 problems" and stops counting!)
Proposed technical implementation details (optional)
An option in the settings file (and perhaps on the command line) which said "exclude files which match this regular expression" would allow a subfolder, or certain names to be ignored. This is preferable to scanning those files, and trying to figure out which messages to hide, or having a mechanism for saying "Tell me if I'm using a module which isn't in V6 ... except don't tell me about Pester ... unless I've used it outside this folder" .
What is the latest version of PSScriptAnalyzer at the point of writing
1.18.0
The text was updated successfully, but these errors were encountered: