-
Notifications
You must be signed in to change notification settings - Fork 615
Add MegaLinter #679
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
Add MegaLinter #679
Conversation
|
I don't really like committing to peoples branches directly. I'd investigate the option to create a PR instead, and otherwise just drop it. |
Hi @davidrohr , the advantage is that the PR author does not need to care about reading instructions on how to run formatting tools or to approve a PR in their fork repo. What disadvantage do you see there? |
|
I don't like to concept of pushing in other people's repository. Then I'll just mark my PRs as not editable by maintainers... |
|
Also, this adds a commit on top, which should normally be squashed, but the automatic commit cannot squash properly if the PR consists of multiple commits, and also this would require a force push to the user's repository, which I also think we should not do. |
Squashing the automatic formatting commit with other commits in the PR works fine. |
|
The clang formatter makes a PR which the user can import or not. I think this would be a good solution also here. What's speak against this solution? |
Does it? I cannot find a single PR created by the formatting action. |
These PRs are created in the PR author's fork. For example: vkucera/AliceO2#10. That is done by this code. |
Thanks @TimoWilken , I am aware of this feature. My point is that I cannot find an example of it working in O2Physics. |
|
Ah, right. The action had the wrong permissions -- that should be fixed now. |
Thanks! I will try to put that in this one. |
7d36dcf to
6246108
Compare
|
This PR has not been updated in the last 30 days. Is it still needed? Unless further action is taken, it will be closed in 5 days. |
796e84d to
b5ceac8
Compare
TimoWilken
left a comment
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.
Looks pretty good overall, though I have a few questions -- see below.
| - name: Exit with error if the PR is not clean | ||
| run: | | ||
| case "${{ steps.ml.outputs.has_updated_sources }}" in | ||
| 0) echo 'PR clean' ; exit 0 ;; | ||
| 1) echo 'PR not clean' ; exit 1 ;; | ||
| esac |
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.
How is the case handled where MegaLinter finds problems, but does not have automatic fixes for them? In that case, we still want to exit with an error, right?
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.
Yes, in case of errors, the MegaLinter step fails.
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.
In that case, the automatic PR with any fixes that MegaLinter does produce wouldn't be created, right?
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.
That is correct. The formatting PR should be created only if MegaLinter did not find any errors, which I think is the intended behaviour, right?
TimoWilken
left a comment
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.
Looks good to me. If the current codebase (with changes in this PR) passes MegaLinter, then let's merge and try it out!
Thanks @TimoWilken |
How do we check this? Let me know, I can then merge it. |
|
@TimoWilken Is the action supposed to run already on this PR itself? |
Otherwise, the current code passes all the tests except for a few bandit issues which should be addressed at the next modification of |
|
Seeing as the new linter checks passed before, let's merge it and see what happens. |
|
FYI: I had to add one more thing (92b5340) to make the automatic cleanup PRs work. Apart from that, looks like it runs OK. |
Thanks @TimoWilken . I'm glad it seems to work now. |
* Add MegaLinter * Fix YAML * Fix formatting * Add Flake8 config file * Check only modified files * Allow formatting commits on push events * Integrate alisw/pull-request * Comments by Timo
@TimoWilken @ktf @jgrosseo
This adds MegaLinter as a CI action to lint and format code other than C++ and CMake.
Fixes and formatting have been applied to the existing files to pass the tests, with the exception of
Scripts/update_ccdb.pywhich requires some more than trivial fixes which I leave to the next editor.The action is set to check only modified files with
VALIDATE_ALL_CODEBASE: false.If a PR passes the tests without errors but formatting is still required, a formatting commit is committed directly to the PR branch. This is set with
APPLY_FIXES_MODE: commit. (The option to create a PR instead has some problems with GitHub tokens AFAIK.)