Add pylint (#892)

* Move mypy/flake8/isort config files to more 'natural' places.

* Add pylint.

* Look at no-member.

* Look at pointless-* and unnecessary-pass.

* Look at useless-*.

* Lint.
This commit is contained in:
Felix Fontein
2025-05-17 16:45:37 +02:00
committed by GitHub
parent 5fbf35df86
commit 990b40df3e
17 changed files with 681 additions and 54 deletions

View File

@@ -1,13 +0,0 @@
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
# SPDX-FileCopyrightText: 2025 Felix Fontein <felix@fontein.de>
[flake8]
extend-ignore = E203, E402, F401
count = true
# TODO: decrease this to ~10
max-complexity = 60
# black's max-line-length is 89, but it doesn't touch long string literals.
# Since ansible-test's limit is 160, let's use that here.
max-line-length = 160
statistics = true

View File

@@ -1,7 +0,0 @@
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
[isort]
profile=black
lines_after_imports = 2

View File

@@ -1,19 +0,0 @@
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
[mypy]
# check_untyped_defs = True
# disallow_untyped_defs = True -- not yet feasible
# strict = True -- only try to enable once everything is typed
strict_equality = True
[mypy-ansible.*]
# ansible-core has no typing information
# ignore_missing_imports = True
follow_untyped_imports = True
[mypy-ansible_collections.community.internal_test_tools.*]
# community.internal_test_tools has no typing information
ignore_missing_imports = True

View File

@@ -205,7 +205,6 @@ def test_invalid_user_key_params(
result = True
except Exception as e:
print(e)
pass
assert result
@@ -225,7 +224,6 @@ def test_invalid_key_sizes(
result = True
except Exception as e:
print(e)
pass
assert result
@@ -239,7 +237,6 @@ def test_valid_comment_update() -> None:
pair.comment = new_comment
except Exception as e:
print(e)
pass
assert (
pair.comment == new_comment