-
-
Notifications
You must be signed in to change notification settings - Fork 237
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
Format fix tests #2294
Format fix tests #2294
Conversation
🦙 MegaLinter status:
|
Descriptor | Linter | Files | Fixed | Errors | Elapsed time |
---|---|---|---|---|---|
✅ BASH | bash-exec | 6 | 0 | 0.01s | |
✅ BASH | shellcheck | 6 | 0 | 0.15s | |
✅ BASH | shfmt | 6 | 0 | 0 | 0.44s |
✅ COPYPASTE | jscpd | yes | no | 3.62s | |
✅ DOCKERFILE | hadolint | 114 | 0 | 21.19s | |
✅ JSON | eslint-plugin-jsonc | 21 | 0 | 0 | 2.59s |
✅ JSON | jsonlint | 19 | 0 | 0.37s | |
✅ JSON | v8r | 21 | 0 | 14.68s | |
markdownlint | 309 | 0 | 230 | 7.33s | |
✅ MARKDOWN | markdown-link-check | 309 | 0 | 6.15s | |
✅ MARKDOWN | markdown-table-formatter | 309 | 0 | 0 | 20.97s |
✅ OPENAPI | spectral | 1 | 0 | 2.29s | |
bandit | 183 | 47 | 2.63s | ||
✅ PYTHON | black | 183 | 0 | 0 | 5.09s |
✅ PYTHON | flake8 | 183 | 0 | 2.23s | |
✅ PYTHON | isort | 183 | 0 | 0 | 0.94s |
✅ PYTHON | mypy | 183 | 0 | 9.36s | |
✅ PYTHON | pylint | 183 | 0 | 14.79s | |
pyright | 183 | 246 | 22.5s | ||
✅ REPOSITORY | checkov | yes | no | 36.05s | |
✅ REPOSITORY | git_diff | yes | no | 0.44s | |
✅ REPOSITORY | secretlint | yes | no | 16.59s | |
✅ REPOSITORY | trivy | yes | no | 35.63s | |
✅ SPELL | cspell | 745 | 0 | 26.53s | |
✅ SPELL | misspell | 566 | 0 | 0 | 1.15s |
✅ XML | xmllint | 3 | 0 | 0 | 0.43s |
✅ YAML | prettier | 81 | 0 | 0 | 3.68s |
✅ YAML | v8r | 23 | 0 | 71.79s | |
✅ YAML | yamllint | 82 | 0 | 1.28s |
See detailed report in MegaLinter reports
@nvuillam the architecture is more or less solved, now it is a matter of adding the test files for each linter that allows format/fix and see how the tests are passing. I have found special cases in which I have had to pass certain variables to make them work as you can see. |
a09a37f
to
7f1994d
Compare
@bdovaz that looks very promising :) |
@nvuillam is curious because with this PR when running the tests in different linters I am finding several bugs in several linters that did not run correctly the format or autofix .... I guess it's just a coincidence that no one has tested the format/autofix on these linters so far and that's why we haven't noticed it. So we kill two birds with one stone! |
@bdovaz indeed, many autoformat-fix may not have been tested... your PR will clean some mess ! :) |
@nvuillam you may know more than me about this subject.... The tests that I am preparing (creating the input files + settings if necessary) run correctly locally but not in github actions. They all fail for the same reason. If you look at the error is this: It originates here: And I set the value here which I'm afraid is what varies with respect to my machine locally? @nvuillam the key is how to set the git repository root correctly for all cases so that the git APIs work correctly. Can you help me? I would appreciate your help to unlock this problem, thanks! |
When the tests are run (where it fails), is it inside a container image? If I recall correctly, there is a step when building that uses the previously built image and tries to run tests. And if it's that case, I think we don't place the repo inside the container, only the code. So not git there. Does the tests need to have a repo? Can megalinter run on a local folder without having it inside a git repo? |
@echoix the need for the repo comes from a message from @nvuillam on how he wanted it implemented: |
My answer was conditional. Is that code run as the Python code of megalinter inside the container? Or it is mapped into a folder outside the container, where a repo could exist? |
@echoix On my local machine I run it from VS Code obviously running it on my own machine without images or Docker containers, this works perfectly. But when I do push and it runs in Github actions it runs from a container and in that case as you say there is no That is why I had to do this: What I want to know is, have I done well? Is there any other alternative @nvuillam? |
On the single existing fixes test , there is a call to git so it works at least in CI
I don't remember locally without container... but we have megalinter repo when we run test cases in megalinter |
Ok, I'll try that, let's see. And another thing @nvuillam, the list of linters of this workflow why doesn't have all of them? Because you have to keep it by hand and it is not synchronized and you need to modify it? Or that fixed list is like that for something? Because right now my problem is that not having all of them, I will not be able to test all the linters in this PR:
|
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## main #2294 +/- ##
==========================================
+ Coverage 82.39% 82.51% +0.12%
==========================================
Files 171 171
Lines 4521 4513 -8
==========================================
- Hits 3725 3724 -1
+ Misses 796 789 -7
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Isn't that the linters that can output sarif, and that are packaged individually? Also maybe it could be helpful when you post links in comments to use the permalinks, so that if someone else comes back and read, it'll still match the good lines even if the contents were to be updated (or the files removed). It's not much, but it makes sure that we keep talking about the same thing, and that we are both sure that it's the same thing. |
That's right :) Ox.security service use them :) |
@nvuillam can you answer to this comment please? |
@bdovaz all linters are tested in the main check job :) |
@nvuillam by main check job do you mean this one? https://github.com/oxsecurity/megalinter/actions/runs/4038035333/jobs/6941752465 It is the one that takes the longest to run and it does not run in parallel each linter like the rest. Still you didn't answer my question, in that workflow we can/should add the remaining linters? For me at least it would help me to test everything much faster. |
Yes it's the longest one, I know :/ But it tests all of them As we are already struggling with github API limits that makes jobs fail, I prefer that we don't add individual linter job if they are not deployed in their own docker image |
@nvuillam but according to this page it is 1,000 calls per hour, so many workflows (each one with its calls) are executed per hour to reach 1,000? |
The calls from Dockerfile do not use GITHUB_TOKEN , so we have way less :/ (don't know how many) |
@nvuillam But all this is not improvable? Can't we analyze and see if we can refactor something (I speak from ignorance) to avoid this limit? |
@nvuillam I've encountered a problem with the linter you created (npm-groovy-lint) https://github.com/oxsecurity/megalinter/actions/runs/4039087465/jobs/6943650830 Looking at the log, I think the problem is in the cli that returns exit code 1 even if the linter has correctly corrected the file, no? |
32daedf
to
3c1a064
Compare
Until Docker and buildx changes (if it didn't solve the 2-3 years old problem in the last three weeks), the push: true will be needed when building multi platform images since load can't "load" images for another platform locally. |
Is the registry logged in? And does the workflow has write permissions to GitHub packages? Maybe the answer is in the second idea |
I believe the syntax for testing @echoix's second thought would be: permissions:
packages: write based on https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs. |
In the page, after this,
permissions:
actions: read|write|none
checks: read|write|none
contents: read|write|none
deployments: read|write|none
id-token: read|write|none
issues: read|write|none
discussions: read|write|none
packages: read|write|none
pages: read|write|none
pull-requests: read|write|none
repository-projects: read|write|none
security-events: read|write|none
statuses: read|write|none
So it's to keep in mind |
@nvuillam is all set to be merge ready! What do you think? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's go :)
I'll have a look tomorrow (or before we geberate a new version ^^)
Great achievement to merge this branch. If you look at the changelog, I have introduced many improvements / bug fixes. |
Probably if we find a way to parallelize tests we'll gain some future PRs time :) |
@nvuillam I don't know what to fix because I don't even know what that workflow does but what I can tell you is that my PR fixes/changes the following in build.py:
That is, now new, modified or deleted files can appear in git. Before only modified because no files were deleted before generating them and not all of them were generated, only part of them. I don't know if this gives you any clue to relate it to that problem and know how to solve it. I have also seen in the log other errors: https://github.com/oxsecurity/megalinter/actions/runs/4178767375/jobs/7237949515 |
I'll try to arrange that :) |
Resolves #2250