diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 01defe887bd27e428f3adda81e19aee63d033f12..c2e3409fa1874092a417fb1c757bc22eebefde2f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -46,33 +46,24 @@ repos: - | --line-length=79 - - repo: https://github.com/PyCQA/prospector - rev: v1.12.1 + - repo: https://github.com/pylint-dev/pylint.git + rev: v3.3.3 hooks: - - id: prospector + - id: pylint + exclude: *excluded_pythonscripts + args: ["--disable", "line-too-long,broad-exception-raised"] + + - repo: https://github.com/DanielNoord/pydocstringformatter.git + rev: v0.7.3 + hooks: + - id: pydocstringformatter + exclude: *excluded_pythonscripts + + - repo: https://github.com/PyCQA/bandit.git + rev: "1.8.0" + hooks: + - id: bandit exclude: *excluded_pythonscripts - args: - - |- - --max-line-length=79 - - |- - --with-tool=pyroma - - |- - --with-tool=bandit - - |- - --without-tool=pep257 - - |- - --doc-warnings - - |- - --test-warnings - - |- - --full-pep8 - - |- - --strictness=high - - |- - --no-autodetect - additional_dependencies: - - bandit - - pyroma - repo: https://github.com/pycqa/flake8.git rev: 7.1.1 @@ -92,7 +83,7 @@ repos: exclude: rabbitmqadmin|\.config/git/config|Pipfile\.lock|npmrc - repo: https://git.shore.co.il/nimrod/pre-commit-hooks.git - rev: v0.5.1 + rev: v0.5.2 hooks: - id: shell-validate exclude: &excluded_shellscripts |- @@ -111,18 +102,10 @@ repos: types: [text] - repo: https://github.com/executablebooks/mdformat.git - rev: 0.7.17 + rev: 0.7.21 hooks: - id: mdformat - - repo: https://gitlab.com/devopshq/gitlab-ci-linter - rev: v1.0.6 - hooks: - - id: gitlab-ci-linter - args: - - "--server" - - https://git.shore.co.il - - repo: https://github.com/codespell-project/codespell.git rev: v2.3.0 hooks: diff --git a/Documents/Shore/taxes/Makefile b/Documents/Shore/taxes/Makefile index a273fcf16173463640a8bf4eb058800c9ea9fc3e..93a6abc7d6300ace109a4297cf1b1702743f5257 100644 --- a/Documents/Shore/taxes/Makefile +++ b/Documents/Shore/taxes/Makefile @@ -1,6 +1,6 @@ last_month != date +%Y-%m --date 'last month' last_zip != find -maxdepth 1 -name '*.zip' \! -name '${last_month}.zip' -printf '%f\n' | sort -r | head -1 -new_files != find reciepts/ -type f -newer ${last_zip} +new_files != find receipts/ -type f -newer ${last_zip} .PHONY: send send: ${last_month}.zip diff --git a/Documents/bin/download-password-db b/Documents/bin/download-password-db index c1003accbf4b56d9065fe6195252a45ee8277d66..6b2badf74da7621aea3277c9215aa59b8d13d567 100755 --- a/Documents/bin/download-password-db +++ b/Documents/bin/download-password-db @@ -14,7 +14,7 @@ import os.path import subprocess # nosec DB_PATH = "Documents/Database.kdbx" -DEST = os.path.expanduser(f"~/{ os.path.dirname(DB_PATH) }") +DEST = os.path.expanduser(f"~/{os.path.dirname(DB_PATH)}") SOURCE = f"nextcloud:{DB_PATH}" diff --git a/Documents/bin/git-manage b/Documents/bin/git-manage index 8f8ee5db9018725db655c44f3f789135b1e1acd3..325fed8d21b0f26064ee0ff82b9c565d2be2e348 100755 --- a/Documents/bin/git-manage +++ b/Documents/bin/git-manage @@ -24,7 +24,7 @@ GH_MIRROR_PREFIX = "https://*****@github.com/" def error(message): """Print an error message with the current subparser's usage and exit.""" - # pylint: disable=protected-access + # pylint: disable=protected-access,possibly-used-before-assignment sub_parser = arg_parser._subparsers._actions[1].choices[_args.command] sub_parser.error(message) @@ -62,7 +62,7 @@ def mirror_project(project, gh_conn, token): except github3.exceptions.NotFoundError: gh_repo = gh_conn.create_repository(project.name) print( - f"Created a new GitHub reposiroty {gh_repo.html_url}.", + f"Created a new GitHub repository {gh_repo.html_url}.", file=sys.stderr, ) @@ -96,7 +96,7 @@ def get_mirror_token(): Reads it from a Keepass password database using Passhole. """ ENTRY_PATH = "Web Sites/GitHub".split("/") # noqa - TOKEN_FIELD = "GitLab mirroring token" # noqa nosec + TOKEN_FIELD = "GitLab mirroring token" # nosec # noqa # The following line requires an interactive session for getting the # password. @@ -152,9 +152,9 @@ def guess_name(args, gh_conn=None, gl_conn=None): error("Name not provided and not in a Git repo.") remote = guess_remote( - remote_type="github" - if "github" in args and args.github - else "gitlab", + remote_type=( + "github" if "github" in args and args.github else "gitlab" + ), gl_conn=gl_conn, ) if remote is None: @@ -162,11 +162,10 @@ def guess_name(args, gh_conn=None, gl_conn=None): error("Name not provided and could not find a GitHub remote.") else: error("Name not provided and could not find a GitLab remote.") + if "github" in args and args.github: + name = rcfiles.github.url_to_name(remote["url"]) else: - if "github" in args and args.github: - name = rcfiles.github.url_to_name(remote["url"]) - else: - name = rcfiles.gitlab.url_to_name(gl_conn, remote["url"]) + name = rcfiles.gitlab.url_to_name(gl_conn, remote["url"]) print( f"""Name not provided, using {name} from the {remote["name"]} remote.""", # noqa: E501 file=sys.stderr, diff --git a/Documents/bin/monitor b/Documents/bin/monitor index 0d6944cceee2aa5aed713f16d163205ccd7a49c5..0e79d79442cff79f3b3d1ae2aa89775415a42d6d 100755 --- a/Documents/bin/monitor +++ b/Documents/bin/monitor @@ -8,7 +8,7 @@ else notify='notify' fi -eval "$@" || code="$?" +eval "$*" || code="$?" code="${code:-0}" if [ "$code" -eq 0 ] diff --git a/Documents/bin/planet b/Documents/bin/planet index b6b3ae46ed0ead4f94cdb0e1be5f4a1d4db05401..2a1816f6d1447f6f259c55936e518f32257de798 100755 --- a/Documents/bin/planet +++ b/Documents/bin/planet @@ -7,7 +7,7 @@ import sys import webbrowser import xdg.BaseDirectory # pylint: disable=import-error -import yaml +import yaml # pylint: disable=import-error EXAMPLE_CONFIG = """--- general: @@ -46,6 +46,7 @@ def get_config(path=None): if path: path = path.expanduser() if not path.exists() and not path.is_file(): + # pylint: disable=possibly-used-before-assignment arg_parser.error("Configuration file does not exist.") else: