Skip to content

Commit

Permalink
fix: use green color to be compatible with click 6.7
Browse files Browse the repository at this point in the history
  • Loading branch information
andreoliwa committed Aug 26, 2019
1 parent e1192a4 commit 54a6f4e
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 45 deletions.
11 changes: 7 additions & 4 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/nitpick/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
)
Expand Down
10 changes: 5 additions & 5 deletions tests/test_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": "<some value here>",
"release": {
Expand All @@ -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": "<some value here>"
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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"
)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 12 additions & 12 deletions tests/test_pre_commit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
"""
Expand Down Expand Up @@ -365,50 +365,50 @@ 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:
- id: mypy\x1b[0m
"""
).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:
- id: python-check-mock-methods\x1b[0m
"""
).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,
Expand Down
12 changes: 6 additions & 6 deletions tests/test_setup_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
"""
Expand All @@ -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
Expand Down
Loading

0 comments on commit 54a6f4e

Please sign in to comment.