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

contains_json with false doesn't work #504

Open
ryo-murai opened this issue Sep 6, 2022 · 1 comment
Open

contains_json with false doesn't work #504

ryo-murai opened this issue Sep 6, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@ryo-murai
Copy link

nitpick does not report any violations that json value has to be false.

Current behavior

I have a style file like below.

# style.toml
[".vscode/settings.json".contains_json]
"python.linting.pylintEnabled" = "false"
"python.linting.flake8Enabled" = "true"

nitpick check works at flake8Enabled = true as expected. However, checking pylintEnabled = false always results "No violations found" regardless actual value is true or false.

Expected behavior

nitpick properly reports a violation by checking a falsy json value.

Steps to reproduce

  1. create a style file like above mentioned.
  2. create .vscode/setting.json which contains "{"python.linting.pylintEnabled" = true}.
  3. run nitpick check

Context

Our team members use the MS VSCode as a python development environment.
I'm trying to write a style of .vscode/settings.json, to apply the same setting to our projects.

Your environment

  • nitpick version used: 0.32.0
  • Python version: 3.9.12
  • Operating System and version: macOS 12.2.1
  • Link to your project: None
  • Run the following commands and paste the output:
$ pipenv shell
  ...
$ which python3
/Users/mrr/dev/python/workspaces/nitpick-json-test/.venv/bin/python3

$ python3 -V
Python 3.9.12

$ pip freeze
appdirs==1.4.4
attrs==22.1.0
autorepr==0.3.0
cattrs==22.1.0
certifi==2022.6.15
charset-normalizer==2.1.1
click==8.1.3
ConfigUpdater==3.1.1
dictdiffer==0.9.0
dpath==2.0.6
exceptiongroup==1.0.0rc9
flake8==5.0.4
flatten-dict==0.4.2
furl==2.1.3
identify==2.5.5
idna==3.3
jmespath==1.0.1
loguru==0.6.0
marshmallow==3.17.1
marshmallow-polyfield==5.10
mccabe==0.7.0
more-itertools==8.14.0
nitpick==0.32.0
orderedmultidict==1.0.1
packaging==21.3
pluggy==1.0.0
pycodestyle==2.9.1
pyflakes==2.5.0
pyparsing==3.0.9
python-slugify==6.1.2
requests==2.28.1
requests-cache==0.9.6
ruamel.yaml==0.17.21
ruamel.yaml.clib==0.2.6
six==1.16.0
sortedcontainers==2.4.0
StrEnum==0.4.8
text-unidecode==1.3
toml==0.10.2
tomlkit==0.11.4
url-normalize==1.4.3
urllib3==1.26.12

cat $(which flake8)
#!/Users/mrr/dev/python/workspaces/nitpick-json-test/.venv/bin/python
# -*- coding: utf-8 -*-
import re
import sys
from flake8.main.cli import main
if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
    sys.exit(main())

For more information, see the CONTRIBUTING guide.

@ryo-murai ryo-murai added the bug Something isn't working label Sep 6, 2022
@andreoliwa
Copy link
Owner

Thanks for the report. 🙏🏻

The JSON plugin is a bit old and very limited.
It will need a revamp in the not-so-distant future, to be more flexible like the YAML plugin.

@andreoliwa andreoliwa moved this to Upvoted / Requests in Nitpick Roadmap Sep 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Upvoted / Requests
Development

No branches or pull requests

2 participants