-
Notifications
You must be signed in to change notification settings - Fork 637
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
Fix 'location' attribute for CodeclimateJSONFormatter #2897
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for more information, see https://pre-commit.ci
…into fix_codeclimate_json_formatter # Conflicts: # test/test_formatter_json.py
for more information, see https://pre-commit.ci
…into fix_codeclimate_json_formatter
@4ch1m Update PYTEST_REQPASS to include the test you added. Other than this it looks good to me. Thanks! |
# Conflicts: # .github/workflows/tox.yml
Done. Thank you. 👍 |
ssbarnea
approved these changes
Jan 16, 2023
ssbarnea
changed the title
fix 'location' attribute for CodeclimateJSONFormatter
Fix 'location' attribute for CodeclimateJSONFormatter
Jan 16, 2023
SkrrtBacharach
added a commit
to SkrrtBacharach/ale
that referenced
this pull request
Apr 3, 2023
The JSON output format of ansible-lint has changed since 6.11.0. Issue locations can have either a 'positions' or a 'lines' member, rather than just a 'lines' member as it was before. This fix checks which member is present, and passes that member name to subsequent dictionary lookups. The error was caused by the following change: ansible/ansible-lint#2897
SkrrtBacharach
added a commit
to SkrrtBacharach/ale
that referenced
this pull request
Apr 6, 2023
The JSON output format of ansible-lint has changed since 6.11.0. Issue locations can have either a 'positions' or a 'lines' member, rather than just a 'lines' member as it was before. This fix checks which member is present, and passes that member name to subsequent dictionary lookups. The error was caused by the following change: ansible/ansible-lint#2897
hsanson
pushed a commit
to dense-analysis/ale
that referenced
this pull request
Apr 7, 2023
* Fix error from ansible-lint versions >=6.11.0. The JSON output format of ansible-lint has changed since 6.11.0. Issue locations can have either a 'positions' or a 'lines' member, rather than just a 'lines' member as it was before. This fix checks which member is present, and passes that member name to subsequent dictionary lookups. The error was caused by the following change: ansible/ansible-lint#2897 * Add ansible-lint test to check each type of ansible-lint issue json. * Change long single-line JSON in ansible test into multiline JSON. * Fix linting errors in ansible_lint.vim.
mnikulin
pushed a commit
to mnikulin/ale
that referenced
this pull request
Nov 12, 2023
* Fix error from ansible-lint versions >=6.11.0. The JSON output format of ansible-lint has changed since 6.11.0. Issue locations can have either a 'positions' or a 'lines' member, rather than just a 'lines' member as it was before. This fix checks which member is present, and passes that member name to subsequent dictionary lookups. The error was caused by the following change: ansible/ansible-lint#2897 * Add ansible-lint test to check each type of ansible-lint issue json. * Change long single-line JSON in ansible test into multiline JSON. * Fix linting errors in ansible_lint.vim.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi there,
I believe the current implementation of the CodeclimateJSONFormatter is not quite correct.
Please have a look at this block ...
ansible-lint/src/ansiblelint/formatters/__init__.py
Lines 163 to 171 in dc42168
... which always generates a
lines
-object.Furthermore the
begin
-attribute changes type (to eitherint
orobject
) depending of the presence of a column-value. (Which makes automatic object-binding extremely complicated if not impossible when parsing the JSON-string with other languages/frameworks.)Aside from that, the codeclimate docs state:
So it should either be a
lines
-object ...... with a begin/end range, or a
positions
-object ...... with line/column values.
This PR should fix that.
Thanks for reading. 😄