Skip to content
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

MegaLinter reports 1 error found even when PSScriptAnalyzer reports no errors bug #3196

Open
james-garriss opened this issue Dec 7, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@james-garriss
Copy link

Describe the bug

When MegaLinter runs PSScriptAnalyzer, and PSScriptAnalyzer reports no errors, MegaLinter reports that there were 12 errors.

To Reproduce

  1. Create a GitHub repo that uses PowerShell, such as ScubaGear.
  2. Create a GitHub Action workflow that uses MegaLinter.
  3. Configure it to use PSScriptAnalyzer.
ENABLE_LINTERS:
  - POWERSHELL_POWERSHELL
  1. Run the workflow.
  2. See that MegaLinter reports that there are 12 errors, but PSScriptAnalyzer actually finds only warnings and informations.

Expected behavior

I would expect MegaLinter to report the sum total number of errors that PSScriptAnalyzer finds, which is 0.

Screenshots

Results can be seen here: https://github.com/cisagov/ScubaGear/actions/runs/7130729734/job/19417770435

@james-garriss james-garriss added the bug Something isn't working label Dec 7, 2023
@james-garriss james-garriss changed the title MegaLinter reports 1 error found even when PSScriptAnalyzer reports multiple errors bug MegaLinter reports 1 error found even when PSScriptAnalyzer reports no errors bug Dec 8, 2023
@nvuillam
Copy link
Member

nvuillam commented Dec 9, 2023

Probably the warnings trigger a response code 1 ?

What if you ignore such errors ? https://learn.microsoft.com/en-us/powershell/utility-modules/psscriptanalyzer/using-scriptanalyzer?view=ps-modules#suppressing-rules

@james-garriss
Copy link
Author

Why would I ignore them? I still want them reported. I just want them to be reported correctly.

@nvuillam
Copy link
Member

nvuillam commented Feb 7, 2024

@james-garriss FYI there is a current PR about powershell errors counting, maybe you'll be interested by the result ? :)

#3318

@james-garriss
Copy link
Author

Super cool. Thank you for the heads up and the good work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants