diff --git a/poetry.lock b/poetry.lock index 1060a8ac..60d0e503 100644 --- a/poetry.lock +++ b/poetry.lock @@ -262,7 +262,7 @@ description = "A fast and thorough lazy object proxy." name = "lazy-object-proxy" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" -version = "1.4.1" +version = "1.4.2" [[package]] category = "dev" @@ -757,7 +757,10 @@ description = "Backport of pathlib-compatible object wrapper for zip files" name = "zipp" optional = false python-versions = ">=2.7" -version = "0.5.2" +version = "0.6.0" + +[package.dependencies] +more-itertools = "*" [metadata] content-hash = "e0a1389536f45075610fc2ac7673ff572935eb0e1f3388d31d9fab87dd1a7336" @@ -790,7 +793,7 @@ isort = ["54da7e92468955c4fceacd0c86bd0ec997b0e1ee80d97f67c35a78b719dccab1", "6e jedi = ["786b6c3d80e2f06fd77162a07fed81b8baa22dde5d62896a790a331d6ac21a27", "ba859c74fa3c966a22f2aeebe1b74ee27e2a462f56d3f5f7ca4a59af61bfe42e"] jinja2 = ["065c4f02ebe7f7cf559e49ee5a95fb800a9e4528727aec6f24402a5374c65013", "14dd6caf1527abb21f08f86c784eac40853ba93edb79552aa1e4b8aef1b61c7b"] jmespath = ["3720a4b1bd659dd2eecad0666459b9788813e032b83e7ba58578e48254e0a0e6", "bde2aef6f44302dfb30320115b17d030798de8c4110e28d5cf6cf91a7a31074c"] -lazy-object-proxy = ["159a745e61422217881c4de71f9eafd9d703b93af95618635849fe469a283661", "23f63c0821cc96a23332e45dfaa83266feff8adc72b9bcaef86c202af765244f", "3b11be575475db2e8a6e11215f5aa95b9ec14de658628776e10d96fa0b4dac13", "3f447aff8bc61ca8b42b73304f6a44fa0d915487de144652816f950a3f1ab821", "4ba73f6089cd9b9478bc0a4fa807b47dbdb8fad1d8f31a0f0a5dbf26a4527a71", "4f53eadd9932055eac465bd3ca1bd610e4d7141e1278012bd1f28646aebc1d0e", "64483bd7154580158ea90de5b8e5e6fc29a16a9b4db24f10193f0c1ae3f9d1ea", "6f72d42b0d04bfee2397aa1862262654b56922c20a9bb66bb76b6f0e5e4f9229", "7c7f1ec07b227bdc561299fa2328e85000f90179a2f44ea30579d38e037cb3d4", "7c8b1ba1e15c10b13cad4171cfa77f5bb5ec2580abc5a353907780805ebe158e", "8559b94b823f85342e10d3d9ca4ba5478168e1ac5658a8a2f18c991ba9c52c20", "a262c7dfb046f00e12a2bdd1bafaed2408114a89ac414b0af8755c696eb3fc16", "acce4e3267610c4fdb6632b3886fe3f2f7dd641158a843cf6b6a68e4ce81477b", "be089bb6b83fac7f29d357b2dc4cf2b8eb8d98fe9d9ff89f9ea6012970a853c7", "bfab710d859c779f273cc48fb86af38d6e9210f38287df0069a63e40b45a2f5c", "c10d29019927301d524a22ced72706380de7cfc50f767217485a912b4c8bd82a", "dd6e2b598849b3d7aee2295ac765a578879830fb8966f70be8cd472e6069932e", "e408f1eacc0a68fed0c08da45f31d0ebb38079f043328dce69ff133b95c29dc1"] +lazy-object-proxy = ["02b260c8deb80db09325b99edf62ae344ce9bc64d68b7a634410b8e9a568edbf", "18f9c401083a4ba6e162355873f906315332ea7035803d0fd8166051e3d402e3", "1f2c6209a8917c525c1e2b55a716135ca4658a3042b5122d4e3413a4030c26ce", "2f06d97f0ca0f414f6b707c974aaf8829c2292c1c497642f63824119d770226f", "616c94f8176808f4018b39f9638080ed86f96b55370b5a9463b2ee5c926f6c5f", "63b91e30ef47ef68a30f0c3c278fbfe9822319c15f34b7538a829515b84ca2a0", "77b454f03860b844f758c5d5c6e5f18d27de899a3db367f4af06bec2e6013a8e", "83fe27ba321e4cfac466178606147d3c0aa18e8087507caec78ed5a966a64905", "84742532d39f72df959d237912344d8a1764c2d03fe58beba96a87bfa11a76d8", "874ebf3caaf55a020aeb08acead813baf5a305927a71ce88c9377970fe7ad3c2", "9f5caf2c7436d44f3cec97c2fa7791f8a675170badbfa86e1992ca1b84c37009", "a0c8758d01fcdfe7ae8e4b4017b13552efa7f1197dd7358dc9da0576f9d0328a", "a4def978d9d28cda2d960c279318d46b327632686d82b4917516c36d4c274512", "ad4f4be843dace866af5fc142509e9b9817ca0c59342fdb176ab6ad552c927f5", "ae33dd198f772f714420c5ab698ff05ff900150486c648d29951e9c70694338e", "b4a2b782b8a8c5522ad35c93e04d60e2ba7f7dcb9271ec8e8c3e08239be6c7b4", "c462eb33f6abca3b34cdedbe84d761f31a60b814e173b98ede3c81bb48967c4f", "fd135b8d35dfdcdb984828c84d695937e58cc5f49e1c854eb311c4d6aa03f4f1"] markupsafe = ["00bc623926325b26bb9605ae9eae8a215691f33cae5df11ca5424f06f2d1f473", "09027a7803a62ca78792ad89403b1b7a73a01c8cb65909cd876f7fcebd79b161", "09c4b7f37d6c648cb13f9230d847adf22f8171b1ccc4d5682398e77f40309235", "1027c282dad077d0bae18be6794e6b6b8c91d58ed8a8d89a89d59693b9131db5", "24982cc2533820871eba85ba648cd53d8623687ff11cbb805be4ff7b4c971aff", "29872e92839765e546828bb7754a68c418d927cd064fd4708fab9fe9c8bb116b", "43a55c2930bbc139570ac2452adf3d70cdbb3cfe5912c71cdce1c2c6bbd9c5d1", "46c99d2de99945ec5cb54f23c8cd5689f6d7177305ebff350a58ce5f8de1669e", "500d4957e52ddc3351cabf489e79c91c17f6e0899158447047588650b5e69183", "535f6fc4d397c1563d08b88e485c3496cf5784e927af890fb3c3aac7f933ec66", "62fe6c95e3ec8a7fad637b7f3d372c15ec1caa01ab47926cfdf7a75b40e0eac1", "6dd73240d2af64df90aa7c4e7481e23825ea70af4b4922f8ede5b9e35f78a3b1", "717ba8fe3ae9cc0006d7c451f0bb265ee07739daf76355d06366154ee68d221e", "79855e1c5b8da654cf486b830bd42c06e8780cea587384cf6545b7d9ac013a0b", "7c1699dfe0cf8ff607dbdcc1e9b9af1755371f92a68f706051cc8c37d447c905", "88e5fcfb52ee7b911e8bb6d6aa2fd21fbecc674eadd44118a9cc3863f938e735", "8defac2f2ccd6805ebf65f5eeb132adcf2ab57aa11fdf4c0dd5169a004710e7d", "98c7086708b163d425c67c7a91bad6e466bb99d797aa64f965e9d25c12111a5e", "9add70b36c5666a2ed02b43b335fe19002ee5235efd4b8a89bfcf9005bebac0d", "9bf40443012702a1d2070043cb6291650a0841ece432556f784f004937f0f32c", "ade5e387d2ad0d7ebf59146cc00c8044acbd863725f887353a10df825fc8ae21", "b00c1de48212e4cc9603895652c5c410df699856a2853135b3967591e4beebc2", "b1282f8c00509d99fef04d8ba936b156d419be841854fe901d8ae224c59f0be5", "b2051432115498d3562c084a49bba65d97cf251f5a331c64a12ee7e04dacc51b", "ba59edeaa2fc6114428f1637ffff42da1e311e29382d81b339c1817d37ec93c6", "c8716a48d94b06bb3b2524c2b77e055fb313aeb4ea620c8dd03a105574ba704f", "cd5df75523866410809ca100dc9681e301e3c27567cf498077e8551b6d20e42f", "e249096428b3ae81b08327a63a485ad0878de3fb939049038579ac0ef61e17e7"] marshmallow = ["23f684b54b1955ebd5bdfbdda4062e438ef86218f14f1a356f570cdf0c016ab3", "fcfc9ffd75a883da06f30f604a4e81dd0b56eb9438f4d0a8de6bbaa163ce9ec3"] marshmallow-polyfield = ["963a01e80bca5cb4da42b8d2f7e6e90946257ae22d22ff2ed104a8a863eeb0c6"] @@ -839,4 +842,4 @@ urllib3 = ["b246607a25ac80bedac05c6f282e3cdaf3afb65420fd024ac94435cabe6e18d1", " wcwidth = ["3df37372226d6e63e1b1e1eda15c594bca98a22d33a23832a90998faa96bc65e", "f4ebe71925af7b40a864553f761ed559b43544f8f71746c2d756c7fe788ade7c"] win-unicode-console = ["d4142d4d56d46f449d6f00536a73625a871cba040f0bc1a2e305a04578f07d1e"] wrapt = ["565a021fd19419476b9362b05eeaa094178de64f8361e44468f9e9d7843901e1"] -zipp = ["4970c3758f4e89a7857a973b1e2a5d75bcdc47794442f2e2dd4fe8e0466e809a", "8a5712cfd3bb4248015eb3b0b3c54a5f6ee3f2425963ef2a0125b8bc40aafaec"] +zipp = ["3718b1cbcd963c7d4c5511a8240812904164b7f381b647143a89d3b98f9bcd8e", "f06903e9f1f43b12d371004b4ac7b06ab39a44adc747266928ae6debfa7b3335"] diff --git a/src/nitpick/app.py b/src/nitpick/app.py index 25dd9610..903c9a13 100644 --- a/src/nitpick/app.py +++ b/src/nitpick/app.py @@ -138,7 +138,7 @@ def as_flake8_warning(nitpick_error: NitpickError) -> Flake8Error: else nitpick_error.number ) suggestion_with_newline = ( - click.style("\n{}".format(nitpick_error.suggestion.rstrip()), fg="bright_green") + click.style("\n{}".format(nitpick_error.suggestion.rstrip()), fg="green") if nitpick_error.suggestion else "" ) diff --git a/tests/test_json.py b/tests/test_json.py index 76f26fa0..bc983292 100644 --- a/tests/test_json.py +++ b/tests/test_json.py @@ -13,7 +13,7 @@ def test_suggest_initial_contents(request): """ ).flake8().assert_errors_contain( """ - NIP341 File package.json was not found. Create it with this content:\x1b[92m + NIP341 File package.json was not found. Create it with this content:\x1b[32m { "name": "", "release": { @@ -38,7 +38,7 @@ def test_json_file_contains_keys(request): """ ).save_file("package.json", '{"name": "myproject", "version": "0.0.1"}').flake8().assert_errors_contain( """ - NIP348 File package.json has missing keys:\x1b[92m + NIP348 File package.json has missing keys:\x1b[32m { "release": { "plugins": "" @@ -68,7 +68,7 @@ def test_missing_different_values(request): ''' ).save_file("my.json", '{"name":"myproject","formatting":{"on the":"actual file"}}').flake8().assert_errors_contain( """ - NIP348 File my.json has missing values:\x1b[92m + NIP348 File my.json has missing values:\x1b[32m { "formatting.doesnt": "matter", "formatting.here": true, @@ -83,7 +83,7 @@ def test_missing_different_values(request): # TODO: check different values on JSON files # ).assert_errors_contain( # """ - # NIP349 File my.json has different values. Use this:\x1b[92m + # NIP349 File my.json has different values. Use this:\x1b[32m # { # "formatting": { # "here": true, @@ -108,7 +108,7 @@ def test_invalid_json(request): """ ''' ).flake8().assert_errors_contain( - "NIP001 File nitpick-style.toml has an incorrect style. Invalid config:\x1b[92m\n" + "NIP001 File nitpick-style.toml has an incorrect style. Invalid config:\x1b[32m\n" + '"another.json".contains_json.some_field.value: Invalid JSON (json.decoder.JSONDecodeError:' + " Invalid control character at: line 1 column 37 (char 36))\x1b[0m" ) diff --git a/tests/test_plugin.py b/tests/test_plugin.py index bd1c2cc6..1a1f9b75 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -45,7 +45,7 @@ def test_missing_message(request): ) project.assert_errors_contain( """ - NIP001 File nitpick-style.toml has an incorrect style. Invalid config:\x1b[92m + NIP001 File nitpick-style.toml has an incorrect style. Invalid config:\x1b[32m nitpick.files."pyproject.toml": Unknown file. See {}nitpick_section.html#nitpick-files.\x1b[0m """.format( READ_THE_DOCS_URL diff --git a/tests/test_pre_commit.py b/tests/test_pre_commit.py index c0888b94..657373a3 100644 --- a/tests/test_pre_commit.py +++ b/tests/test_pre_commit.py @@ -23,7 +23,7 @@ def test_suggest_initial_contents(request): """ ).flake8().assert_errors_contain( """ - NIP331 File .pre-commit-config.yaml was not found. Create it with this content:\x1b[92m + NIP331 File .pre-commit-config.yaml was not found. Create it with this content:\x1b[32m repos: - repo: https://github.com/asottile/seed-isort-config rev: v1.9.2 @@ -58,7 +58,7 @@ def test_root_values_on_missing_file(request): """ ).flake8().assert_errors_contain_unordered( """ - NIP331 File .pre-commit-config.yaml was not found. Create it with this content:\x1b[92m + NIP331 File .pre-commit-config.yaml was not found. Create it with this content:\x1b[32m bla_bla: oh yeah fail_fast: true whatever: '1'\x1b[0m @@ -86,13 +86,13 @@ def test_root_values_on_existing_file(request): """ ).flake8().assert_errors_contain_unordered( """ - NIP338 File .pre-commit-config.yaml has missing values:\x1b[92m + NIP338 File .pre-commit-config.yaml has missing values:\x1b[32m blabla: what fail_fast: true\x1b[0m """ ).assert_errors_contain( """ - NIP339 File .pre-commit-config.yaml has different values. Use this:\x1b[92m + NIP339 File .pre-commit-config.yaml has different values. Use this:\x1b[32m another_thing: yep something: true\x1b[0m """ @@ -365,7 +365,7 @@ def test_missing_different_values(request): """ ).flake8().assert_errors_contain( """ - NIP332 File .pre-commit-config.yaml: hook 'mypy' not found. Use this:\x1b[92m + NIP332 File .pre-commit-config.yaml: hook 'mypy' not found. Use this:\x1b[32m - repo: https://github.com/pre-commit/mirrors-mypy rev: v0.720 hooks: @@ -373,7 +373,7 @@ def test_missing_different_values(request): """ ).assert_errors_contain( """ - NIP332 File .pre-commit-config.yaml: hook 'python-check-mock-methods' not found. Use this:\x1b[92m + NIP332 File .pre-commit-config.yaml: hook 'python-check-mock-methods' not found. Use this:\x1b[32m - repo: https://github.com/pre-commit/pygrep-hooks rev: v1.4.1 hooks: @@ -381,34 +381,34 @@ def test_missing_different_values(request): """ ).assert_errors_contain( """ - NIP339 File .pre-commit-config.yaml: hook 'bashate' has different values. Use this:\x1b[92m + NIP339 File .pre-commit-config.yaml: hook 'bashate' has different values. Use this:\x1b[32m rev: 0.6.0\x1b[0m """ ).assert_errors_contain( """ - NIP339 File .pre-commit-config.yaml: hook 'python-check-blanket-noqa' has different values. Use this:\x1b[92m + NIP339 File .pre-commit-config.yaml: hook 'python-check-blanket-noqa' has different values. Use this:\x1b[32m rev: v1.4.1\x1b[0m """ ).assert_errors_contain( """ - NIP339 File .pre-commit-config.yaml: hook 'python-no-eval' has different values. Use this:\x1b[92m + NIP339 File .pre-commit-config.yaml: hook 'python-no-eval' has different values. Use this:\x1b[32m rev: v1.4.1\x1b[0m """ ).assert_errors_contain( """ - NIP339 File .pre-commit-config.yaml: hook 'python-no-log-warn' has different values. Use this:\x1b[92m + NIP339 File .pre-commit-config.yaml: hook 'python-no-log-warn' has different values. Use this:\x1b[32m rev: v1.4.1\x1b[0m """ ).assert_errors_contain( """ - NIP339 File .pre-commit-config.yaml: hook 'my-hook' has different values. Use this:\x1b[92m + NIP339 File .pre-commit-config.yaml: hook 'my-hook' has different values. Use this:\x1b[32m args: - --expected - arguments\x1b[0m """ ).assert_errors_contain( """ - NIP339 File .pre-commit-config.yaml: hook 'rst-backticks' has different values. Use this:\x1b[92m + NIP339 File .pre-commit-config.yaml: hook 'rst-backticks' has different values. Use this:\x1b[32m rev: v1.4.1\x1b[0m """, 8, diff --git a/tests/test_setup_cfg.py b/tests/test_setup_cfg.py index 139f8231..b24d53b3 100644 --- a/tests/test_setup_cfg.py +++ b/tests/test_setup_cfg.py @@ -30,7 +30,7 @@ def test_comma_separated_keys_on_style_file(request): ) project.assert_single_error( """ - NIP322 File setup.cfg has missing values in the 'eat' key. Include those values:\x1b[92m + NIP322 File setup.cfg has missing values in the 'eat' key. Include those values:\x1b[32m [food] eat = (...),ham,salt\x1b[0m """ @@ -55,7 +55,7 @@ def test_suggest_initial_contents(request): """ ).flake8().assert_errors_contain( """ - NIP321 File setup.cfg was not found. Create it with this content:\x1b[92m + NIP321 File setup.cfg was not found. Create it with this content:\x1b[32m [flake8] max-line-length = 120 @@ -91,7 +91,7 @@ def test_missing_sections(request): """ ).flake8().assert_single_error( """ - NIP321 File setup.cfg has some missing sections. Use this:\x1b[92m + NIP321 File setup.cfg has some missing sections. Use this:\x1b[32m [flake8] max-line-length = 120 @@ -125,13 +125,13 @@ def test_different_missing_keys(request): """ ).flake8().assert_errors_contain( """ - NIP323 File setup.cfg: [isort]line_length is 30 but it should be like this:\x1b[92m + NIP323 File setup.cfg: [isort]line_length is 30 but it should be like this:\x1b[32m [isort] line_length = 110\x1b[0m """ ).assert_errors_contain( """ - NIP324 File setup.cfg: section [flake8] has some missing key/value pairs. Use this:\x1b[92m + NIP324 File setup.cfg: section [flake8] has some missing key/value pairs. Use this:\x1b[32m [flake8] max-line-length = 112\x1b[0m """ @@ -153,7 +153,7 @@ def test_invalid_configuration_comma_separated_values(request): """ ).flake8().assert_errors_contain( """ - NIP321 File setup.cfg was not found. Create it with this content:\x1b[92m + NIP321 File setup.cfg was not found. Create it with this content:\x1b[32m [flake8] ignore = D100,D101,D102,D103,D104,D105,D106,D107,D202,E203,W503 max-complexity = 12 diff --git a/tests/test_style.py b/tests/test_style.py index 0bebaf1b..918b4719 100644 --- a/tests/test_style.py +++ b/tests/test_style.py @@ -52,19 +52,19 @@ def test_multiple_styles_overriding_values(request): """ ).flake8().assert_errors_contain( """ - NIP318 File pyproject.toml has missing values:\x1b[92m + NIP318 File pyproject.toml has missing values:\x1b[32m [tool.black] line-length = 100\x1b[0m """ ).assert_errors_contain( """ - NIP319 File pyproject.toml has different values. Use this:\x1b[92m + NIP319 File pyproject.toml has different values. Use this:\x1b[32m [tool.black] something = 11\x1b[0m """ ).assert_errors_contain( """ - NIP321 File setup.cfg was not found. Create it with this content:\x1b[92m + NIP321 File setup.cfg was not found. Create it with this content:\x1b[32m [flake8] inline-quotes = double something = 123 @@ -122,13 +122,13 @@ def test_include_styles_overriding_values(request): """ ).flake8().assert_errors_contain( """ - NIP318 File pyproject.toml has missing values:\x1b[92m + NIP318 File pyproject.toml has missing values:\x1b[32m [tool.black] line-length = 100\x1b[0m """ ).assert_errors_contain( """ - NIP321 File setup.cfg was not found. Create it with this content:\x1b[92m + NIP321 File setup.cfg was not found. Create it with this content:\x1b[32m [flake8] inline-quotes = double something = 123 @@ -225,7 +225,7 @@ def test_relative_and_other_root_dirs(request): ) ).flake8().assert_single_error( """ - NIP318 File pyproject.toml has missing values:\x1b[92m + NIP318 File pyproject.toml has missing values:\x1b[32m [tool.black] missing = "value"\x1b[0m """ @@ -242,7 +242,7 @@ def test_relative_and_other_root_dirs(request): ) ).flake8().assert_single_error( """ - NIP318 File pyproject.toml has missing values:\x1b[92m + NIP318 File pyproject.toml has missing values:\x1b[32m [tool.black] missing = "value"\x1b[0m """ @@ -259,7 +259,7 @@ def test_relative_and_other_root_dirs(request): ) ).flake8().assert_single_error( """ - NIP318 File pyproject.toml has missing values:\x1b[92m + NIP318 File pyproject.toml has missing values:\x1b[32m [tool.black] missing = "value" @@ -293,7 +293,7 @@ def test_symlink_subdir(request): """ ).flake8().assert_single_error( """ - NIP318 File pyproject.toml has missing values:\x1b[92m + NIP318 File pyproject.toml has missing values:\x1b[32m [tool.black] line-length = 86\x1b[0m """ @@ -345,7 +345,7 @@ def test_relative_style_on_urls(request): ) ).flake8().assert_single_error( """ - NIP318 File pyproject.toml has missing values:\x1b[92m + NIP318 File pyproject.toml has missing values:\x1b[32m [tool.black] missing = "value"\x1b[0m """ @@ -362,7 +362,7 @@ def test_relative_style_on_urls(request): ) ).flake8().assert_single_error( """ - NIP318 File pyproject.toml has missing values:\x1b[92m + NIP318 File pyproject.toml has missing values:\x1b[32m [tool.black] missing = "value"\x1b[0m """ @@ -379,7 +379,7 @@ def test_relative_style_on_urls(request): ) ).flake8().assert_single_error( """ - NIP318 File pyproject.toml has missing values:\x1b[92m + NIP318 File pyproject.toml has missing values:\x1b[32m [tool.black] missing = "value" @@ -410,7 +410,7 @@ def test_fetch_private_github_urls(request): ) ).flake8().assert_single_error( """ - NIP318 File pyproject.toml has missing values:\x1b[92m + NIP318 File pyproject.toml has missing values:\x1b[32m [tool.black] missing = "thing"\x1b[0m """ @@ -497,7 +497,7 @@ def test_invalid_tool_nitpick_on_pyproject_toml(request): ]: project.pyproject_toml("[tool.nitpick]\n{}".format(style)).flake8().assert_errors_contain( "NIP001 File pyproject.toml has an incorrect style." - + " Invalid data in [tool.nitpick]:\x1b[92m\n{}\x1b[0m".format(error_message), + + " Invalid data in [tool.nitpick]:\x1b[32m\n{}\x1b[0m".format(error_message), 1, ) @@ -537,12 +537,12 @@ def test_invalid_nitpick_files(request): """ ).flake8().assert_errors_contain( """ - NIP001 File some_style.toml has an incorrect style. Invalid config:\x1b[92m + NIP001 File some_style.toml has an incorrect style. Invalid config:\x1b[32m xxx: Unknown file. See https://nitpick.rtfd.io/en/latest/config_files.html.\x1b[0m """ ).assert_errors_contain( """ - NIP001 File wrong_files.toml has an incorrect style. Invalid config:\x1b[92m + NIP001 File wrong_files.toml has an incorrect style. Invalid config:\x1b[32m nitpick.files.whatever: Unknown file. See {}nitpick_section.html#nitpick-files.\x1b[0m """.format( READ_THE_DOCS_URL