From bb9a06f69bfe77c0b6250406e5e12a61561fba36 Mon Sep 17 00:00:00 2001 From: "Bradley A. Thornton" Date: Mon, 29 Apr 2024 15:19:08 -0700 Subject: [PATCH 1/4] Fix not a repo --- .vscode/settings.json | 2 +- pyproject.toml | 3 +- .../subcommands/installer.py | 45 +++--- tests/unit/conftest.py | 29 ++++ tests/unit/test_installer.py | 151 ++++++++++++++++++ 5 files changed, 207 insertions(+), 23 deletions(-) create mode 100644 tests/unit/conftest.py create mode 100644 tests/unit/test_installer.py diff --git a/.vscode/settings.json b/.vscode/settings.json index 378860b..95b3f85 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -8,7 +8,7 @@ "editor.codeActionsOnSave": { "source.fixAll": "explicit" }, - "editor.defaultFormatter": "ms-python.black-formatter" + "editor.defaultFormatter": "charliermarsh.ruff" }, "mypy.runUsingActiveInterpreter": true, "mypy.targets": ["src", "tests"], diff --git a/pyproject.toml b/pyproject.toml index a99a741..1a68fba 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -266,10 +266,11 @@ lines-after-imports = 2 # Ensures consistency for cases when there's variable vs lines-between-types = 1 # Separate import/from with 1 line [tool.ruff.per-file-ignores] +# SLF001: Allow private member access in tests # S101 Allow assert in tests # S602 Allow shell in test # T201 Allow print in tests -"tests/**" = ["S101", "S602", "T201"] +"tests/**" = ["SLF001", "S101", "S602", "T201"] [tool.ruff.pydocstyle] convention = "pep257" diff --git a/src/ansible_dev_environment/subcommands/installer.py b/src/ansible_dev_environment/subcommands/installer.py index 13cc169..36f4034 100644 --- a/src/ansible_dev_environment/subcommands/installer.py +++ b/src/ansible_dev_environment/subcommands/installer.py @@ -215,15 +215,16 @@ def _install_galaxy_requirements(self: Installer) -> None: msg = f"Source installed collections include: {oxford_join(installed)}" self._output.note(msg) - def _copy_files_using_git_ls_files( + def _find_files_using_git_ls_files( self: Installer, local_repo_path: Path | None, - ) -> str | None: + ) -> tuple[str | None, str | None]: """Copy collection files tracked using git ls-files to the build directory. Args: local_repo_path: The collection local path. Returns: + string with the command used to list files or None string containing a list of files or nothing """ msg = "List collection files using git ls-files." @@ -240,19 +241,21 @@ def _copy_files_using_git_ls_files( ) except subprocess.CalledProcessError as exc: err = f"Failed to list collection using git ls-files: {exc} {exc.stderr}" - self._output.critical(err) + self._output.info(err) + return None, None - return tracked_files_output.stdout + return "git ls-files", tracked_files_output.stdout - def _copy_files_using_ls( + def _find_files_using_ls( self: Installer, local_repo_path: Path | None, - ) -> str | None: + ) -> tuple[str | None, str | None]: """Copy collection files tracked using ls to the build directory. Args: local_repo_path: The collection local path. Returns: + string with the command used to list files or None string containing a list of files or nothing """ msg = "List collection files using ls." @@ -269,9 +272,10 @@ def _copy_files_using_ls( ) except subprocess.CalledProcessError as exc: err = f"Failed to list collection using ls: {exc} {exc.stderr}" - self._output.critical(err) + self._output.debug(err) + return None, None - return tracked_files_output.stdout + return "ls", tracked_files_output.stdout def _copy_repo_files( self: Installer, @@ -287,35 +291,34 @@ def _copy_repo_files( """ if local_repo_path is None: msg = "Invalid repo path, no files to copy" - self._output.info(msg) + self._output.debug(msg) return # Get tracked files from git ls-files command - tracked_files_output = self._copy_files_using_git_ls_files( + found_using, files_stdout = self._find_files_using_git_ls_files( local_repo_path=local_repo_path, ) - if tracked_files_output is None: - msg = "No tracked files found using git ls-files" - self._output.info(msg) - - # If no tracked files found, get files using ls command - tracked_files_output = self._copy_files_using_ls( + if not files_stdout: + found_using, files_stdout = self._find_files_using_ls( local_repo_path=local_repo_path, ) - if tracked_files_output is None: - msg = "No files found" - self._output.info(msg) + if not files_stdout: + msg = "No files found with either 'git ls-files' or 'ls" + self._output.critical(msg) return + msg = f"File list generated with '{found_using}'" + self._output.info(msg) + # Parse tracked files output - tracked_files = tracked_files_output.split("\n") + files_list = files_stdout.split("\n") # Create the destination folder if it doesn't exist Path(destination_path).mkdir(parents=True, exist_ok=True) - for file in tracked_files: + for file in files_list: src_file_path = Path(local_repo_path) / file dest_file_path = Path(destination_path) / file diff --git a/tests/unit/conftest.py b/tests/unit/conftest.py new file mode 100644 index 0000000..7084f44 --- /dev/null +++ b/tests/unit/conftest.py @@ -0,0 +1,29 @@ +"""Fixtures for unit tests.""" + +from __future__ import annotations + +from typing import TYPE_CHECKING + +import pytest + +from ansible_dev_environment.output import Output +from ansible_dev_environment.utils import TermFeatures + + +if TYPE_CHECKING: + from pathlib import Path + + +@pytest.fixture() +def output(tmp_path: Path) -> Output: + """Create an Output class object as fixture. + + :param tmp_path: App configuration object. + """ + return Output( + log_file=str(tmp_path) + "ansible-creator.log", + log_level="notset", + log_append="false", + term_features=TermFeatures(color=False, links=False), + verbosity=0, + ) diff --git a/tests/unit/test_installer.py b/tests/unit/test_installer.py new file mode 100644 index 0000000..48e706e --- /dev/null +++ b/tests/unit/test_installer.py @@ -0,0 +1,151 @@ +"""Tests for the installer.""" + +import subprocess + +from argparse import Namespace +from pathlib import Path + +import pytest + +from ansible_dev_environment.config import Config +from ansible_dev_environment.output import Output +from ansible_dev_environment.subcommands.installer import Installer + + +NAMESPACE = Namespace() +NAMESPACE.verbose = 0 + + +def test_git_no_files(tmp_path: Path, output: Output) -> None: + """Test no files using git. + + Args: + tmp_dir: Temp directory + output: Output instance + """ + config = Config(args=NAMESPACE, output=output, term_features=output.term_features) + installer = Installer(output=output, config=config) + found_using, files = installer._find_files_using_git_ls_files(local_repo_path=tmp_path) + assert not found_using + assert files is None + + +def test_git_none_tracked(tmp_path: Path, output: Output) -> None: + """Test non tracked using git. + + Args: + tmp_dir: Temp directory + output: Output instance + """ + config = Config(args=NAMESPACE, output=output, term_features=output.term_features) + installer = Installer(output=output, config=config) + subprocess.run(args=["git", "init"], cwd=tmp_path, check=False) + found_using, files = installer._find_files_using_git_ls_files(local_repo_path=tmp_path) + assert found_using == "git ls-files" + assert files == "" + + +def test_git_one_tracked(tmp_path: Path, output: Output) -> None: + """Test one tracked using git. + + Args: + tmp_dir: Temp directory + output: Output instance + """ + config = Config(args=NAMESPACE, output=output, term_features=output.term_features) + installer = Installer(output=output, config=config) + subprocess.run(args=["git", "init"], cwd=tmp_path, check=False) + (tmp_path / "file.txt").touch() + subprocess.run(args=["git", "add", "--all"], cwd=tmp_path, check=False) + found_using, files = installer._find_files_using_git_ls_files(local_repo_path=tmp_path) + assert found_using == "git ls-files" + assert files == "file.txt\n" + + +def test_ls_no_files(tmp_path: Path, output: Output) -> None: + """Test no files using ls. + + Args: + tmp_dir: Temp directory + output: Output instance + """ + config = Config(args=NAMESPACE, output=output, term_features=output.term_features) + installer = Installer(output=output, config=config) + found_using, files = installer._find_files_using_ls(local_repo_path=tmp_path) + assert found_using == "ls" + assert files == "" + + +def test_ls_one_found(tmp_path: Path, output: Output) -> None: + """Test one found using ls. + + Args: + tmp_dir: Temp directory + output: Output instance + """ + config = Config(args=NAMESPACE, output=output, term_features=output.term_features) + installer = Installer(output=output, config=config) + (tmp_path / "file.txt").touch() + found_using, files = installer._find_files_using_ls(local_repo_path=tmp_path) + assert found_using == "ls" + assert files == "file.txt\n" + + +def test_copy_no_files(tmp_path: Path, output: Output) -> None: + """Test file copy no files. + + Args: + tmp_dir: Temp directory + output: Output instance + """ + source = tmp_path / "source" + source.mkdir() + dest = tmp_path / "build" + dest.mkdir() + config = Config(args=NAMESPACE, output=output, term_features=output.term_features) + installer = Installer(output=output, config=config) + with pytest.raises(SystemExit) as excinfo: + installer._copy_repo_files(local_repo_path=source, destination_path=dest) + assert excinfo.value.code == 1 + + +def test_copy_using_git(tmp_path: Path, output: Output) -> None: + """Test file copy using git. + + Args: + tmp_dir: Temp directory + output: Output instance + """ + source = tmp_path / "source" + source.mkdir() + dest = tmp_path / "build" + dest.mkdir() + config = Config(args=NAMESPACE, output=output, term_features=output.term_features) + installer = Installer(output=output, config=config) + subprocess.run(args=["git", "init"], cwd=source, check=False) + (source / "file_tracked.txt").touch() + (source / "file_untracked.txt").touch() + subprocess.run(args=["git", "add", "file_tracked.txt"], cwd=source, check=False) + installer._copy_repo_files(local_repo_path=source, destination_path=dest) + moved = dest.glob("**/*") + assert [m.name for m in list(moved)] == ["file_tracked.txt"] + + +def test_copy_using_ls(tmp_path: Path, output: Output) -> None: + """Test file copy using ls. + + Args: + tmp_dir: Temp directory + output: Output instance + """ + source = tmp_path / "source" + source.mkdir() + dest = tmp_path / "build" + dest.mkdir() + config = Config(args=NAMESPACE, output=output, term_features=output.term_features) + installer = Installer(output=output, config=config) + (source / "file1.txt").touch() + (source / "file2.txt").touch() + installer._copy_repo_files(local_repo_path=source, destination_path=dest) + moved = dest.glob("**/*") + assert [m.name for m in list(moved)] == ["file1.txt", "file2.txt"] From 48b14bef0be0bf061b3ce7215af3c18c4ca2bace Mon Sep 17 00:00:00 2001 From: "Bradley A. Thornton" Date: Mon, 29 Apr 2024 15:31:48 -0700 Subject: [PATCH 2/4] Update pylint disable --- .config/dictionary.txt | 1 + pyproject.toml | 401 ++++++++++++++++++++--------------- tests/unit/test_installer.py | 28 ++- 3 files changed, 246 insertions(+), 184 deletions(-) diff --git a/.config/dictionary.txt b/.config/dictionary.txt index d12e60e..1ec1721 100644 --- a/.config/dictionary.txt +++ b/.config/dictionary.txt @@ -10,6 +10,7 @@ cpart cpath crepository csource +excinfo fileh fqcn levelname diff --git a/pyproject.toml b/pyproject.toml index 1a68fba..12aaed9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,12 +1,12 @@ [build-system] build-backend = "setuptools.build_meta" requires = [ - "setuptools >= 65.3.0", # required by pyproject+setuptools_scm integration and editable installs - "setuptools_scm[toml] >= 7.0.5" # required for "no-local-version" scheme + "setuptools >= 65.3.0", # required by pyproject+setuptools_scm integration and editable installs + "setuptools_scm[toml] >= 7.0.5", # required for "no-local-version" scheme ] [project] -authors = [{"email" = "bthornto@redhat.com", "name" = "Bradley A. Thornton"}] +authors = [{ "email" = "bthornto@redhat.com", "name" = "Bradley A. Thornton" }] classifiers = [ 'Development Status :: 2 - Pre-Alpha', 'Intended Audience :: Developers', @@ -20,13 +20,13 @@ classifiers = [ 'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python', 'Topic :: Software Development', - 'Topic :: Utilities' + 'Topic :: Utilities', ] description = "A pip-like ansible collection installer." dynamic = ["dependencies", "optional-dependencies", "version"] keywords = ["ansible"] -license = {text = "GPL-3.0-only"} -maintainers = [{"email" = "bthornto@redhat.com", "name" = "Bradley Thornton"}] +license = { text = "GPL-3.0-only" } +maintainers = [{ "email" = "bthornto@redhat.com", "name" = "Bradley Thornton" }] name = "ansible-dev-environment" readme = "README.md" requires-python = ">=3.10" @@ -77,178 +77,233 @@ max-line-length = 100 [tool.pylint.master] good-names = "i,j,k,ex,Run,_,f,fh" ignore = [ - "_version.py" # built by setuptools_scm + "_version.py", # built by setuptools_scm ] jobs = 0 no-docstring-rgx = "__.*__" [tool.pylint.messages_control] disable = [ + "unknown-option-value", # https://gist.github.com/cidrblock/ec3412bacfeb34dbc2d334c1d53bef83 - "C0103", # invalid-name / ruff N815 - "C0105", # typevar-name-incorrect-variance / ruff PLC0105 - "C0112", # empty-docstring / ruff D419 - "C0113", # unneeded-not / ruff SIM208 - "C0114", # missing-module-docstring / ruff D100 - "C0115", # missing-class-docstring / ruff D101 - "C0116", # missing-function-docstring / ruff D103 - "C0121", # singleton-comparison / ruff PLC0121 - "C0123", # unidiomatic-typecheck / ruff E721 - "C0131", # typevar-double-variance / ruff PLC0131 - "C0132", # typevar-name-mismatch / ruff PLC0132 - # "C0198", # bad-docstring-quotes / ruff Q002 - # "C0199", # docstring-first-line-empty / ruff D210 - "C0201", # consider-iterating-dictionary / ruff SIM118 - "C0202", # bad-classmethod-argument / ruff PLC0202 - "C0205", # single-string-used-for-slots / ruff PLC0205 - "C0208", # use-sequence-for-iteration / ruff PLC0208 - "C0301", # line-too-long / ruff E501 - "C0304", # missing-final-newline / ruff W292 - "C0321", # multiple-statements / ruff PLC0321 - "C0325", # superfluous-parens / ruff UP034 - "C0410", # multiple-imports / ruff E401 - "C0411", # wrong-import-order / ruff I001 - "C0412", # ungrouped-imports / ruff I001 - "C0413", # wrong-import-position / ruff E402 - "C0414", # useless-import-alias / ruff PLC0414 - # "C0501", # consider-using-any-or-all / ruff PLC0501 - # "C1901", # compare-to-empty-string / ruff PLC1901 - # "C2201", # misplaced-comparison-constant / ruff SIM300 - "C3001", # unnecessary-lambda-assignment / ruff PLC3001 - "C3002", # unnecessary-direct-lambda-call / ruff PLC3002 - "E0001", # syntax-error / ruff E999 - "E0101", # return-in-init / ruff PLE0101 - "E0102", # function-redefined / ruff F811 - "E0103", # not-in-loop / ruff PLE0103 - "E0104", # return-outside-function / ruff F706 - "E0105", # yield-outside-function / ruff F704 - "E0107", # nonexistent-operator / ruff B002 - "E0112", # too-many-star-expressions / ruff F622 - "E0116", # continue-in-finally / ruff PLE0116 - "E0117", # nonlocal-without-binding / ruff PLE0117 - "E0118", # used-prior-global-declaration / ruff PLE0118 - "E0211", # no-method-argument / ruff N805 - "E0213", # no-self-argument / ruff N805 - "E0241", # duplicate-bases / ruff PLE0241 - "E0302", # unexpected-special-method-signature / ruff PLE0302 - "E0602", # undefined-variable / ruff F821 - "E0603", # undefined-all-variable / ruff F822 - "E0604", # invalid-all-object / ruff PLE0604 - "E0605", # invalid-all-format / ruff PLE0605 - "E0711", # notimplemented-raised / ruff F901 - "E1142", # await-outside-async / ruff PLE1142 - "E1205", # logging-too-many-args / ruff PLE1205 - "E1206", # logging-too-few-args / ruff PLE1206 - "E1301", # truncated-format-string / ruff F501 - "E1302", # mixed-format-string / ruff F506 - "E1303", # format-needs-mapping / ruff F502 - "E1304", # missing-format-string-key / ruff F524 - "E1305", # too-many-format-args / ruff F522 - "E1306", # too-few-format-args / ruff F524 - "E1307", # bad-string-format-type / ruff PLE1307 - "E1310", # bad-str-strip-call / ruff PLE1310 - "E1700", # yield-inside-async-function / ruff PLE1700 - "E2502", # bidirectional-unicode / ruff PLE2502 - "E2510", # invalid-character-backspace / ruff PLE2510 - "E2512", # invalid-character-sub / ruff PLE2512 - "E2513", # invalid-character-esc / ruff PLE2513 - "E2514", # invalid-character-nul / ruff PLE2514 - "E2515", # invalid-character-zero-width-space / ruff PLE2515 - "R0123", # literal-comparison / ruff F632 - "R0124", # comparison-with-itself / ruff PLR0124 - "R0133", # comparison-of-constants / ruff PLR0133 - "R0205", # useless-object-inheritance / ruff UP004 - "R0206", # property-with-parameters / ruff PLR0206 - "R0911", # too-many-return-statements / ruff PLR0911 - "R0912", # too-many-branches / ruff PLR0912 - "R0913", # too-many-arguments / ruff PLR0913 - "R0915", # too-many-statements / ruff PLR0915 - # "R1260", # too-complex / ruff C901 - "R1701", # consider-merging-isinstance / ruff PLR1701 - "R1705", # no-else-return / ruff RET505 - "R1706", # consider-using-ternary / ruff SIM108 - "R1707", # trailing-comma-tuple / ruff COM818 - "R1710", # inconsistent-return-statements / ruff PLR1710 - "R1711", # useless-return / ruff PLR1711 - "R1714", # consider-using-in / ruff PLR1714 - "R1715", # consider-using-get / ruff SIM401 - "R1717", # consider-using-dict-comprehension / ruff C402 - "R1718", # consider-using-set-comprehension / ruff C401 - "R1720", # no-else-raise / ruff RET506 - "R1721", # unnecessary-comprehension / ruff PLR1721 - "R1722", # consider-using-sys-exit / ruff PLR1722 - "R1723", # no-else-break / ruff RET508 - "R1724", # no-else-continue / ruff RET507 - "R1725", # super-with-arguments / ruff UP008 - "R1728", # consider-using-generator / ruff C417 - "R1729", # use-a-generator / ruff C417 - "R1734", # use-list-literal / ruff C405 - "R1735", # use-dict-literal / ruff C406 - # "R2004", # magic-value-comparison / ruff PLR2004 - # "R5501", # else-if-used / ruff PLR5501 - # "R6002", # consider-using-alias / ruff UP006 - # "R6003", # consider-alternative-union-syntax / ruff UP007 - "W0102", # dangerous-default-value / ruff B006 - "W0104", # pointless-statement / ruff B018 - "W0106", # expression-not-assigned / ruff B018 - "W0107", # unnecessary-pass / ruff PLW0107 - "W0109", # duplicate-key / ruff F601 - "W0120", # useless-else-on-loop / ruff PLW0120 - "W0122", # exec-used / ruff S102 - "W0123", # eval-used / ruff PGH001 - "W0127", # self-assigning-variable / ruff PLW0127 - "W0129", # assert-on-string-literal / ruff PLW0129 - "W0130", # duplicate-value / ruff PLW0130 - "W0131", # named-expr-without-context / ruff PLW0131 - "W0150", # lost-exception / ruff B012 - # "W0160", # consider-ternary-expression / ruff SIM108 - "W0199", # assert-on-tuple / ruff F631 - "W0301", # unnecessary-semicolon / ruff E703 - "W0401", # wildcard-import / ruff F403 - "W0406", # import-self / ruff PLW0406 - "W0410", # misplaced-future / ruff F404 - "W0511", # fixme / ruff PLW0511 - "W0602", # global-variable-not-assigned / ruff PLW0602 - "W0603", # global-statement / ruff PLW0603 - "W0611", # unused-import / ruff F401 - "W0612", # unused-variable / ruff F841 - "W0613", # unused-argument / ruff ARG001 - "W0622", # redefined-builtin / ruff A001 - "W0640", # cell-var-from-loop / ruff B023 - "W0702", # bare-except / ruff E722 - "W0705", # duplicate-except / ruff B014 - "W0706", # try-except-raise / ruff TRY302 - "W0707", # raise-missing-from / ruff TRY200 - "W0711", # binary-op-exception / ruff PLW0711 - "W0718", # broad-exception-caught / ruff PLW0718 - "W1113", # keyword-arg-before-vararg / ruff B026 - "W1201", # logging-not-lazy / ruff G - "W1202", # logging-format-interpolation / ruff G - "W1203", # logging-fstring-interpolation / ruff G - "W1300", # bad-format-string-key / ruff PLW1300 - "W1301", # unused-format-string-key / ruff F504 - "W1302", # bad-format-string / ruff PLW1302 - "W1303", # missing-format-argument-key / ruff F524 - "W1304", # unused-format-string-argument / ruff F507 - "W1305", # format-combined-specification / ruff F525 - "W1308", # duplicate-string-formatting-argument / ruff PLW1308 - "W1309", # f-string-without-interpolation / ruff F541 - "W1310", # format-string-without-interpolation / ruff PLW1310 - "W1401", # anomalous-backslash-in-string / ruff W605 - "W1404", # implicit-str-concat / ruff ISC001 - "W1405", # inconsistent-quotes / ruff Q000 - "W1508", # invalid-envvar-default / ruff PLW1508 - "W1509", # subprocess-popen-preexec-fn / ruff PLW1509 - "W1510", # subprocess-run-check / ruff PLW1510 - "W1515", # forgotten-debug-statement / ruff T100 - # "W1641", # eq-without-hash / ruff PLW1641 - # "W2901", # redefined-loop-name / ruff PLW2901 - # "W3201", # bad-dunder-name / ruff PLW3201 - "W3301", # nested-min-max / ruff PLW3301 + "C0103", # invalid-name / ruff N815 + "C0105", # typevar-name-incorrect-variance / ruff PLC0105 + "C0112", # empty-docstring / ruff D419 + "C0113", # unneeded-not / ruff SIM208 + "C0114", # missing-module-docstring / ruff D100 + "C0115", # missing-class-docstring / ruff D101 + "C0116", # missing-function-docstring / ruff D103 + "C0121", # singleton-comparison / ruff PLC0121 + "C0123", # unidiomatic-typecheck / ruff E721 + "C0131", # typevar-double-variance / ruff PLC0131 + "C0132", # typevar-name-mismatch / ruff PLC0132 + "C0198", # bad-docstring-quotes / ruff Q002 + "C0199", # docstring-first-line-empty / ruff D210 + "C0201", # consider-iterating-dictionary / ruff SIM118 + "C0202", # bad-classmethod-argument / ruff PLC0202 + "C0205", # single-string-used-for-slots / ruff PLC0205 + "C0208", # use-sequence-for-iteration / ruff PLC0208 + "C0301", # line-too-long / ruff E501 + "C0303", # trailing-whitespace / ruff W291 + "C0304", # missing-final-newline / ruff W292 + "C0321", # multiple-statements / ruff PLC0321 + "C0410", # multiple-imports / ruff E401 + "C0411", # wrong-import-order / ruff I001 + "C0412", # ungrouped-imports / ruff I001 + "C0413", # wrong-import-position / ruff E402 + "C0414", # useless-import-alias / ruff PLC0414 + "C0415", # import-outside-toplevel / ruff PLC0415 + "C0501", # consider-using-any-or-all / ruff PLC0501 + "C1901", # compare-to-empty-string / ruff PLC1901 + "C2201", # misplaced-comparison-constant / ruff SIM300 + "C2401", # non-ascii-name / ruff PLC2401 + "C2403", # non-ascii-module-import / ruff PLC2403 + "C2701", # import-private-name / ruff PLC2701 + "C2801", # unnecessary-dunder-call / ruff PLC2801 + "C3001", # unnecessary-lambda-assignment / ruff E731 + "C3002", # unnecessary-direct-lambda-call / ruff PLC3002 + "E0001", # syntax-error / ruff E999 + "E0100", # init-is-generator / ruff PLE0100 + "E0101", # return-in-init / ruff PLE0101 + "E0102", # function-redefined / ruff F811 + "E0103", # not-in-loop / ruff PLE0103 + "E0104", # return-outside-function / ruff F706 + "E0105", # yield-outside-function / ruff F704 + "E0107", # nonexistent-operator / ruff B002 + "E0112", # too-many-star-expressions / ruff F622 + "E0115", # nonlocal-and-global / ruff PLE0115 + "E0116", # continue-in-finally / ruff PLE0116 + "E0117", # nonlocal-without-binding / ruff PLE0117 + "E0118", # used-prior-global-declaration / ruff PLE0118 + "E0211", # no-method-argument / ruff N805 + "E0213", # no-self-argument / ruff N805 + "E0237", # assigning-non-slot / ruff PLE0237 + "E0241", # duplicate-bases / ruff PLE0241 + "E0302", # unexpected-special-method-signature / ruff PLE0302 + "E0303", # invalid-length-returned / ruff PLE0303 + "E0304", # invalid-bool-returned / ruff PLE0304 + "E0305", # invalid-index-returned / ruff PLE0305 + "E0308", # invalid-bytes-returned / ruff PLE0308 + "E0309", # invalid-hash-returned / ruff PLE0309 + "E0402", # relative-beyond-top-level / ruff TID252 + "E0602", # undefined-variable / ruff F821 + "E0603", # undefined-all-variable / ruff F822 + "E0604", # invalid-all-object / ruff PLE0604 + "E0605", # invalid-all-format / ruff PLE0605 + "E0643", # potential-index-error / ruff PLE0643 + "E0704", # misplaced-bare-raise / ruff PLE0704 + "E0711", # notimplemented-raised / ruff F901 + "E1132", # repeated-keyword / ruff PLE1132 + "E1142", # await-outside-async / ruff PLE1142 + "E1205", # logging-too-many-args / ruff PLE1205 + "E1206", # logging-too-few-args / ruff PLE1206 + "E1300", # bad-format-character / ruff PLE1300 + "E1301", # truncated-format-string / ruff F501 + "E1302", # mixed-format-string / ruff F506 + "E1303", # format-needs-mapping / ruff F502 + "E1304", # missing-format-string-key / ruff F524 + "E1305", # too-many-format-args / ruff F522 + "E1306", # too-few-format-args / ruff F524 + "E1307", # bad-string-format-type / ruff PLE1307 + "E1310", # bad-str-strip-call / ruff PLE1310 + "E1519", # singledispatch-method / ruff PLE1519 + "E1520", # singledispatchmethod-function / ruff PLE5120 + "E1700", # yield-inside-async-function / ruff PLE1700 + "E2502", # bidirectional-unicode / ruff PLE2502 + "E2510", # invalid-character-backspace / ruff PLE2510 + "E2512", # invalid-character-sub / ruff PLE2512 + "E2513", # invalid-character-esc / ruff PLE2513 + "E2514", # invalid-character-nul / ruff PLE2514 + "E2515", # invalid-character-zero-width-space / ruff PLE2515 + "E4703", # modified-iterating-set / ruff PLE4703 + "R0123", # literal-comparison / ruff F632 + "R0124", # comparison-with-itself / ruff PLR0124 + "R0133", # comparison-of-constants / ruff PLR0133 + "R0202", # no-classmethod-decorator / ruff PLR0202 + "R0203", # no-staticmethod-decorator / ruff PLR0203 + "R0205", # useless-object-inheritance / ruff UP004 + "R0206", # property-with-parameters / ruff PLR0206 + "R0904", # too-many-public-methods / ruff PLR0904 + "R0911", # too-many-return-statements / ruff PLR0911 + "R0912", # too-many-branches / ruff PLR0912 + "R0913", # too-many-arguments / ruff PLR0913 + "R0914", # too-many-locals / ruff PLR0914 + "R0915", # too-many-statements / ruff PLR0915 + "R0916", # too-many-boolean-expressions / ruff PLR0916 + "R1260", # too-complex / ruff C901 + "R1701", # consider-merging-isinstance / ruff PLR1701 + "R1702", # too-many-nested-blocks / ruff PLR1702 + "R1703", # simplifiable-if-statement / ruff SIM108 + "R1704", # redefined-argument-from-local / ruff PLR1704 + "R1705", # no-else-return / ruff RET505 + "R1706", # consider-using-ternary / ruff PLR1706 + "R1707", # trailing-comma-tuple / ruff COM818 + "R1710", # inconsistent-return-statements / ruff PLR1710 + "R1711", # useless-return / ruff PLR1711 + "R1714", # consider-using-in / ruff PLR1714 + "R1715", # consider-using-get / ruff SIM401 + "R1717", # consider-using-dict-comprehension / ruff C402 + "R1718", # consider-using-set-comprehension / ruff C401 + "R1719", # simplifiable-if-expression / ruff PLR1719 + "R1720", # no-else-raise / ruff RET506 + "R1721", # unnecessary-comprehension / ruff C416 + "R1722", # consider-using-sys-exit / ruff PLR1722 + "R1723", # no-else-break / ruff RET508 + "R1724", # no-else-continue / ruff RET507 + "R1725", # super-with-arguments / ruff UP008 + "R1728", # consider-using-generator / ruff C417 + "R1729", # use-a-generator / ruff C419 + "R1730", # consider-using-min-builtin / ruff PLR1730 + "R1731", # consider-using-max-builtin / ruff PLR1730 + "R1732", # consider-using-with / ruff SIM115 + "R1733", # unnecessary-dict-index-lookup / ruff PLR1733 + "R1734", # use-list-literal / ruff C405 + "R1735", # use-dict-literal / ruff C406 + "R1736", # unnecessary-list-index-lookup / ruff PLR1736 + "R2004", # magic-value-comparison / ruff PLR2004 + "R2044", # empty-comment / ruff PLR2044 + "R5501", # else-if-used / ruff PLR5501 + "R6002", # consider-using-alias / ruff UP006 + "R6003", # consider-alternative-union-syntax / ruff UP007 + "R6104", # consider-using-augmented-assign / ruff PLR6104 + "R6201", # use-set-for-membership / ruff PLR6201 + "R6301", # no-self-use / ruff PLR6301 + "W0102", # dangerous-default-value / ruff B006 + "W0104", # pointless-statement / ruff B018 + "W0106", # expression-not-assigned / ruff B018 + "W0107", # unnecessary-pass / ruff PIE790 + "W0108", # unnecessary-lambda / ruff PLW0108 + "W0109", # duplicate-key / ruff F601 + "W0120", # useless-else-on-loop / ruff PLW0120 + "W0122", # exec-used / ruff S102 + "W0123", # eval-used / ruff PGH001 + "W0127", # self-assigning-variable / ruff PLW0127 + "W0129", # assert-on-string-literal / ruff PLW0129 + "W0130", # duplicate-value / ruff B033 + "W0131", # named-expr-without-context / ruff PLW0131 + "W0133", # pointless-exception-statement / ruff PLW0133 + "W0150", # lost-exception / ruff B012 + "W0160", # consider-ternary-expression / ruff SIM108 + "W0177", # nan-comparison / ruff PLW0117 + "W0199", # assert-on-tuple / ruff F631 + "W0211", # bad-staticmethod-argument / ruff PLW0211 + "W0212", # protected-access / ruff SLF001 + "W0245", # super-without-brackets / ruff PLW0245 + "W0301", # unnecessary-semicolon / ruff E703 + "W0401", # wildcard-import / ruff F403 + "W0404", # reimported / ruff F811 + "W0406", # import-self / ruff PLW0406 + "W0410", # misplaced-future / ruff F404 + "W0511", # fixme / ruff PLW0511 + "W0602", # global-variable-not-assigned / ruff PLW0602 + "W0603", # global-statement / ruff PLW0603 + "W0604", # global-at-module-level / ruff PLW0604 + "W0611", # unused-import / ruff F401 + "W0612", # unused-variable / ruff F841 + "W0613", # unused-argument / ruff ARG001 + "W0622", # redefined-builtin / ruff A001 + "W0640", # cell-var-from-loop / ruff B023 + "W0702", # bare-except / ruff E722 + "W0705", # duplicate-except / ruff B014 + "W0706", # try-except-raise / ruff TRY302 + "W0707", # raise-missing-from / ruff TRY200 + "W0711", # binary-op-exception / ruff PLW0711 + "W0718", # broad-exception-caught / ruff PLW0718 + "W0719", # broad-exception-raised / ruff TRY002 + "W1113", # keyword-arg-before-vararg / ruff B026 + "W1201", # logging-not-lazy / ruff G + "W1202", # logging-format-interpolation / ruff G + "W1203", # logging-fstring-interpolation / ruff G + "W1300", # bad-format-string-key / ruff PLW1300 + "W1301", # unused-format-string-key / ruff F504 + "W1302", # bad-format-string / ruff PLW1302 + "W1303", # missing-format-argument-key / ruff F524 + "W1304", # unused-format-string-argument / ruff F507 + "W1305", # format-combined-specification / ruff F525 + "W1308", # duplicate-string-formatting-argument / ruff PLW1308 + "W1309", # f-string-without-interpolation / ruff F541 + "W1310", # format-string-without-interpolation / ruff F541 + "W1401", # anomalous-backslash-in-string / ruff W605 + "W1404", # implicit-str-concat / ruff ISC001 + "W1405", # inconsistent-quotes / ruff Q000 + "W1406", # redundant-u-string-prefix / ruff UP025 + "W1501", # bad-open-mode / ruff PLW1501 + "W1508", # invalid-envvar-default / ruff PLW1508 + "W1509", # subprocess-popen-preexec-fn / ruff PLW1509 + "W1510", # subprocess-run-check / ruff PLW1510 + "W1514", # unspecified-encoding / ruff PLW1514 + "W1515", # forgotten-debug-statement / ruff T100 + "W1518", # method-cache-max-size-none / ruff B019 + "W1641", # eq-without-hash / ruff PLW1641 + "W2101", # useless-with-lock / ruff PLW2101 + "W2402", # non-ascii-file-name / ruff N999 + "W2901", # redefined-loop-name / ruff PLW2901 + "W3201", # bad-dunder-name / ruff PLW3201 + "W3301", # nested-min-max / ruff PLW3301 "duplicate-code", "fixme", "too-few-public-methods", - "unsubscriptable-object" + "unsubscriptable-object", ] [tool.ruff] @@ -276,10 +331,10 @@ lines-between-types = 1 # Separate import/from with 1 line convention = "pep257" [tool.setuptools.dynamic] -dependencies = {file = [".config/requirements.in"]} -optional-dependencies.dev = {file = [".config/requirements-dev.in"]} -optional-dependencies.docs = {file = [".config/requirements-docs.in"]} -optional-dependencies.test = {file = [".config/requirements-test.in"]} +dependencies = { file = [".config/requirements.in"] } +optional-dependencies.dev = { file = [".config/requirements-dev.in"] } +optional-dependencies.docs = { file = [".config/requirements-docs.in"] } +optional-dependencies.test = { file = [".config/requirements-test.in"] } [tool.setuptools_scm] # To prevent accidental pick of mobile version tags such 'v6' @@ -290,7 +345,7 @@ git_describe_command = [ "--long", "--tags", "--match", - "v*.*" + "v*.*", ] local_scheme = "no-local-version" tag_regex = '^(?Pv)?(?P[^\+]+)(?P.*)?$' diff --git a/tests/unit/test_installer.py b/tests/unit/test_installer.py index 48e706e..945990c 100644 --- a/tests/unit/test_installer.py +++ b/tests/unit/test_installer.py @@ -20,12 +20,14 @@ def test_git_no_files(tmp_path: Path, output: Output) -> None: """Test no files using git. Args: - tmp_dir: Temp directory + tmp_path: Temp directory output: Output instance """ config = Config(args=NAMESPACE, output=output, term_features=output.term_features) installer = Installer(output=output, config=config) - found_using, files = installer._find_files_using_git_ls_files(local_repo_path=tmp_path) + found_using, files = installer._find_files_using_git_ls_files( + local_repo_path=tmp_path, + ) assert not found_using assert files is None @@ -34,13 +36,15 @@ def test_git_none_tracked(tmp_path: Path, output: Output) -> None: """Test non tracked using git. Args: - tmp_dir: Temp directory + tmp_path: Temp directory output: Output instance """ config = Config(args=NAMESPACE, output=output, term_features=output.term_features) installer = Installer(output=output, config=config) subprocess.run(args=["git", "init"], cwd=tmp_path, check=False) - found_using, files = installer._find_files_using_git_ls_files(local_repo_path=tmp_path) + found_using, files = installer._find_files_using_git_ls_files( + local_repo_path=tmp_path, + ) assert found_using == "git ls-files" assert files == "" @@ -49,7 +53,7 @@ def test_git_one_tracked(tmp_path: Path, output: Output) -> None: """Test one tracked using git. Args: - tmp_dir: Temp directory + tmp_path: Temp directory output: Output instance """ config = Config(args=NAMESPACE, output=output, term_features=output.term_features) @@ -57,7 +61,9 @@ def test_git_one_tracked(tmp_path: Path, output: Output) -> None: subprocess.run(args=["git", "init"], cwd=tmp_path, check=False) (tmp_path / "file.txt").touch() subprocess.run(args=["git", "add", "--all"], cwd=tmp_path, check=False) - found_using, files = installer._find_files_using_git_ls_files(local_repo_path=tmp_path) + found_using, files = installer._find_files_using_git_ls_files( + local_repo_path=tmp_path, + ) assert found_using == "git ls-files" assert files == "file.txt\n" @@ -66,7 +72,7 @@ def test_ls_no_files(tmp_path: Path, output: Output) -> None: """Test no files using ls. Args: - tmp_dir: Temp directory + tmp_path: Temp directory output: Output instance """ config = Config(args=NAMESPACE, output=output, term_features=output.term_features) @@ -80,7 +86,7 @@ def test_ls_one_found(tmp_path: Path, output: Output) -> None: """Test one found using ls. Args: - tmp_dir: Temp directory + tmp_path: Temp directory output: Output instance """ config = Config(args=NAMESPACE, output=output, term_features=output.term_features) @@ -95,7 +101,7 @@ def test_copy_no_files(tmp_path: Path, output: Output) -> None: """Test file copy no files. Args: - tmp_dir: Temp directory + tmp_path: Temp directory output: Output instance """ source = tmp_path / "source" @@ -113,7 +119,7 @@ def test_copy_using_git(tmp_path: Path, output: Output) -> None: """Test file copy using git. Args: - tmp_dir: Temp directory + tmp_path: Temp directory output: Output instance """ source = tmp_path / "source" @@ -135,7 +141,7 @@ def test_copy_using_ls(tmp_path: Path, output: Output) -> None: """Test file copy using ls. Args: - tmp_dir: Temp directory + tmp_path: Temp directory output: Output instance """ source = tmp_path / "source" From db37d1eb34e8a8fe28617c87a94d2b2966d00690 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 29 Apr 2024 22:32:24 +0000 Subject: [PATCH 3/4] chore: auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- pyproject.toml | 454 ++++++++++++++++++++++++------------------------- 1 file changed, 227 insertions(+), 227 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 12aaed9..4184eb7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,12 +1,12 @@ [build-system] build-backend = "setuptools.build_meta" requires = [ - "setuptools >= 65.3.0", # required by pyproject+setuptools_scm integration and editable installs - "setuptools_scm[toml] >= 7.0.5", # required for "no-local-version" scheme + "setuptools >= 65.3.0", # required by pyproject+setuptools_scm integration and editable installs + "setuptools_scm[toml] >= 7.0.5" # required for "no-local-version" scheme ] [project] -authors = [{ "email" = "bthornto@redhat.com", "name" = "Bradley A. Thornton" }] +authors = [{"email" = "bthornto@redhat.com", "name" = "Bradley A. Thornton"}] classifiers = [ 'Development Status :: 2 - Pre-Alpha', 'Intended Audience :: Developers', @@ -20,13 +20,13 @@ classifiers = [ 'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python', 'Topic :: Software Development', - 'Topic :: Utilities', + 'Topic :: Utilities' ] description = "A pip-like ansible collection installer." dynamic = ["dependencies", "optional-dependencies", "version"] keywords = ["ansible"] -license = { text = "GPL-3.0-only" } -maintainers = [{ "email" = "bthornto@redhat.com", "name" = "Bradley Thornton" }] +license = {text = "GPL-3.0-only"} +maintainers = [{"email" = "bthornto@redhat.com", "name" = "Bradley Thornton"}] name = "ansible-dev-environment" readme = "README.md" requires-python = ">=3.10" @@ -77,7 +77,7 @@ max-line-length = 100 [tool.pylint.master] good-names = "i,j,k,ex,Run,_,f,fh" ignore = [ - "_version.py", # built by setuptools_scm + "_version.py" # built by setuptools_scm ] jobs = 0 no-docstring-rgx = "__.*__" @@ -86,224 +86,224 @@ no-docstring-rgx = "__.*__" disable = [ "unknown-option-value", # https://gist.github.com/cidrblock/ec3412bacfeb34dbc2d334c1d53bef83 - "C0103", # invalid-name / ruff N815 - "C0105", # typevar-name-incorrect-variance / ruff PLC0105 - "C0112", # empty-docstring / ruff D419 - "C0113", # unneeded-not / ruff SIM208 - "C0114", # missing-module-docstring / ruff D100 - "C0115", # missing-class-docstring / ruff D101 - "C0116", # missing-function-docstring / ruff D103 - "C0121", # singleton-comparison / ruff PLC0121 - "C0123", # unidiomatic-typecheck / ruff E721 - "C0131", # typevar-double-variance / ruff PLC0131 - "C0132", # typevar-name-mismatch / ruff PLC0132 - "C0198", # bad-docstring-quotes / ruff Q002 - "C0199", # docstring-first-line-empty / ruff D210 - "C0201", # consider-iterating-dictionary / ruff SIM118 - "C0202", # bad-classmethod-argument / ruff PLC0202 - "C0205", # single-string-used-for-slots / ruff PLC0205 - "C0208", # use-sequence-for-iteration / ruff PLC0208 - "C0301", # line-too-long / ruff E501 - "C0303", # trailing-whitespace / ruff W291 - "C0304", # missing-final-newline / ruff W292 - "C0321", # multiple-statements / ruff PLC0321 - "C0410", # multiple-imports / ruff E401 - "C0411", # wrong-import-order / ruff I001 - "C0412", # ungrouped-imports / ruff I001 - "C0413", # wrong-import-position / ruff E402 - "C0414", # useless-import-alias / ruff PLC0414 - "C0415", # import-outside-toplevel / ruff PLC0415 - "C0501", # consider-using-any-or-all / ruff PLC0501 - "C1901", # compare-to-empty-string / ruff PLC1901 - "C2201", # misplaced-comparison-constant / ruff SIM300 - "C2401", # non-ascii-name / ruff PLC2401 - "C2403", # non-ascii-module-import / ruff PLC2403 - "C2701", # import-private-name / ruff PLC2701 - "C2801", # unnecessary-dunder-call / ruff PLC2801 - "C3001", # unnecessary-lambda-assignment / ruff E731 - "C3002", # unnecessary-direct-lambda-call / ruff PLC3002 - "E0001", # syntax-error / ruff E999 - "E0100", # init-is-generator / ruff PLE0100 - "E0101", # return-in-init / ruff PLE0101 - "E0102", # function-redefined / ruff F811 - "E0103", # not-in-loop / ruff PLE0103 - "E0104", # return-outside-function / ruff F706 - "E0105", # yield-outside-function / ruff F704 - "E0107", # nonexistent-operator / ruff B002 - "E0112", # too-many-star-expressions / ruff F622 - "E0115", # nonlocal-and-global / ruff PLE0115 - "E0116", # continue-in-finally / ruff PLE0116 - "E0117", # nonlocal-without-binding / ruff PLE0117 - "E0118", # used-prior-global-declaration / ruff PLE0118 - "E0211", # no-method-argument / ruff N805 - "E0213", # no-self-argument / ruff N805 - "E0237", # assigning-non-slot / ruff PLE0237 - "E0241", # duplicate-bases / ruff PLE0241 - "E0302", # unexpected-special-method-signature / ruff PLE0302 - "E0303", # invalid-length-returned / ruff PLE0303 - "E0304", # invalid-bool-returned / ruff PLE0304 - "E0305", # invalid-index-returned / ruff PLE0305 - "E0308", # invalid-bytes-returned / ruff PLE0308 - "E0309", # invalid-hash-returned / ruff PLE0309 - "E0402", # relative-beyond-top-level / ruff TID252 - "E0602", # undefined-variable / ruff F821 - "E0603", # undefined-all-variable / ruff F822 - "E0604", # invalid-all-object / ruff PLE0604 - "E0605", # invalid-all-format / ruff PLE0605 - "E0643", # potential-index-error / ruff PLE0643 - "E0704", # misplaced-bare-raise / ruff PLE0704 - "E0711", # notimplemented-raised / ruff F901 - "E1132", # repeated-keyword / ruff PLE1132 - "E1142", # await-outside-async / ruff PLE1142 - "E1205", # logging-too-many-args / ruff PLE1205 - "E1206", # logging-too-few-args / ruff PLE1206 - "E1300", # bad-format-character / ruff PLE1300 - "E1301", # truncated-format-string / ruff F501 - "E1302", # mixed-format-string / ruff F506 - "E1303", # format-needs-mapping / ruff F502 - "E1304", # missing-format-string-key / ruff F524 - "E1305", # too-many-format-args / ruff F522 - "E1306", # too-few-format-args / ruff F524 - "E1307", # bad-string-format-type / ruff PLE1307 - "E1310", # bad-str-strip-call / ruff PLE1310 - "E1519", # singledispatch-method / ruff PLE1519 - "E1520", # singledispatchmethod-function / ruff PLE5120 - "E1700", # yield-inside-async-function / ruff PLE1700 - "E2502", # bidirectional-unicode / ruff PLE2502 - "E2510", # invalid-character-backspace / ruff PLE2510 - "E2512", # invalid-character-sub / ruff PLE2512 - "E2513", # invalid-character-esc / ruff PLE2513 - "E2514", # invalid-character-nul / ruff PLE2514 - "E2515", # invalid-character-zero-width-space / ruff PLE2515 - "E4703", # modified-iterating-set / ruff PLE4703 - "R0123", # literal-comparison / ruff F632 - "R0124", # comparison-with-itself / ruff PLR0124 - "R0133", # comparison-of-constants / ruff PLR0133 - "R0202", # no-classmethod-decorator / ruff PLR0202 - "R0203", # no-staticmethod-decorator / ruff PLR0203 - "R0205", # useless-object-inheritance / ruff UP004 - "R0206", # property-with-parameters / ruff PLR0206 - "R0904", # too-many-public-methods / ruff PLR0904 - "R0911", # too-many-return-statements / ruff PLR0911 - "R0912", # too-many-branches / ruff PLR0912 - "R0913", # too-many-arguments / ruff PLR0913 - "R0914", # too-many-locals / ruff PLR0914 - "R0915", # too-many-statements / ruff PLR0915 - "R0916", # too-many-boolean-expressions / ruff PLR0916 - "R1260", # too-complex / ruff C901 - "R1701", # consider-merging-isinstance / ruff PLR1701 - "R1702", # too-many-nested-blocks / ruff PLR1702 - "R1703", # simplifiable-if-statement / ruff SIM108 - "R1704", # redefined-argument-from-local / ruff PLR1704 - "R1705", # no-else-return / ruff RET505 - "R1706", # consider-using-ternary / ruff PLR1706 - "R1707", # trailing-comma-tuple / ruff COM818 - "R1710", # inconsistent-return-statements / ruff PLR1710 - "R1711", # useless-return / ruff PLR1711 - "R1714", # consider-using-in / ruff PLR1714 - "R1715", # consider-using-get / ruff SIM401 - "R1717", # consider-using-dict-comprehension / ruff C402 - "R1718", # consider-using-set-comprehension / ruff C401 - "R1719", # simplifiable-if-expression / ruff PLR1719 - "R1720", # no-else-raise / ruff RET506 - "R1721", # unnecessary-comprehension / ruff C416 - "R1722", # consider-using-sys-exit / ruff PLR1722 - "R1723", # no-else-break / ruff RET508 - "R1724", # no-else-continue / ruff RET507 - "R1725", # super-with-arguments / ruff UP008 - "R1728", # consider-using-generator / ruff C417 - "R1729", # use-a-generator / ruff C419 - "R1730", # consider-using-min-builtin / ruff PLR1730 - "R1731", # consider-using-max-builtin / ruff PLR1730 - "R1732", # consider-using-with / ruff SIM115 - "R1733", # unnecessary-dict-index-lookup / ruff PLR1733 - "R1734", # use-list-literal / ruff C405 - "R1735", # use-dict-literal / ruff C406 - "R1736", # unnecessary-list-index-lookup / ruff PLR1736 - "R2004", # magic-value-comparison / ruff PLR2004 - "R2044", # empty-comment / ruff PLR2044 - "R5501", # else-if-used / ruff PLR5501 - "R6002", # consider-using-alias / ruff UP006 - "R6003", # consider-alternative-union-syntax / ruff UP007 - "R6104", # consider-using-augmented-assign / ruff PLR6104 - "R6201", # use-set-for-membership / ruff PLR6201 - "R6301", # no-self-use / ruff PLR6301 - "W0102", # dangerous-default-value / ruff B006 - "W0104", # pointless-statement / ruff B018 - "W0106", # expression-not-assigned / ruff B018 - "W0107", # unnecessary-pass / ruff PIE790 - "W0108", # unnecessary-lambda / ruff PLW0108 - "W0109", # duplicate-key / ruff F601 - "W0120", # useless-else-on-loop / ruff PLW0120 - "W0122", # exec-used / ruff S102 - "W0123", # eval-used / ruff PGH001 - "W0127", # self-assigning-variable / ruff PLW0127 - "W0129", # assert-on-string-literal / ruff PLW0129 - "W0130", # duplicate-value / ruff B033 - "W0131", # named-expr-without-context / ruff PLW0131 - "W0133", # pointless-exception-statement / ruff PLW0133 - "W0150", # lost-exception / ruff B012 - "W0160", # consider-ternary-expression / ruff SIM108 - "W0177", # nan-comparison / ruff PLW0117 - "W0199", # assert-on-tuple / ruff F631 - "W0211", # bad-staticmethod-argument / ruff PLW0211 - "W0212", # protected-access / ruff SLF001 - "W0245", # super-without-brackets / ruff PLW0245 - "W0301", # unnecessary-semicolon / ruff E703 - "W0401", # wildcard-import / ruff F403 - "W0404", # reimported / ruff F811 - "W0406", # import-self / ruff PLW0406 - "W0410", # misplaced-future / ruff F404 - "W0511", # fixme / ruff PLW0511 - "W0602", # global-variable-not-assigned / ruff PLW0602 - "W0603", # global-statement / ruff PLW0603 - "W0604", # global-at-module-level / ruff PLW0604 - "W0611", # unused-import / ruff F401 - "W0612", # unused-variable / ruff F841 - "W0613", # unused-argument / ruff ARG001 - "W0622", # redefined-builtin / ruff A001 - "W0640", # cell-var-from-loop / ruff B023 - "W0702", # bare-except / ruff E722 - "W0705", # duplicate-except / ruff B014 - "W0706", # try-except-raise / ruff TRY302 - "W0707", # raise-missing-from / ruff TRY200 - "W0711", # binary-op-exception / ruff PLW0711 - "W0718", # broad-exception-caught / ruff PLW0718 - "W0719", # broad-exception-raised / ruff TRY002 - "W1113", # keyword-arg-before-vararg / ruff B026 - "W1201", # logging-not-lazy / ruff G - "W1202", # logging-format-interpolation / ruff G - "W1203", # logging-fstring-interpolation / ruff G - "W1300", # bad-format-string-key / ruff PLW1300 - "W1301", # unused-format-string-key / ruff F504 - "W1302", # bad-format-string / ruff PLW1302 - "W1303", # missing-format-argument-key / ruff F524 - "W1304", # unused-format-string-argument / ruff F507 - "W1305", # format-combined-specification / ruff F525 - "W1308", # duplicate-string-formatting-argument / ruff PLW1308 - "W1309", # f-string-without-interpolation / ruff F541 - "W1310", # format-string-without-interpolation / ruff F541 - "W1401", # anomalous-backslash-in-string / ruff W605 - "W1404", # implicit-str-concat / ruff ISC001 - "W1405", # inconsistent-quotes / ruff Q000 - "W1406", # redundant-u-string-prefix / ruff UP025 - "W1501", # bad-open-mode / ruff PLW1501 - "W1508", # invalid-envvar-default / ruff PLW1508 - "W1509", # subprocess-popen-preexec-fn / ruff PLW1509 - "W1510", # subprocess-run-check / ruff PLW1510 - "W1514", # unspecified-encoding / ruff PLW1514 - "W1515", # forgotten-debug-statement / ruff T100 - "W1518", # method-cache-max-size-none / ruff B019 - "W1641", # eq-without-hash / ruff PLW1641 - "W2101", # useless-with-lock / ruff PLW2101 - "W2402", # non-ascii-file-name / ruff N999 - "W2901", # redefined-loop-name / ruff PLW2901 - "W3201", # bad-dunder-name / ruff PLW3201 - "W3301", # nested-min-max / ruff PLW3301 + "C0103", # invalid-name / ruff N815 + "C0105", # typevar-name-incorrect-variance / ruff PLC0105 + "C0112", # empty-docstring / ruff D419 + "C0113", # unneeded-not / ruff SIM208 + "C0114", # missing-module-docstring / ruff D100 + "C0115", # missing-class-docstring / ruff D101 + "C0116", # missing-function-docstring / ruff D103 + "C0121", # singleton-comparison / ruff PLC0121 + "C0123", # unidiomatic-typecheck / ruff E721 + "C0131", # typevar-double-variance / ruff PLC0131 + "C0132", # typevar-name-mismatch / ruff PLC0132 + "C0198", # bad-docstring-quotes / ruff Q002 + "C0199", # docstring-first-line-empty / ruff D210 + "C0201", # consider-iterating-dictionary / ruff SIM118 + "C0202", # bad-classmethod-argument / ruff PLC0202 + "C0205", # single-string-used-for-slots / ruff PLC0205 + "C0208", # use-sequence-for-iteration / ruff PLC0208 + "C0301", # line-too-long / ruff E501 + "C0303", # trailing-whitespace / ruff W291 + "C0304", # missing-final-newline / ruff W292 + "C0321", # multiple-statements / ruff PLC0321 + "C0410", # multiple-imports / ruff E401 + "C0411", # wrong-import-order / ruff I001 + "C0412", # ungrouped-imports / ruff I001 + "C0413", # wrong-import-position / ruff E402 + "C0414", # useless-import-alias / ruff PLC0414 + "C0415", # import-outside-toplevel / ruff PLC0415 + "C0501", # consider-using-any-or-all / ruff PLC0501 + "C1901", # compare-to-empty-string / ruff PLC1901 + "C2201", # misplaced-comparison-constant / ruff SIM300 + "C2401", # non-ascii-name / ruff PLC2401 + "C2403", # non-ascii-module-import / ruff PLC2403 + "C2701", # import-private-name / ruff PLC2701 + "C2801", # unnecessary-dunder-call / ruff PLC2801 + "C3001", # unnecessary-lambda-assignment / ruff E731 + "C3002", # unnecessary-direct-lambda-call / ruff PLC3002 + "E0001", # syntax-error / ruff E999 + "E0100", # init-is-generator / ruff PLE0100 + "E0101", # return-in-init / ruff PLE0101 + "E0102", # function-redefined / ruff F811 + "E0103", # not-in-loop / ruff PLE0103 + "E0104", # return-outside-function / ruff F706 + "E0105", # yield-outside-function / ruff F704 + "E0107", # nonexistent-operator / ruff B002 + "E0112", # too-many-star-expressions / ruff F622 + "E0115", # nonlocal-and-global / ruff PLE0115 + "E0116", # continue-in-finally / ruff PLE0116 + "E0117", # nonlocal-without-binding / ruff PLE0117 + "E0118", # used-prior-global-declaration / ruff PLE0118 + "E0211", # no-method-argument / ruff N805 + "E0213", # no-self-argument / ruff N805 + "E0237", # assigning-non-slot / ruff PLE0237 + "E0241", # duplicate-bases / ruff PLE0241 + "E0302", # unexpected-special-method-signature / ruff PLE0302 + "E0303", # invalid-length-returned / ruff PLE0303 + "E0304", # invalid-bool-returned / ruff PLE0304 + "E0305", # invalid-index-returned / ruff PLE0305 + "E0308", # invalid-bytes-returned / ruff PLE0308 + "E0309", # invalid-hash-returned / ruff PLE0309 + "E0402", # relative-beyond-top-level / ruff TID252 + "E0602", # undefined-variable / ruff F821 + "E0603", # undefined-all-variable / ruff F822 + "E0604", # invalid-all-object / ruff PLE0604 + "E0605", # invalid-all-format / ruff PLE0605 + "E0643", # potential-index-error / ruff PLE0643 + "E0704", # misplaced-bare-raise / ruff PLE0704 + "E0711", # notimplemented-raised / ruff F901 + "E1132", # repeated-keyword / ruff PLE1132 + "E1142", # await-outside-async / ruff PLE1142 + "E1205", # logging-too-many-args / ruff PLE1205 + "E1206", # logging-too-few-args / ruff PLE1206 + "E1300", # bad-format-character / ruff PLE1300 + "E1301", # truncated-format-string / ruff F501 + "E1302", # mixed-format-string / ruff F506 + "E1303", # format-needs-mapping / ruff F502 + "E1304", # missing-format-string-key / ruff F524 + "E1305", # too-many-format-args / ruff F522 + "E1306", # too-few-format-args / ruff F524 + "E1307", # bad-string-format-type / ruff PLE1307 + "E1310", # bad-str-strip-call / ruff PLE1310 + "E1519", # singledispatch-method / ruff PLE1519 + "E1520", # singledispatchmethod-function / ruff PLE5120 + "E1700", # yield-inside-async-function / ruff PLE1700 + "E2502", # bidirectional-unicode / ruff PLE2502 + "E2510", # invalid-character-backspace / ruff PLE2510 + "E2512", # invalid-character-sub / ruff PLE2512 + "E2513", # invalid-character-esc / ruff PLE2513 + "E2514", # invalid-character-nul / ruff PLE2514 + "E2515", # invalid-character-zero-width-space / ruff PLE2515 + "E4703", # modified-iterating-set / ruff PLE4703 + "R0123", # literal-comparison / ruff F632 + "R0124", # comparison-with-itself / ruff PLR0124 + "R0133", # comparison-of-constants / ruff PLR0133 + "R0202", # no-classmethod-decorator / ruff PLR0202 + "R0203", # no-staticmethod-decorator / ruff PLR0203 + "R0205", # useless-object-inheritance / ruff UP004 + "R0206", # property-with-parameters / ruff PLR0206 + "R0904", # too-many-public-methods / ruff PLR0904 + "R0911", # too-many-return-statements / ruff PLR0911 + "R0912", # too-many-branches / ruff PLR0912 + "R0913", # too-many-arguments / ruff PLR0913 + "R0914", # too-many-locals / ruff PLR0914 + "R0915", # too-many-statements / ruff PLR0915 + "R0916", # too-many-boolean-expressions / ruff PLR0916 + "R1260", # too-complex / ruff C901 + "R1701", # consider-merging-isinstance / ruff PLR1701 + "R1702", # too-many-nested-blocks / ruff PLR1702 + "R1703", # simplifiable-if-statement / ruff SIM108 + "R1704", # redefined-argument-from-local / ruff PLR1704 + "R1705", # no-else-return / ruff RET505 + "R1706", # consider-using-ternary / ruff PLR1706 + "R1707", # trailing-comma-tuple / ruff COM818 + "R1710", # inconsistent-return-statements / ruff PLR1710 + "R1711", # useless-return / ruff PLR1711 + "R1714", # consider-using-in / ruff PLR1714 + "R1715", # consider-using-get / ruff SIM401 + "R1717", # consider-using-dict-comprehension / ruff C402 + "R1718", # consider-using-set-comprehension / ruff C401 + "R1719", # simplifiable-if-expression / ruff PLR1719 + "R1720", # no-else-raise / ruff RET506 + "R1721", # unnecessary-comprehension / ruff C416 + "R1722", # consider-using-sys-exit / ruff PLR1722 + "R1723", # no-else-break / ruff RET508 + "R1724", # no-else-continue / ruff RET507 + "R1725", # super-with-arguments / ruff UP008 + "R1728", # consider-using-generator / ruff C417 + "R1729", # use-a-generator / ruff C419 + "R1730", # consider-using-min-builtin / ruff PLR1730 + "R1731", # consider-using-max-builtin / ruff PLR1730 + "R1732", # consider-using-with / ruff SIM115 + "R1733", # unnecessary-dict-index-lookup / ruff PLR1733 + "R1734", # use-list-literal / ruff C405 + "R1735", # use-dict-literal / ruff C406 + "R1736", # unnecessary-list-index-lookup / ruff PLR1736 + "R2004", # magic-value-comparison / ruff PLR2004 + "R2044", # empty-comment / ruff PLR2044 + "R5501", # else-if-used / ruff PLR5501 + "R6002", # consider-using-alias / ruff UP006 + "R6003", # consider-alternative-union-syntax / ruff UP007 + "R6104", # consider-using-augmented-assign / ruff PLR6104 + "R6201", # use-set-for-membership / ruff PLR6201 + "R6301", # no-self-use / ruff PLR6301 + "W0102", # dangerous-default-value / ruff B006 + "W0104", # pointless-statement / ruff B018 + "W0106", # expression-not-assigned / ruff B018 + "W0107", # unnecessary-pass / ruff PIE790 + "W0108", # unnecessary-lambda / ruff PLW0108 + "W0109", # duplicate-key / ruff F601 + "W0120", # useless-else-on-loop / ruff PLW0120 + "W0122", # exec-used / ruff S102 + "W0123", # eval-used / ruff PGH001 + "W0127", # self-assigning-variable / ruff PLW0127 + "W0129", # assert-on-string-literal / ruff PLW0129 + "W0130", # duplicate-value / ruff B033 + "W0131", # named-expr-without-context / ruff PLW0131 + "W0133", # pointless-exception-statement / ruff PLW0133 + "W0150", # lost-exception / ruff B012 + "W0160", # consider-ternary-expression / ruff SIM108 + "W0177", # nan-comparison / ruff PLW0117 + "W0199", # assert-on-tuple / ruff F631 + "W0211", # bad-staticmethod-argument / ruff PLW0211 + "W0212", # protected-access / ruff SLF001 + "W0245", # super-without-brackets / ruff PLW0245 + "W0301", # unnecessary-semicolon / ruff E703 + "W0401", # wildcard-import / ruff F403 + "W0404", # reimported / ruff F811 + "W0406", # import-self / ruff PLW0406 + "W0410", # misplaced-future / ruff F404 + "W0511", # fixme / ruff PLW0511 + "W0602", # global-variable-not-assigned / ruff PLW0602 + "W0603", # global-statement / ruff PLW0603 + "W0604", # global-at-module-level / ruff PLW0604 + "W0611", # unused-import / ruff F401 + "W0612", # unused-variable / ruff F841 + "W0613", # unused-argument / ruff ARG001 + "W0622", # redefined-builtin / ruff A001 + "W0640", # cell-var-from-loop / ruff B023 + "W0702", # bare-except / ruff E722 + "W0705", # duplicate-except / ruff B014 + "W0706", # try-except-raise / ruff TRY302 + "W0707", # raise-missing-from / ruff TRY200 + "W0711", # binary-op-exception / ruff PLW0711 + "W0718", # broad-exception-caught / ruff PLW0718 + "W0719", # broad-exception-raised / ruff TRY002 + "W1113", # keyword-arg-before-vararg / ruff B026 + "W1201", # logging-not-lazy / ruff G + "W1202", # logging-format-interpolation / ruff G + "W1203", # logging-fstring-interpolation / ruff G + "W1300", # bad-format-string-key / ruff PLW1300 + "W1301", # unused-format-string-key / ruff F504 + "W1302", # bad-format-string / ruff PLW1302 + "W1303", # missing-format-argument-key / ruff F524 + "W1304", # unused-format-string-argument / ruff F507 + "W1305", # format-combined-specification / ruff F525 + "W1308", # duplicate-string-formatting-argument / ruff PLW1308 + "W1309", # f-string-without-interpolation / ruff F541 + "W1310", # format-string-without-interpolation / ruff F541 + "W1401", # anomalous-backslash-in-string / ruff W605 + "W1404", # implicit-str-concat / ruff ISC001 + "W1405", # inconsistent-quotes / ruff Q000 + "W1406", # redundant-u-string-prefix / ruff UP025 + "W1501", # bad-open-mode / ruff PLW1501 + "W1508", # invalid-envvar-default / ruff PLW1508 + "W1509", # subprocess-popen-preexec-fn / ruff PLW1509 + "W1510", # subprocess-run-check / ruff PLW1510 + "W1514", # unspecified-encoding / ruff PLW1514 + "W1515", # forgotten-debug-statement / ruff T100 + "W1518", # method-cache-max-size-none / ruff B019 + "W1641", # eq-without-hash / ruff PLW1641 + "W2101", # useless-with-lock / ruff PLW2101 + "W2402", # non-ascii-file-name / ruff N999 + "W2901", # redefined-loop-name / ruff PLW2901 + "W3201", # bad-dunder-name / ruff PLW3201 + "W3301", # nested-min-max / ruff PLW3301 "duplicate-code", "fixme", "too-few-public-methods", - "unsubscriptable-object", + "unsubscriptable-object" ] [tool.ruff] @@ -331,10 +331,10 @@ lines-between-types = 1 # Separate import/from with 1 line convention = "pep257" [tool.setuptools.dynamic] -dependencies = { file = [".config/requirements.in"] } -optional-dependencies.dev = { file = [".config/requirements-dev.in"] } -optional-dependencies.docs = { file = [".config/requirements-docs.in"] } -optional-dependencies.test = { file = [".config/requirements-test.in"] } +dependencies = {file = [".config/requirements.in"]} +optional-dependencies.dev = {file = [".config/requirements-dev.in"]} +optional-dependencies.docs = {file = [".config/requirements-docs.in"]} +optional-dependencies.test = {file = [".config/requirements-test.in"]} [tool.setuptools_scm] # To prevent accidental pick of mobile version tags such 'v6' @@ -345,7 +345,7 @@ git_describe_command = [ "--long", "--tags", "--match", - "v*.*", + "v*.*" ] local_scheme = "no-local-version" tag_regex = '^(?Pv)?(?P[^\+]+)(?P.*)?$' From 0847c2bca487634ffbc58911404e3c9538f5be8b Mon Sep 17 00:00:00 2001 From: "Bradley A. Thornton" Date: Mon, 29 Apr 2024 15:37:41 -0700 Subject: [PATCH 4/4] Sort test file list --- tests/unit/test_installer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/test_installer.py b/tests/unit/test_installer.py index 945990c..c4cdbd4 100644 --- a/tests/unit/test_installer.py +++ b/tests/unit/test_installer.py @@ -154,4 +154,4 @@ def test_copy_using_ls(tmp_path: Path, output: Output) -> None: (source / "file2.txt").touch() installer._copy_repo_files(local_repo_path=source, destination_path=dest) moved = dest.glob("**/*") - assert [m.name for m in list(moved)] == ["file1.txt", "file2.txt"] + assert sorted([m.name for m in list(moved)]) == ["file1.txt", "file2.txt"]