Skip to content
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

Report duplicate keys in check_json #558

Merged
merged 1 commit into from
Feb 18, 2021

Conversation

AdityaKhursale
Copy link
Contributor

Raise ValueError and return 1 if json contains duplicate keys

Fixes #554

@asottile
Copy link
Member

there's a few things CI is pointing out that you'll want to fix:

from the tox output:

pre_commit_hooks/check_json.py      29      1      6      1    94%   15->16, 16

this indicates that the code on line 16 is not covered by an automated test -- there's a set of tests for this module in tests/check_json_test.py -- you can probably find some examples there to fix it

from the pre-commit output:

pre_commit_hooks/check_json.py:12: error: Missing type parameters for generic type "Dict"

this indicates that the Dict generic does not have its type parameters -- usually these are Dict[str, Any] when loading from json. I'm also pretty sure that Hashable => str in the function signature should be changed too? not 100% sure on that though I'd have to clone and check with pre-commit run mypy --all-files

@AdityaKhursale
Copy link
Contributor Author

there's a few things CI is pointing out that you'll want to fix:

from the tox output:

pre_commit_hooks/check_json.py      29      1      6      1    94%   15->16, 16

this indicates that the code on line 16 is not covered by an automated test -- there's a set of tests for this module in tests/check_json_test.py -- you can probably find some examples there to fix it

from the pre-commit output:

pre_commit_hooks/check_json.py:12: error: Missing type parameters for generic type "Dict"

this indicates that the Dict generic does not have its type parameters -- usually these are Dict[str, Any] when loading from json. I'm also pretty sure that Hashable => str in the function signature should be changed too? not 100% sure on that though I'd have to clone and check with pre-commit run mypy --all-files

Thank you for the help!
Covered line no. 16 in automated tests. Will update fix for another issue.

@AdityaKhursale
Copy link
Contributor Author

Hi @asottile

I have fixed the things reported by CI.
Can you please review and check if PR is good to merge?

Thanks,
Aditya

Copy link
Member

@asottile asottile left a comment

Choose a reason for hiding this comment

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

Raise ValueError and return 1 if json contains duplicate keys
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

check-json doesn't detect duplicate keys
2 participants