Skip to content

Report duplicate keys in check_json - #558

Merged
asottile merged 1 commit into
pre-commit:masterfrom
AdityaKhursale:master
Feb 18, 2021
Merged

Report duplicate keys in check_json#558
asottile merged 1 commit into
pre-commit:masterfrom
AdityaKhursale:master

Conversation

@AdityaKhursale

Copy link
Copy Markdown
Contributor

Raise ValueError and return 1 if json contains duplicate keys

Fixes #554

@asottile

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

@asottile asottile left a comment

Copy link
Copy Markdown
Member

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

2 participants