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

PowershellLinter autofix #2175

Merged

Conversation

bdovaz
Copy link
Collaborator

@bdovaz bdovaz commented Dec 22, 2022

@bdovaz
Copy link
Collaborator Author

bdovaz commented Dec 22, 2022

I have the doubt if a test should be created for -Fix? I mean, pass an input and compare an output with the applied fix.

If so, is there any similar example of a linter that does autofix and has tests for this?

@nvuillam I have marked it as draft because the formatter is missing.

@nvuillam
Copy link
Member

nvuillam commented Dec 22, 2022

@bdovaz MegaLinter is not perfectly equipped to auto-test formatting and fixes, there is a single test class here, that tests some linter fixes but not all of them, and it checks only if the file has been updated (probably too hard to maintain file comparisons) : https://github.com/oxsecurity/megalinter/blob/main/megalinter/tests/test_megalinter/mega_linter_2_fixes_test.py

About formatter, as it may be longer to build, you may do it in a separate PR ^^

@codecov-commenter
Copy link

Codecov Report

Merging #2175 (43a5a39) into main (2e0e163) will decrease coverage by 0.32%.
The diff coverage is 87.50%.

@@            Coverage Diff             @@
##             main    #2175      +/-   ##
==========================================
- Coverage   82.84%   82.51%   -0.33%     
==========================================
  Files         166      167       +1     
  Lines        4431     4439       +8     
==========================================
- Hits         3671     3663       -8     
- Misses        760      776      +16     
Impacted Files Coverage Δ
megalinter/linters/PowershellLinter.py 95.23% <50.00%> (-4.77%) ⬇️
...alinter/linters/json_npm_package_json_lint_test.py 100.00% <100.00%> (ø)
...alinter/tests/test_megalinter/helpers/utilstest.py 83.15% <0.00%> (-5.87%) ⬇️
megalinter/reporters/UpdatedSourcesReporter.py 89.74% <0.00%> (+2.56%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@bdovaz bdovaz marked this pull request as ready for review December 23, 2022 00:10
@bdovaz
Copy link
Collaborator Author

bdovaz commented Dec 23, 2022

@nvuillam Ready!

@bdovaz bdovaz changed the title PowershellLinter improvements PowershellLinter autofix Dec 23, 2022
Copy link
Member

@nvuillam nvuillam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great :)

@nvuillam nvuillam merged commit d876f41 into oxsecurity:main Dec 23, 2022
@bdovaz bdovaz deleted the feature/powershell-linter-improvements branch December 23, 2022 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants