Skip to content

contains_json with false doesn't work  #504

@ryo-murai

Description

@ryo-murai

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    Status

    Upvoted / Requests

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions