Skip to content

Commit

Permalink
Merge e498013 into 4ad3b91
Browse files Browse the repository at this point in the history
  • Loading branch information
renovate[bot] committed Jul 7, 2021
2 parents 4ad3b91 + e498013 commit 336bdf3
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Expand Up @@ -51,7 +51,7 @@ repos:
hooks:
- id: isort
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.8.0
rev: v1.9.0
hooks:
- id: python-check-blanket-noqa
- id: python-check-mock-methods
Expand Down
2 changes: 0 additions & 2 deletions docs/examples.rst
Expand Up @@ -339,15 +339,13 @@ Contents of `styles/pre-commit/python.toml <https://github.com/andreoliwa/nitpic
[[".pre-commit-config.yaml".repos]]
yaml = """
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.8.0
hooks:
- id: python-check-blanket-noqa
- id: python-check-mock-methods
- id: python-no-eval
- id: python-no-log-warn
- id: rst-backticks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
- id: debug-statements
- repo: https://github.com/asottile/pyupgrade
Expand Down
2 changes: 1 addition & 1 deletion src/nitpick/formats.py
Expand Up @@ -176,7 +176,7 @@ def compare_with_flatten(self, expected: Union[JsonDict, "BaseFormat"] = None) -
{
k: v
for k, v in comparison.flat_expected.items()
if k in comparison.flat_actual and comparison.flat_expected[k] != comparison.flat_actual[k]
if k in comparison.flat_actual and v != comparison.flat_actual[k]
}
)
)
Expand Down
2 changes: 0 additions & 2 deletions styles/pre-commit/python.toml
@@ -1,15 +1,13 @@
[[".pre-commit-config.yaml".repos]]
yaml = """
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.8.0
hooks:
- id: python-check-blanket-noqa
- id: python-check-mock-methods
- id: python-no-eval
- id: python-no-log-warn
- id: rst-backticks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
- id: debug-statements
- repo: https://github.com/asottile/pyupgrade
Expand Down
1 change: 1 addition & 0 deletions tests/helpers.py
Expand Up @@ -201,6 +201,7 @@ def style(self, file_contents: str) -> "ProjectMock":
"""Save the default style file."""
return self.save_file(NITPICK_STYLE_TOML, file_contents)

# TODO: remove this function, don't test real styles anymore to avoid breaking tests on Renovate updates
def load_styles(self, *args: PathOrStr) -> "ProjectMock":
"""Load style files from the 'styles' dir, to be used on tests.
Expand Down
65 changes: 62 additions & 3 deletions tests/test_pre_commit.py
Expand Up @@ -376,8 +376,6 @@ def assert_hook_yaml(key, yaml_string):

def test_missing_different_values(tmp_path):
"""Test missing and different values on the hooks."""
# TODO: add loaded and named styles automatically to pyproject_toml
# pylint: disable=line-too-long
ProjectMock(tmp_path).named_style(
"root",
'''
Expand All @@ -390,7 +388,68 @@ def test_missing_different_values(tmp_path):
args: [--expected, arguments]
"""
''',
).load_styles("mypy", "pre-commit/python", "pre-commit/bash").pyproject_toml(
).named_style(
"mypy",
'''
# https://mypy.readthedocs.io/en/latest/config_file.html
["setup.cfg".mypy]
ignore_missing_imports = true
# Do not follow imports (except for ones found in typeshed)
follow_imports = "skip"
# Treat Optional per PEP 484
strict_optional = true
# Ensure all execution paths are returning
warn_no_return = true
# Lint-style cleanliness for typing
warn_redundant_casts = true
warn_unused_ignores = true
[[".pre-commit-config.yaml".repos]]
yaml = """
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.812
hooks:
- id: mypy
"""
''',
).named_style(
"pre-commit/python",
'''
[[".pre-commit-config.yaml".repos]]
yaml = """
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.8.0
hooks:
- id: python-check-blanket-noqa
- id: python-check-mock-methods
- id: python-no-eval
- id: python-no-log-warn
- id: rst-backticks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
- id: debug-statements
- repo: https://github.com/asottile/pyupgrade
hooks:
- id: pyupgrade
"""
''',
).named_style(
"pre-commit/bash",
'''
[[".pre-commit-config.yaml".repos]]
yaml = """
- repo: https://github.com/openstack/bashate
rev: 2.0.0
hooks:
- id: bashate
"""
''',
).pyproject_toml(
"""
[tool.nitpick]
style = ["root", "mypy", "pre-commit/python", "pre-commit/bash"]
Expand Down

0 comments on commit 336bdf3

Please sign in to comment.