-
-
Notifications
You must be signed in to change notification settings - Fork 250
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
Improve linter testing #2250
Comments
@nvuillam @Kurt-von-Laven @nvuillam do any of you see yourself able to develop an architecture for this case? With "architecture" I mean something similar to what is done and that I have mentioned in the first message. Generate in the test class of each linter some tests to be able to verify that if a formatting or a fix is applied (if the linters support format/autofix) it matches the expected file. Create some kind of convention like good/bad folders or _good/_bad suffixes so that you can compare unformatted/formatted and uncorrected/fixed files. I can lend a hand in preparing the input for the linter test files but I have little experience with python to do the development needed to get to this point. |
I'm capable... but it requires time that I won't have for a while :/
All can be tested locally on windows ^^ |
Conversation comes from #2244
Originally posted by @Kurt-von-Laven in #2244 (comment)
Originally posted by @echoix in #2244 (comment)
Originally posted by @Kurt-von-Laven in #2244 (comment)
Right now classes are automatically generated through:
https://github.com/oxsecurity/megalinter/blob/main/.automation/build.py#L644
The generated classes are here:
https://github.com/oxsecurity/megalinter/tree/main/megalinter/tests/test_megalinter/linters
They all inherit from the next class so all linters have exactly the same tests:
https://github.com/oxsecurity/megalinter/blob/main/megalinter/tests/test_megalinter/LinterTestRoot.py#L11
This class uses this utility class:
https://github.com/oxsecurity/megalinter/blob/main/megalinter/tests/test_megalinter/helpers/utilstest.py
And the input for the tests is here:
https://github.com/oxsecurity/megalinter/tree/main/.automation/test
The problem I see as I said, among other things, is that there are no specific tests for certain linters that can apply fixes or format files. Right now there is no testing of any of this.
This class does the trick but we would have to think of a system applicable to all linters:
https://github.com/oxsecurity/megalinter/blob/main/megalinter/tests/test_megalinter/mega_linter_2_fixes_test.py
The text was updated successfully, but these errors were encountered: