Skip to content

Commit

Permalink
Fix linters (#1551)
Browse files Browse the repository at this point in the history
- prevent use of rich 10.2 until we discover the cause of mypy failure
- bump linting dependencies
  • Loading branch information
ssbarnea committed May 18, 2021
1 parent 9a2c156 commit e451369
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 deletions.
4 changes: 3 additions & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@ max-complexity = 10
# Accessibility/large fonts and PEP8 unfriendly:
max-line-length = 100

# The only allowed ignores are related to black and isort
# https://black.readthedocs.io/en/stable/the_black_code_style.html#line-length
ignore = E203,E501,W503
# "H" are generated by hacking plugin, which is not black compatible
ignore = E203,E501,W503,H

# Allow certain violations in certain files:
per-file-ignores =
Expand Down
15 changes: 8 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ repos:
files: >-
^setup\.py$
- repo: https://github.com/pre-commit/pre-commit-hooks.git
rev: v3.4.0
rev: v4.0.1
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
Expand Down Expand Up @@ -62,12 +62,12 @@ repos:
# https://github.com/pre-commit/mirrors-isort/issues/9#issuecomment-624404082
- --filter-files
- repo: https://github.com/python/black.git
rev: 20.8b1
rev: 21.5b1
hooks:
- id: black
language_version: python3
- repo: https://github.com/pycqa/flake8.git
rev: 3.9.0
rev: 3.9.2
hooks:
- id: flake8
language_version: python3
Expand All @@ -88,6 +88,8 @@ repos:
- enrich
- flaky
- pytest
# https://github.com/willmcgugan/rich/discussions/1243
- rich>=9.5.1,<10.2
- ruamel.yaml
- tenacity
- types-PyYAML
Expand All @@ -99,11 +101,9 @@ repos:
plugins/.*
)$
- repo: https://github.com/pre-commit/mirrors-pylint
rev: v2.6.0
rev: v3.0.0a3
hooks:
- id: pylint
# temporary workaround as pylint is not compatible with 3.9
language_version: "3.8"
additional_dependencies:
- ansible-base
- docutils
Expand All @@ -113,6 +113,7 @@ repos:
- pyyaml
- rich
- ruamel.yaml
- tenacity
- sphinx
- tenacity
- typing_extensions
- wcmatch
2 changes: 1 addition & 1 deletion src/ansiblelint/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def report_outcome(
return 2


def main(argv: List[str] = None) -> int:
def main(argv: Optional[List[str]] = None) -> int:
"""Linter CLI entry point."""
if argv is None:
argv = sys.argv
Expand Down
1 change: 1 addition & 0 deletions src/ansiblelint/file_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ def __init__(
self.role = role.name

if str(self.path) in ['/dev/stdin', '-']:
# pylint: disable=consider-using-with
self.file = NamedTemporaryFile(mode="w+", suffix="playbook.yml")
self.filename = self.file.name
self._content = sys.stdin.read()
Expand Down
2 changes: 1 addition & 1 deletion src/ansiblelint/rules/UseCommandInsteadOfShellRule.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,5 @@ def matchtask(
unjinjad_cmd = self.unjinja(
' '.join(task["action"].get("__ansible_arguments__", []))
)
return not any([ch in unjinjad_cmd for ch in '&|<>;$\n*[]{}?`'])
return not any(ch in unjinjad_cmd for ch in '&|<>;$\n*[]{}?`')
return False

0 comments on commit e451369

Please sign in to comment.