oxsecurity / megalinter

🦙 MegaLinter analyzes 50 languages, 22 formats, 21 tooling formats, excessive copy-pastes, spelling mistakes and security issues in your repository sources with a GitHub Action, other CI tools or locally.
https://megalinter.io
GNU Affero General Public License v3.0
1.8k stars 215 forks source link

bug: ansible-lint fix warning count violations #3680

Closed TommyE123 closed 1 week ago

TommyE123 commented 1 week ago

Fixes #3446

Currently the count for the warning violations regex errors and doesn’t display the correct count.

Proposed Changes

Changed the regex to count the violations that ansible-lint outputs.

image

Testing

I’ve checked this on both Github and Azure pipelines using 2 different repositories and the results are as expected.

Before: image

After: image

If there are any issues or concerns, please let me know, and I will address them promptly. Thank you for reviewing this PR and I look forward to your feedback. Tom

echoix commented 1 week ago

@TommyE123 Do you think the ansible lint test failure here is transient?

nvuillam commented 1 week ago

image

Not sure the new regex matches such output :(

echoix commented 1 week ago

Does it have to do with some env vars that change the logging format?

TommyE123 commented 1 week ago

Well I'm angry now with myself!

I must have missed a scenario. However I think we need to use both mine and the existing regex but will check. Please don't merge and I will come back with a better more robust solution!

I've also been looking at a better way to detect if ansible should be active in general.

Thank you both for all your hard work today getting everything merged. 🙂

Tom

nvuillam commented 1 week ago

@TommyE123 no problem haha ,thanks for your hard work :)

TommyE123 commented 1 week ago

After some testing, I've discovered that the current regex only works when quiet: false is set or not specified in the .ansible-lint config file.

Setting quiet: true doesn't significantly reduce the log information across Azure, GitHub, and GitLab environments. In fact, it results in missing out on a valuable breakdown table of issues, as shown below as an example. image

Given these findings, I'm closing this PR as the change doesn't work as initially intended. However, this does explain the behavior @alexanderbazhenoff encountered in https://github.com/oxsecurity/megalinter/issues/3446#issuecomment-2016942807.

I believe we can also close https://github.com/oxsecurity/megalinter/pull/3680 now, as this was the only outstanding issue there.

Tom

alexanderbazhenoff commented 6 days ago

No prob, I haven't had any time for sure for the last few months either. May be I'll take a look into ansible-lint output also once I get back to refactoring my four roles. Thanks for trying anyway.