Skip to content

Handle levels of ansible-lint warnings #1162

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

Merged
merged 1 commit into from
Mar 18, 2025

Conversation

zigarn
Copy link
Member

@zigarn zigarn commented Mar 15, 2025

In ansible-lint it is possible to set a warn-list for lower level warnings.
It is shown as such in parseable output with a (warning) at the end of the line.
In SARIF output it is of level warning (instead of error).
So to be consistent, it is more logic to be parsed as WARNING_LOW, like the warning from SARIF.

This PR detect the presence of the final (warning) and use it to lower the severity to WARNING_LOW.
As a bonus, this (warning) is no more in the warning message.

Testing done

Unit test for ansible-lint parser has been updated accordingly to the new parsing.

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

Copy link
Member

@uhafner uhafner left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

@uhafner uhafner added the enhancement Enhancement of existing functionality label Mar 18, 2025
@zigarn
Copy link
Member Author

zigarn commented Mar 18, 2025

About SARIF comparison, I found that the levels are WARNING_HIGH for "errors", and WARNING_NORMAL for "warnings".
So not totally consistent, but at least distinguishing both levels is now done.

@uhafner
Copy link
Member

uhafner commented Mar 18, 2025

I see. I think it is fine to go with this new classification.

@uhafner uhafner merged commit 4368fc2 into jenkinsci:main Mar 18, 2025
29 of 30 checks passed
@zigarn zigarn deleted the ansible-lint-warning-low branch March 18, 2025 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement of existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants