From 9862881a8bb4f5d8dd7ce567deacf8ac2ea78b40 Mon Sep 17 00:00:00 2001 From: Jirka Date: Mon, 29 Apr 2024 01:21:47 +0200 Subject: [PATCH] ci/lint: switch mega-linter with pre-commit & Ruff --- .bandit.yml | 302 ----------- .cspell.json | 241 --------- .flake8 | 3 - .github/ISSUE_TEMPLATE/bug_report.md | 4 +- .github/ISSUE_TEMPLATE/question.md | 4 +- .github/linters/.checkov.yml | 6 - .../{github-dependents-info.yml => demo.yml} | 0 .lycheeignore | 2 +- .mega-linter.yml | 23 - .pre-commit-config.yaml | 43 +- .pylintrc | 471 ------------------ .ruff.toml | 1 - CODE_OF_CONDUCT.md | 30 +- CONTRIBUTING.md | 1 - Makefile | 10 +- README.md | 47 +- assets/angular-package-usage.md | 2 +- assets/markdown-demo-2.md | 2 +- assets/markdown-demo.md | 2 +- docs/github-dependents-info.md | 2 +- github_dependents_info/__init__.py | 3 +- github_dependents_info/__main__.py | 3 +- poetry.lock | 262 +--------- pyproject.toml | 73 ++- 24 files changed, 117 insertions(+), 1420 deletions(-) delete mode 100644 .bandit.yml delete mode 100644 .cspell.json delete mode 100644 .flake8 delete mode 100644 .github/linters/.checkov.yml rename .github/workflows/{github-dependents-info.yml => demo.yml} (100%) delete mode 100644 .mega-linter.yml delete mode 100644 .pylintrc delete mode 100644 .ruff.toml diff --git a/.bandit.yml b/.bandit.yml deleted file mode 100644 index d71eb34..0000000 --- a/.bandit.yml +++ /dev/null @@ -1,302 +0,0 @@ -any_other_function_with_shell_equals_true: - no_shell: - - os.execl - - os.execle - - os.execlp - - os.execlpe - - os.execv - - os.execve - - os.execvp - - os.execvpe - - os.spawnl - - os.spawnle - - os.spawnlp - - os.spawnlpe - - os.spawnv - - os.spawnve - - os.spawnvp - - os.spawnvpe - - os.startfile - shell: - - os.system - - os.popen - - os.popen2 - - os.popen3 - - os.popen4 - - popen2.popen2 - - popen2.popen3 - - popen2.popen4 - - popen2.Popen3 - - popen2.Popen4 - - commands.getoutput - - commands.getstatusoutput - subprocess: - - subprocess.Popen - - subprocess.call - - subprocess.check_call - - subprocess.check_output - - subprocess.run -assert_used: - skips: ["*/test_*.py"] -hardcoded_tmp_directory: - tmp_dirs: - - /tmp - - /var/tmp - - /dev/shm -linux_commands_wildcard_injection: - no_shell: - - os.execl - - os.execle - - os.execlp - - os.execlpe - - os.execv - - os.execve - - os.execvp - - os.execvpe - - os.spawnl - - os.spawnle - - os.spawnlp - - os.spawnlpe - - os.spawnv - - os.spawnve - - os.spawnvp - - os.spawnvpe - - os.startfile - shell: - - os.system - - os.popen - - os.popen2 - - os.popen3 - - os.popen4 - - popen2.popen2 - - popen2.popen3 - - popen2.popen4 - - popen2.Popen3 - - popen2.Popen4 - - commands.getoutput - - commands.getstatusoutput - subprocess: - - subprocess.Popen - - subprocess.call - - subprocess.check_call - - subprocess.check_output - - subprocess.run -ssl_with_bad_defaults: - bad_protocol_versions: - - PROTOCOL_SSLv2 - - SSLv2_METHOD - - SSLv23_METHOD - - PROTOCOL_SSLv3 - - PROTOCOL_TLSv1 - - SSLv3_METHOD - - TLSv1_METHOD -ssl_with_bad_version: - bad_protocol_versions: - - PROTOCOL_SSLv2 - - SSLv2_METHOD - - SSLv23_METHOD - - PROTOCOL_SSLv3 - - PROTOCOL_TLSv1 - - SSLv3_METHOD - - TLSv1_METHOD -start_process_with_a_shell: - no_shell: - - os.execl - - os.execle - - os.execlp - - os.execlpe - - os.execv - - os.execve - - os.execvp - - os.execvpe - - os.spawnl - - os.spawnle - - os.spawnlp - - os.spawnlpe - - os.spawnv - - os.spawnve - - os.spawnvp - - os.spawnvpe - - os.startfile - shell: - - os.system - - os.popen - - os.popen2 - - os.popen3 - - os.popen4 - - popen2.popen2 - - popen2.popen3 - - popen2.popen4 - - popen2.Popen3 - - popen2.Popen4 - - commands.getoutput - - commands.getstatusoutput - subprocess: - - subprocess.Popen - - subprocess.call - - subprocess.check_call - - subprocess.check_output - - subprocess.run -start_process_with_no_shell: - no_shell: - - os.execl - - os.execle - - os.execlp - - os.execlpe - - os.execv - - os.execve - - os.execvp - - os.execvpe - - os.spawnl - - os.spawnle - - os.spawnlp - - os.spawnlpe - - os.spawnv - - os.spawnve - - os.spawnvp - - os.spawnvpe - - os.startfile - shell: - - os.system - - os.popen - - os.popen2 - - os.popen3 - - os.popen4 - - popen2.popen2 - - popen2.popen3 - - popen2.popen4 - - popen2.Popen3 - - popen2.Popen4 - - commands.getoutput - - commands.getstatusoutput - subprocess: - - subprocess.Popen - - subprocess.call - - subprocess.check_call - - subprocess.check_output - - subprocess.run -start_process_with_partial_path: - no_shell: - - os.execl - - os.execle - - os.execlp - - os.execlpe - - os.execv - - os.execve - - os.execvp - - os.execvpe - - os.spawnl - - os.spawnle - - os.spawnlp - - os.spawnlpe - - os.spawnv - - os.spawnve - - os.spawnvp - - os.spawnvpe - - os.startfile - shell: - - os.system - - os.popen - - os.popen2 - - os.popen3 - - os.popen4 - - popen2.popen2 - - popen2.popen3 - - popen2.popen4 - - popen2.Popen3 - - popen2.Popen4 - - commands.getoutput - - commands.getstatusoutput - subprocess: - - subprocess.Popen - - subprocess.call - - subprocess.check_call - - subprocess.check_output - - subprocess.run -subprocess_popen_with_shell_equals_true: - no_shell: - - os.execl - - os.execle - - os.execlp - - os.execlpe - - os.execv - - os.execve - - os.execvp - - os.execvpe - - os.spawnl - - os.spawnle - - os.spawnlp - - os.spawnlpe - - os.spawnv - - os.spawnve - - os.spawnvp - - os.spawnvpe - - os.startfile - shell: - - os.system - - os.popen - - os.popen2 - - os.popen3 - - os.popen4 - - popen2.popen2 - - popen2.popen3 - - popen2.popen4 - - popen2.Popen3 - - popen2.Popen4 - - commands.getoutput - - commands.getstatusoutput - subprocess: - - subprocess.Popen - - subprocess.call - - subprocess.check_call - - subprocess.check_output - - subprocess.run -subprocess_without_shell_equals_true: - no_shell: - - os.execl - - os.execle - - os.execlp - - os.execlpe - - os.execv - - os.execve - - os.execvp - - os.execvpe - - os.spawnl - - os.spawnle - - os.spawnlp - - os.spawnlpe - - os.spawnv - - os.spawnve - - os.spawnvp - - os.spawnvpe - - os.startfile - shell: - - os.system - - os.popen - - os.popen2 - - os.popen3 - - os.popen4 - - popen2.popen2 - - popen2.popen3 - - popen2.popen4 - - popen2.Popen3 - - popen2.Popen4 - - commands.getoutput - - commands.getstatusoutput - subprocess: - - subprocess.Popen - - subprocess.call - - subprocess.check_call - - subprocess.check_output - - subprocess.run -try_except_continue: - check_typed_exception: false -try_except_pass: - check_typed_exception: false -weak_cryptographic_key: - weak_key_size_dsa_high: 1024 - weak_key_size_dsa_medium: 2048 - weak_key_size_ec_high: 160 - weak_key_size_ec_medium: 224 - weak_key_size_rsa_high: 1024 - weak_key_size_rsa_medium: 2048 diff --git a/.cspell.json b/.cspell.json deleted file mode 100644 index 29e4403..0000000 --- a/.cspell.json +++ /dev/null @@ -1,241 +0,0 @@ -{ - "ignorePaths": [ - "**/node_modules/**", - "**/vscode-extension/**", - "**/.git/**", - "**/.pnpm-lock.json", - ".vscode", - "megalinter", - "package-lock.json", - "report", - "**/docs/**" - ], - "language": "en", - "noConfigSearch": true, - "version": "0.2", - "words": [ - "Adel", - "Analyse", - "Buildx", - "CHECKMAKE", - "Codestyle", - "Cookiecutter", - "FIRSTPARTY", - "Fractors", - "GRYPE", - "Ganji", - "HADOLINT", - "Installshield", - "Intelli", - "Jobsity", - "LOCALFOLDER", - "Loguru", - "MARKDOWNLINT", - "Moaz", - "Nsight", - "PTVS", - "PYRIGHT", - "PYTHONPATH", - "Paket", - "Pipfile", - "Pydantic", - "Pypi", - "Qube", - "Recuenco", - "STDLIB", - "Scrapy", - "Silverlight", - "Sonarlint", - "Spyder", - "TERMIOS", - "THIRDPARTY", - "TRIVY", - "TYPECHECK", - "Telerik's", - "Typer", - "Verdana", - "Vuillamy", - "abatilo", - "aboe", - "abstractproperty", - "ackages", - "ackup", - "addopts", - "analyse", - "analysed", - "apdisk", - "appxbundle", - "appxupload", - "arobase", - "asdict", - "backoff", - "badgemarkdownfile", - "beautifulsoup", - "bibtex", - "binlog", - "buildhelp", - "buildx", - "builtins", - "cachefile", - "celerybeat", - "checkin", - "classmethod", - "codegen", - "codestyle", - "colorama", - "colour", - "commonmark", - "contextlib", - "contextmanager", - "coulb", - "coveragexml", - "csdef", - "csvdirectory", - "darglint", - "dbmdl", - "dbnavigator", - "dbproj", - "dlldata", - "dmypy", - "docstates", - "docstrings", - "doctest", - "docurl", - "donotpresent", - "dont", - "dotfiles", - "dsstore", - "ebug", - "edenlightning", - "ehthumbs", - "elease", - "eleases", - "encryptable", - "esktop", - "esult", - "finlaymacklon", - "forcelist", - "fseventsd", - "gitmoji", - "healthcheck", - "healthchecksdb", - "hovercard", - "hovercards", - "howpublished", - "htmlcov", - "icns", - "inlinevar", - "iobj", - "ipch", - "ipdb", - "ipynb", - "ipynbcheckpoints", - "isort", - "jmconfig", - "katalon", - "localhistory", - "lycheeignore", - "markdownbadgecolor", - "markdownfile", - "mashafrancis", - "mdurl", - "megalinter", - "mergepackages", - "metaclass", - "mfractor", - "minstars", - "mkdocs", - "mpeltonen", - "msix", - "msvs", - "muvaf", - "mymodule", - "mypackage", - "mypy", - "mypycache", - "norecursedirs", - "nosetests", - "nostale", - "ntvs", - "numpy", - "nunit", - "nupkg", - "nvuillam", - "nvuser", - "octicon", - "opendb", - "opensdf", - "optionflags", - "optparse", - "orjson", - "outputrepo", - "overgeneral", - "oxsecurity", - "paket", - "paren", - "parseable", - "pidb", - "pipenv", - "prereleases", - "psess", - "publishproj", - "publishsettings", - "pycache", - "pydevproject", - "pydocstyle", - "pyenv", - "pygments", - "pygtk", - "pylint", - "pylintrc", - "pypa", - "pyproject", - "pytest", - "pytestcache", - "pyupgrade", - "rcfile", - "regexes", - "regsub", - "replstate", - "rexec", - "ropeproject", - "rptproj", - "rsuser", - "sarif", - "schemaview", - "scrapy", - "sdist", - "shellingham", - "slickpic", - "snupkg", - "sonarlint", - "soupsieve", - "spyderproject", - "spyproject", - "stackdump", - "stackexchange", - "stefanzweifel", - "svclog", - "tada", - "timemachine", - "tqdm", - "traceback", - "trivyignore", - "typer", - "ublish", - "uild", - "userosscache", - "userprefs", - "venv", - "virtualenv", - "virtualenvs", - "vspscc", - "vspx", - "vssscc", - "wesh", - "wontfix", - "wpftmp", - "wwwroot", - "xpress" - ] -} diff --git a/.flake8 b/.flake8 deleted file mode 100644 index 51d5a5c..0000000 --- a/.flake8 +++ /dev/null @@ -1,3 +0,0 @@ -[flake8] -max-line-length = 120 -extend-ignore = E203 \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index bdd7677..4df7c50 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -22,8 +22,8 @@ Steps to reproduce the behavior: ### Environment -* OS: [e.g. Linux / Windows / macOS] -* Python version, get it with: +- OS: \[e.g. Linux / Windows / macOS\] +- Python version, get it with: ```bash python --version diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md index d2d3c72..b52e8e8 100644 --- a/.github/ISSUE_TEMPLATE/question.md +++ b/.github/ISSUE_TEMPLATE/question.md @@ -16,9 +16,9 @@ assignees: -How can I [...]? +How can I \[...\]? -Is it possible to [...]? +Is it possible to \[...\]? ## ๐Ÿ“Ž Additional context diff --git a/.github/linters/.checkov.yml b/.github/linters/.checkov.yml deleted file mode 100644 index fa5fb0e..0000000 --- a/.github/linters/.checkov.yml +++ /dev/null @@ -1,6 +0,0 @@ -# You can see all available properties here: https://github.com/bridgecrewio/checkov#configuration-using-a-config-file -quiet: true -skip-check: - - CKV_DOCKER_2 - - CKV_DOCKER_3 - - CKV2_GHA_1 diff --git a/.github/workflows/github-dependents-info.yml b/.github/workflows/demo.yml similarity index 100% rename from .github/workflows/github-dependents-info.yml rename to .github/workflows/demo.yml diff --git a/.lycheeignore b/.lycheeignore index a1b5e6d..9cf8352 100644 --- a/.lycheeignore +++ b/.lycheeignore @@ -23,4 +23,4 @@ https://github.com/oxsecurity/megalinter/raw/main/docs/assets/icons/swift.ico https://stylelint.io/user-guide/integrations/other#analysis-platform-engines https://github.com/pmd/pmd/releases/download/pmd_releases https://twitter.com/intent/tweet* -https://www.linkedin.com/in/mohganji/ \ No newline at end of file +https://www.linkedin.com/in/mohganji/ diff --git a/.mega-linter.yml b/.mega-linter.yml deleted file mode 100644 index 8991838..0000000 --- a/.mega-linter.yml +++ /dev/null @@ -1,23 +0,0 @@ -# Configuration file for MegaLinter -# See all available variables at https://megalinter.io/config-file/ and in linters documentation - -APPLY_FIXES: all # all, none, or list of linter keys -# ENABLE: # If you use ENABLE variable, all other languages/formats/tooling-formats will be disabled by default -# ENABLE_LINTERS: # If you use ENABLE_LINTERS variable, all other linters will be disabled by default -DISABLE: - - EDITORCONFIG -DISABLE_LINTERS: - - MARKDOWN_MARKDOWN_LINK_CHECK -DISABLE_ERRORS_LINTERS: - - ACTION_ACTIONLINT - - DOCKERFILE_HADOLINT - - MAKEFILE_CHECKMAKE - - MARKDOWN_MARKDOWNLINT - - PYTHON_MYPY - - PYTHON_PYRIGHT - - REPOSITORY_GRYPE -FILTER_REGEX_EXCLUDE: (assets) -SHOW_ELAPSED_TIME: true -FILEIO_REPORTER: false -SPELL_FILTER_REGEX_EXCLUDE: (\.bandit\.yml) -# DISABLE_ERRORS: true # Uncomment if you want MegaLinter to detect errors but not block CI to pass diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index aea4fbe..dee6a4f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,36 +1,35 @@ default_language_version: python: python3 +ci: + autofix_prs: true + autoupdate_commit_msg: "[pre-commit.ci] pre-commit suggestions" + autoupdate_schedule: quarterly + # submodules: true + default_stages: [commit, push] repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v2.5.0 + rev: v4.6.0 hooks: - id: check-yaml - id: end-of-file-fixer exclude: LICENSE - - repo: local - hooks: - - id: pyupgrade - name: pyupgrade - entry: poetry run pyupgrade --py39-plus - types: [python] - language: system - - - repo: local - hooks: - - id: isort - name: isort - entry: poetry run isort --settings-path pyproject.toml - types: [python] - language: system + #- repo: https://github.com/executablebooks/mdformat + # rev: 0.7.17 + # hooks: + # - id: mdformat + # additional_dependencies: + # - mdformat-gfm + # - mdformat-black - - repo: local + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.4.2 hooks: - - id: black - name: black - entry: poetry run black --config pyproject.toml - types: [python] - language: system + # try to fix what is possible + - id: ruff + args: ["--fix"] + # perform formatting updates + - id: ruff-format diff --git a/.pylintrc b/.pylintrc deleted file mode 100644 index 07b38e5..0000000 --- a/.pylintrc +++ /dev/null @@ -1,471 +0,0 @@ -[MASTER] -errors-only= - -# A comma-separated list of package or module names from where C extensions may -# be loaded. Extensions are loading into the active Python interpreter and may -# run arbitrary code -extension-pkg-whitelist= - -# Add files or directories to the blacklist. They should be base names, not -# paths. -ignore=CVS - -# Add files or directories matching the regex patterns to the blacklist. The -# regex matches against base names, not paths. -ignore-patterns= - -# Python code to execute, usually for sys.path manipulation such as -# pygtk.require(). -#init-hook= - -# Use multiple processes to speed up Pylint. -jobs=1 - -# List of plugins (as comma separated values of python modules names) to load, -# usually to register additional checkers. -load-plugins= - -# Pickle collected data for later comparisons. -persistent=yes - -# Specify a configuration file. -#rcfile= - -# When enabled, pylint would attempt to guess common misconfiguration and emit -# user-friendly hints instead of false-positive error messages -suggestion-mode=yes - -# Allow loading of arbitrary C extensions. Extensions are imported into the -# active Python interpreter and may run arbitrary code. -unsafe-load-any-extension=no - - -[MESSAGES CONTROL] - -# Only show warnings with the listed confidence levels. Leave empty to show -# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED -confidence= - -# Disable the message, report, category or checker with the given id(s). You -# can either give multiple identifiers separated by comma (,) or put this -# option multiple times (only on the command line, not in the configuration -# file where it should appear only once).You can also use "--disable=all" to -# disable everything first and then reenable specific checks. For example, if -# you want to run only the similarities checker, you can use "--disable=all -# --enable=similarities". If you want to run only the classes checker, but have -# no Warning level messages displayed, use"--disable=all --enable=classes -# --disable=W" -# disable= -disable=import-error,no-name-in-module - -# Enable the message, report, category or checker with the given id(s). You can -# either give multiple identifier separated by comma (,) or put this option -# multiple time (only on the command line, not in the configuration file where -# it should appear only once). See also the "--disable" option for examples. -enable=c-extension-no-member - - -[REPORTS] - -# Python expression which should return a note less than 10 (10 is the highest -# note). You have access to the variables errors warning, statement which -# respectively contain the number of errors / warnings messages and the total -# number of statements analyzed. This is used by the global evaluation report -# (RP0004). -evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10) - -# Template used to display messages. This is a python new-style format string -# used to format the message information. See doc for all details -#msg-template= - -# Set the output format. Available formats are text, parseable, colorized, json -# and msvs (visual studio).You can also give a reporter class, eg -# mypackage.mymodule.MyReporterClass. -output-format=text - -# Tells whether to display a full report or only the messages -reports=no - -# Activate the evaluation score. -score=no - - -[REFACTORING] - -# Maximum number of nested blocks for function / method body -max-nested-blocks=5 - -# Complete name of functions that never returns. When checking for -# inconsistent-return-statements if a never returning function is called then -# it will be considered as an explicit return statement and no message will be -# printed. -never-returning-functions=optparse.Values,sys.exit - - -[VARIABLES] - -# List of additional names supposed to be defined in builtins. Remember that -# you should avoid to define new builtins when possible. -additional-builtins= - -# Tells whether unused global variables should be treated as a violation. -allow-global-unused-variables=yes - -# List of strings which can identify a callback function by name. A callback -# name must start or end with one of those strings. -callbacks=cb_, - _cb - -# A regular expression matching the name of dummy variables (i.e. expectedly -# not used). -dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_ - -# Argument names that match this expression will be ignored. Default to name -# with leading underscore -ignored-argument-names=_.*|^ignored_|^unused_ - -# Tells whether we should check for unused import in __init__ files. -init-import=no - -# List of qualified module names which can have objects that can redefine -# builtins. -redefining-builtins-modules=six.moves,past.builtins,future.builtins - - -[LOGGING] - -# Logging modules to check that the string format arguments are in logging -# function parameter format -logging-modules=logging - - -[TYPECHECK] - -# List of decorators that produce context managers, such as -# contextlib.contextmanager. Add to this list to register other decorators that -# produce valid context managers. -contextmanager-decorators=contextlib.contextmanager - -# List of members which are set dynamically and missed by pylint inference -# system, and so shouldn't trigger E1101 when accessed. Python regular -# expressions are accepted. -generated-members= - -# Tells whether missing members accessed in mixin class should be ignored. A -# mixin class is detected if its name ends with "mixin" (case insensitive). -ignore-mixin-members=yes - -# This flag controls whether pylint should warn about no-member and similar -# checks whenever an opaque object is returned when inferring. The inference -# can return multiple potential results while evaluating a Python object, but -# some branches might not be evaluated, which results in partial inference. In -# that case, it might be useful to still emit no-member and other checks for -# the rest of the inferred objects. -ignore-on-opaque-inference=yes - -# List of class names for which member attributes should not be checked (useful -# for classes with dynamically set attributes). This supports the use of -# qualified names. -ignored-classes=optparse.Values,thread._local,_thread._local - -# List of module names for which member attributes should not be checked -# (useful for modules/projects where namespaces are manipulated during runtime -# and thus existing member attributes cannot be deduced by static analysis. It -# supports qualified module names, as well as Unix pattern matching. -ignored-modules= - -# Show a hint with possible names when a member name was not found. The aspect -# of finding the hint is based on edit distance. -missing-member-hint=yes - -# The minimum edit distance a name should have in order to be considered a -# similar match for a missing member name. -missing-member-hint-distance=1 - -# The total number of similar names that should be taken in consideration when -# showing a hint for a missing member. -missing-member-max-choices=1 - - -[MISCELLANEOUS] - -# List of note tags to take in consideration, separated by a comma. -notes=FIXME, - XXX, - TODO - - -[BASIC] - -# Naming style matching correct argument names -argument-naming-style=snake_case - -# Regular expression matching correct argument names. Overrides argument- -# naming-style -#argument-rgx= - -# Naming style matching correct attribute names -attr-naming-style=snake_case - -# Regular expression matching correct attribute names. Overrides attr-naming- -# style -#attr-rgx= - -# Bad variable names which should always be refused, separated by a comma -bad-names=foo, - bar, - baz, - toto, - tutu, - tata - -# Naming style matching correct class attribute names -class-attribute-naming-style=any - -# Regular expression matching correct class attribute names. Overrides class- -# attribute-naming-style -#class-attribute-rgx= - -# Naming style matching correct class names -class-naming-style=PascalCase - -# Regular expression matching correct class names. Overrides class-naming-style -#class-rgx= - -# Naming style matching correct constant names -const-naming-style=UPPER_CASE - -# Regular expression matching correct constant names. Overrides const-naming- -# style -#const-rgx= - -# Minimum line length for functions/classes that require docstrings, shorter -# ones are exempt. -docstring-min-length=-1 - -# Naming style matching correct function names -function-naming-style=snake_case - -# Regular expression matching correct function names. Overrides function- -# naming-style -#function-rgx= - -# Good variable names which should always be accepted, separated by a comma -good-names=i, - j, - k, - ex, - Run, - _ - -# Include a hint for the correct naming format with invalid-name -include-naming-hint=no - -# Naming style matching correct inline iteration names -inlinevar-naming-style=any - -# Regular expression matching correct inline iteration names. Overrides -# inlinevar-naming-style -#inlinevar-rgx= - -# Naming style matching correct method names -method-naming-style=snake_case - -# Regular expression matching correct method names. Overrides method-naming- -# style -#method-rgx= - -# Naming style matching correct module names -module-naming-style=snake_case - -# Regular expression matching correct module names. Overrides module-naming- -# style -#module-rgx= - -# Colon-delimited sets of names that determine each other's naming style when -# the name regexes allow several styles. -name-group= - -# Regular expression which should only match function or class names that do -# not require a docstring. -no-docstring-rgx=^_ - -# List of decorators that produce properties, such as abc.abstractproperty. Add -# to this list to register other decorators that produce valid properties. -property-classes=abc.abstractproperty - -# Naming style matching correct variable names -variable-naming-style=snake_case - -# Regular expression matching correct variable names. Overrides variable- -# naming-style -#variable-rgx= - - -[SPELLING] - -# Limits count of emitted suggestions for spelling mistakes -max-spelling-suggestions=4 - -# Spelling dictionary name. Available dictionaries: none. To make it working -# install python-enchant package. -spelling-dict= - -# List of comma separated words that should not be checked. -spelling-ignore-words= - -# A path to a file that contains private dictionary; one word per line. -spelling-private-dict-file= - -# Tells whether to store unknown words to indicated private dictionary in -# --spelling-private-dict-file option instead of raising a message. -spelling-store-unknown-words=no - - -[FORMAT] - -# Expected format of line ending, e.g. empty (any line ending), LF or CRLF. -expected-line-ending-format= - -# Regexp for a line that is allowed to be longer than the limit. -ignore-long-lines=^\s*(# )??$ - -# Number of spaces of indent required inside a hanging or continued line. -indent-after-paren=4 - -# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 -# tab). -indent-string=' ' - -# Maximum number of characters on a single line. -max-line-length=100 - -# Maximum number of lines in a module -max-module-lines=1000 - -# List of optional constructs for which whitespace checking is disabled. `dict- -# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}. -# `trailing-comma` allows a space between comma and closing bracket: (a, ). -# `empty-line` allows space-only lines. -# no-space-check=trailing-comma, dict-separator # Deprecated since pylint 2.6 - -# Allow the body of a class to be on the same line as the declaration if body -# contains single statement. -single-line-class-stmt=no - -# Allow the body of an if to be on the same line as the test if there is no -# else. -single-line-if-stmt=no - - -[SIMILARITIES] - -# Ignore comments when computing similarities. -ignore-comments=yes - -# Ignore docstrings when computing similarities. -ignore-docstrings=yes - -# Ignore imports when computing similarities. -ignore-imports=no - -# Minimum lines number of a similarity. -min-similarity-lines=4 - - -[DESIGN] - -# Maximum number of arguments for function / method -max-args=5 - -# Maximum number of attributes for a class (see R0902). -max-attributes=7 - -# Maximum number of boolean expressions in a if statement -max-bool-expr=5 - -# Maximum number of branch for function / method body -max-branches=12 - -# Maximum number of locals for function / method body -max-locals=15 - -# Maximum number of parents for a class (see R0901). -max-parents=7 - -# Maximum number of public methods for a class (see R0904). -max-public-methods=20 - -# Maximum number of return / yield for function / method body -max-returns=6 - -# Maximum number of statements in function / method body -max-statements=50 - -# Minimum number of public methods for a class (see R0903). -min-public-methods=2 - - -[IMPORTS] - -# Allow wildcard imports from modules that define __all__. -allow-wildcard-with-all=no - -# Analyse import fallback blocks. This can be used to support both Python 2 and -# 3 compatible code, which means that the block might have code that exists -# only in one or another interpreter, leading to false positives when analysed. -analyse-fallback-blocks=no - -# Deprecated modules which should not be used, separated by a comma -deprecated-modules=regsub, - TERMIOS, - Bastion, - rexec - -# Create a graph of external dependencies in the given file (report RP0402 must -# not be disabled) -ext-import-graph= - -# Create a graph of every (i.e. internal and external) dependencies in the -# given file (report RP0402 must not be disabled) -import-graph= - -# Create a graph of internal dependencies in the given file (report RP0402 must -# not be disabled) -int-import-graph= - -# Force import order to recognize a module as part of the standard -# compatibility libraries. -known-standard-library= - -# Force import order to recognize a module as part of a third party library. -known-third-party=enchant - - -[CLASSES] - -# List of method names used to declare (i.e. assign) instance attributes. -defining-attr-methods=__init__, - __new__, - setUp - -# List of member names, which should be excluded from the protected access -# warning. -exclude-protected=_asdict, - _fields, - _replace, - _source, - _make - -# List of valid names for the first argument in a class method. -valid-classmethod-first-arg=cls - -# List of valid names for the first argument in a metaclass class method. -valid-metaclass-classmethod-first-arg=mcs - - -[EXCEPTIONS] - -# Exceptions that will emit a warning when being caught. Defaults to -# "Exception" -overgeneral-exceptions=Exception \ No newline at end of file diff --git a/.ruff.toml b/.ruff.toml deleted file mode 100644 index 2cfeee6..0000000 --- a/.ruff.toml +++ /dev/null @@ -1 +0,0 @@ -line-length = 200 \ No newline at end of file diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 82c2a00..412a043 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -14,22 +14,22 @@ appearance, race, religion, or sexual identity and orientation. Examples of behavior that contributes to creating a positive environment include: -* Using welcoming and inclusive language -* Being respectful of differing viewpoints and experiences -* Gracefully accepting constructive criticism -* Focusing on what is best for the community -* Showing empathy towards other community members +- Using welcoming and inclusive language +- Being respectful of differing viewpoints and experiences +- Gracefully accepting constructive criticism +- Focusing on what is best for the community +- Showing empathy towards other community members Examples of unacceptable behavior by participants include: -* The use of sexualized language or imagery and unwelcome sexual attention or - advances -* Trolling, insulting/derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or electronic - address, without explicit permission -* Other conduct which could reasonably be considered inappropriate in a - professional setting +- The use of sexualized language or imagery and unwelcome sexual attention or + advances +- Trolling, insulting/derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or electronic + address, without explicit permission +- Other conduct which could reasonably be considered inappropriate in a + professional setting ## Our Responsibilities @@ -70,7 +70,7 @@ members of the project's leadership. This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at -[homepage]: https://www.contributor-covenant.org - For answers to common questions about this code of conduct, see + +[homepage]: https://www.contributor-covenant.org diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6ae84de..a16a5aa 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -36,7 +36,6 @@ Before submitting your code please do the following steps: 1. Add any changes you want 1. Add tests for the new changes 1. Edit documentation if you have changed something significant -1. Run `make codestyle` to format your changes. 1. Run `make lint` to ensure that types, security and docstrings are okay. ## Other help diff --git a/Makefile b/Makefile index 8a03e25..16db73f 100644 --- a/Makefile +++ b/Makefile @@ -30,8 +30,7 @@ pre-commit-install: #* Formatters .PHONY: codestyle codestyle: - poetry run pyupgrade --exit-zero-even-if-changed --py39-plus **/*.py - poetry run black --config pyproject.toml ./ + pre-commit run --all-files .PHONY: formatting formatting: codestyle @@ -43,8 +42,7 @@ test: poetry run coverage-badge -o assets/images/coverage.svg -f .PHONY: check-codestyle -check-codestyle: - poetry run black --diff --check --config pyproject.toml ./ +check-codestyle: codestyle poetry run darglint --verbosity 2 github_dependents_info tests .PHONY: mypy @@ -62,8 +60,8 @@ lint: test check-codestyle mypy check-safety .PHONY: update-dev-deps update-dev-deps: - poetry add -D bandit@latest darglint@latest "isort[colors]@latest" mypy@latest pre-commit@latest pydocstyle@latest pylint@latest pytest@latest pyupgrade@latest safety@latest coverage@latest coverage-badge@latest pytest-html@latest pytest-cov@latest - poetry add -D --allow-prereleases black@latest + poetry add -D darglint@latest mypy@latest pre-commit@latest pytest@latest safety@latest coverage@latest coverage-badge@latest pytest-html@latest pytest-cov@latest + pre-commit autoupdate #* Docker # Example: make docker-build VERSION=latest diff --git a/README.md b/README.md index d048cc3..86bed2b 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,7 @@ Collect information about dependencies between a github repo and other repositor _________________ + ## ๐Ÿš€ Features GitHub API does not allow to collect information about package usage (**Used by** on home, **Dependents** in insights section) @@ -34,12 +35,10 @@ This package uses GitHub HTML to collect dependents information and can: - Output as json (including shields.io markdown badges) - Generate summary markdown file - Update existing markdown by inserting **Used by** badge within tags - - ` -[![Generated by github-dependents-info](https://img.shields.io/static/v1?label=Used%20by&message=11&color=informational&logo=slickpic)](https://github.com/nvuillam/github-dependents-info/blob/main/docs/github-dependents-info.md)` + - ` [![Generated by github-dependents-info](https://img.shields.io/static/v1?label=Used%20by&message=11&color=informational&logo=slickpic)](https://github.com/nvuillam/github-dependents-info/blob/main/docs/github-dependents-info.md)` - Handle multiple repositories packages - Filter results using minimum stars - Badges example [![](https://img.shields.io/static/v1?label=Used%20by&message=15&color=informational&logo=slickpic)](https://github.com/nvuillam/npm-groovy-lint/network/dependents) @@ -174,6 +173,7 @@ Badges example } ``` +
@@ -205,6 +205,7 @@ Badges example _Generated by [github-dependents-info](https://github.com/nvuillam/github-dependents-info)_ ``` +
Note: If your repository packages have millions of dependents, running github-dependent-infos could take hours, as it works by browsing and scraping HTML pages returned by GitHub. For example, [angular/angular dependents](assets/angular-package-usage.md) did run during several hours ! @@ -215,6 +216,7 @@ Note: If your repository packages have millions of dependents, running github-de - [Use as GitHub Action](#use-as-github-action) _________________ + ## โš™๏ธ Installation ```bash @@ -228,6 +230,7 @@ poetry add github-dependents-info ``` _________________ + ## ๐Ÿ› ๏ธ Usage ```shell @@ -249,36 +252,50 @@ _________________ | --verbose | Boolean | _(optional)_ Verbose output | _________________ + ## ๐Ÿงช Examples - Text output - github-dependents-info --repo nvuillam/npm-groovy-lint + ``` + github-dependents-info --repo nvuillam/npm-groovy-lint + ``` - JSON output - github-dependents-info --repo nvuillam/npm-groovy-lint --json + ``` + github-dependents-info --repo nvuillam/npm-groovy-lint --json + ``` -- Insert/Update **Used by** markdown badge within an existing markdown file containing tags ` -[![Generated by github-dependents-info](https://img.shields.io/static/v1?label=Used%20by&message=11&color=informational&logo=slickpic)](https://github.com/nvuillam/github-dependents-info/blob/main/docs/github-dependents-info.md)` +- Insert/Update **Used by** markdown badge within an existing markdown file containing tags ` [![Generated by github-dependents-info](https://img.shields.io/static/v1?label=Used%20by&message=11&color=informational&logo=slickpic)](https://github.com/nvuillam/github-dependents-info/blob/main/docs/github-dependents-info.md)` - github-dependents-info --repo nvuillam/npm-groovy-lint --badgemarkdownfile ./README.md + ``` + github-dependents-info --repo nvuillam/npm-groovy-lint --badgemarkdownfile ./README.md + ``` - Build markdown file with dependent repos (single package), sorted by name - github-dependents-info --repo nvuillam/npm-groovy-lint --markdownfile ./docs/package-usage.md --verbose + ``` + github-dependents-info --repo nvuillam/npm-groovy-lint --markdownfile ./docs/package-usage.md --verbose + ``` - Build markdown file with dependent repos (single package), with minimum 10 stars - github-dependents-info --repo nvuillam/npm-groovy-lint --markdownfile ./docs/package-usage.md --minstars 10 --verbose + ``` + github-dependents-info --repo nvuillam/npm-groovy-lint --markdownfile ./docs/package-usage.md --minstars 10 --verbose + ``` - Build markdown file with dependent repos (multiple package), sorted by stars - github-dependents-info --repo oxsecurity/megalinter --markdownfile ./docs/package-usage.md --sort stars --verbose + ``` + github-dependents-info --repo oxsecurity/megalinter --markdownfile ./docs/package-usage.md --sort stars --verbose + ``` - Build markdown file with dependent repos (multiple package), with merged list of packages in output markdown - github-dependents-info --repo oxsecurity/megalinter --markdownfile ./docs/package-usage.md --sort stars --mergepackages --verbose + ``` + github-dependents-info --repo oxsecurity/megalinter --markdownfile ./docs/package-usage.md --sort stars --mergepackages --verbose + ``` ## Use as GitHub Action @@ -290,8 +307,7 @@ Create a file **.github/workflows/github-dependents-info.yml** in your repositor If will generate a new Pull Request (or replace the pending one) every time the usage stats will have changed :) -Don't forget to add tags ` -[![Generated by github-dependents-info](https://img.shields.io/static/v1?label=Used%20by&message=11&color=informational&logo=slickpic)](https://github.com/nvuillam/github-dependents-info/blob/main/docs/github-dependents-info.md)` in your **README.md**, at the end of another badge line if you want github-dependents-info to replace its content automatically. +Don't forget to add tags ` [![Generated by github-dependents-info](https://img.shields.io/static/v1?label=Used%20by&message=11&color=informational&logo=slickpic)](https://github.com/nvuillam/github-dependents-info/blob/main/docs/github-dependents-info.md)` in your **README.md**, at the end of another badge line if you want github-dependents-info to replace its content automatically. ```yaml # GitHub Dependents Info workflow @@ -367,6 +383,7 @@ jobs: ``` _________________ + ## ๐Ÿ›ก License [![License](https://img.shields.io/github/license/nvuillam/github-dependents-info)](https://github.com/nvuillam/github-dependents-info/blob/master/LICENSE) @@ -374,9 +391,11 @@ _________________ This project is licensed under the terms of the `MIT` license. See [LICENSE](https://github.com/nvuillam/github-dependents-info/blob/master/LICENSE) for more details. _________________ + ## Credits [![๐Ÿš€ Your next Python package needs a bleeding-edge project structure.](https://img.shields.io/badge/python--package--template-%F0%9F%9A%80-brightgreen)](https://github.com/TezRomacH/python-package-template) This package has been inspired by stackexchange post [How to use GitHub API to get a repository's dependents information in GitHub?](https://stackoverflow.com/questions/58734176/how-to-use-github-api-to-get-a-repositorys-dependents-information-in-github) + - [Bertrand Martel](https://github.com/bertrandmartel) - [muvaf](https://stackoverflow.com/users/5233252/muvaf) - [Mo Ganji](https://www.linkedin.com/in/mohganji/) diff --git a/assets/angular-package-usage.md b/assets/angular-package-usage.md index 6d2d21a..089da5b 100644 --- a/assets/angular-package-usage.md +++ b/assets/angular-package-usage.md @@ -5533,4 +5533,4 @@ No dependent repositories | [Romanchuk/angular-i18next-demo](https://github.com/Romanchuk/angular-i18next-demo) | 10 | | [IliaIdakiev/ng-softuni-2022](https://github.com/IliaIdakiev/ng-softuni-2022) | 10 | -_Generated by [github-dependents-info](https://github.com/nvuillam/github-dependents-info)_ \ No newline at end of file +_Generated by [github-dependents-info](https://github.com/nvuillam/github-dependents-info)_ diff --git a/assets/markdown-demo-2.md b/assets/markdown-demo-2.md index d865405..7329f18 100644 --- a/assets/markdown-demo-2.md +++ b/assets/markdown-demo-2.md @@ -26,4 +26,4 @@ | [CIT-SeniorDesign/CIT-SeniorDesign.github.io](https://github.com/CIT-SeniorDesign/CIT-SeniorDesign.github.io) | 0 | | [RecuencoJones/vscode-groovy-lint-issue](https://github.com/RecuencoJones/vscode-groovy-lint-issue) | 0 | -_Generated by [github-dependents-info](https://github.com/nvuillam/github-dependents-info)_ \ No newline at end of file +_Generated by [github-dependents-info](https://github.com/nvuillam/github-dependents-info)_ diff --git a/assets/markdown-demo.md b/assets/markdown-demo.md index 4c5315f..ce16f8e 100644 --- a/assets/markdown-demo.md +++ b/assets/markdown-demo.md @@ -1614,4 +1614,4 @@ No dependent repositories |:------------------------------------------------------------------------------------|------:| | [ahmadnassri/template-terraform](https://github.com/ahmadnassri/template-terraform) | 0 | -_Generated by [github-dependents-info](https://github.com/nvuillam/github-dependents-info)_ \ No newline at end of file +_Generated by [github-dependents-info](https://github.com/nvuillam/github-dependents-info)_ diff --git a/docs/github-dependents-info.md b/docs/github-dependents-info.md index cdd0afe..15889e9 100644 --- a/docs/github-dependents-info.md +++ b/docs/github-dependents-info.md @@ -19,4 +19,4 @@ |   [bruno-fs](https://github.com/bruno-fs) / [python-rust-research](https://github.com/bruno-fs/python-rust-research) | 0 | |   [nvuillam](https://github.com/nvuillam) / [mkdocs-material-github-dependents-info](https://github.com/nvuillam/mkdocs-material-github-dependents-info) | 0 | -_Generated using [github-dependents-info](https://github.com/nvuillam/github-dependents-info), by [Nicolas Vuillamy](https://github.com/nvuillam)_ \ No newline at end of file +_Generated using [github-dependents-info](https://github.com/nvuillam/github-dependents-info), by [Nicolas Vuillamy](https://github.com/nvuillam)_ diff --git a/github_dependents_info/__init__.py b/github_dependents_info/__init__.py index 6164bff..175117b 100644 --- a/github_dependents_info/__init__.py +++ b/github_dependents_info/__init__.py @@ -1,5 +1,4 @@ -""" -Collect information about dependencies between a github repo and other repositories. +"""Collect information about dependencies between a github repo and other repositories. Results available in JSON, markdown and badges. """ diff --git a/github_dependents_info/__main__.py b/github_dependents_info/__main__.py index 47d0c71..3edbe26 100644 --- a/github_dependents_info/__main__.py +++ b/github_dependents_info/__main__.py @@ -1,9 +1,10 @@ import logging import typer +from rich.console import Console + from github_dependents_info import version from github_dependents_info.gh_dependents_info import GithubDependentsInfo -from rich.console import Console app = typer.Typer( name="github-dependents-info", diff --git a/poetry.lock b/poetry.lock index f7d692c..b5da22e 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,18 +1,4 @@ -# This file is automatically @generated by Poetry 1.7.1 and should not be changed by hand. - -[[package]] -name = "astroid" -version = "3.1.0" -description = "An abstract syntax tree for Python with inference support." -optional = false -python-versions = ">=3.8.0" -files = [ - {file = "astroid-3.1.0-py3-none-any.whl", hash = "sha256:951798f922990137ac090c53af473db7ab4e70c770e6d7fae0cec59f74411819"}, - {file = "astroid-3.1.0.tar.gz", hash = "sha256:ac248253bfa4bd924a0de213707e7ebeeb3138abeb48d798784ead1e56d419d4"}, -] - -[package.dependencies] -typing-extensions = {version = ">=4.0.0", markers = "python_version < \"3.11\""} +# This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand. [[package]] name = "authlib" @@ -28,29 +14,6 @@ files = [ [package.dependencies] cryptography = "*" -[[package]] -name = "bandit" -version = "1.7.7" -description = "Security oriented static analyser for python code." -optional = false -python-versions = ">=3.8" -files = [ - {file = "bandit-1.7.7-py3-none-any.whl", hash = "sha256:17e60786a7ea3c9ec84569fd5aee09936d116cb0cb43151023258340dbffb7ed"}, - {file = "bandit-1.7.7.tar.gz", hash = "sha256:527906bec6088cb499aae31bc962864b4e77569e9d529ee51df3a93b4b8ab28a"}, -] - -[package.dependencies] -colorama = {version = ">=0.3.9", markers = "platform_system == \"Windows\""} -PyYAML = ">=5.3.1" -rich = "*" -stevedore = ">=1.20.0" - -[package.extras] -baseline = ["GitPython (>=3.1.30)"] -test = ["beautifulsoup4 (>=4.8.0)", "coverage (>=4.5.4)", "fixtures (>=3.0.0)", "flake8 (>=4.0.0)", "pylint (==1.9.4)", "stestr (>=2.5.0)", "testscenarios (>=0.5.0)", "testtools (>=2.3.0)"] -toml = ["tomli (>=1.1.0)"] -yaml = ["PyYAML"] - [[package]] name = "beautifulsoup4" version = "4.12.3" @@ -72,52 +35,6 @@ charset-normalizer = ["charset-normalizer"] html5lib = ["html5lib"] lxml = ["lxml"] -[[package]] -name = "black" -version = "24.2.0" -description = "The uncompromising code formatter." -optional = false -python-versions = ">=3.8" -files = [ - {file = "black-24.2.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:6981eae48b3b33399c8757036c7f5d48a535b962a7c2310d19361edeef64ce29"}, - {file = "black-24.2.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:d533d5e3259720fdbc1b37444491b024003e012c5173f7d06825a77508085430"}, - {file = "black-24.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:61a0391772490ddfb8a693c067df1ef5227257e72b0e4108482b8d41b5aee13f"}, - {file = "black-24.2.0-cp310-cp310-win_amd64.whl", hash = "sha256:992e451b04667116680cb88f63449267c13e1ad134f30087dec8527242e9862a"}, - {file = "black-24.2.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:163baf4ef40e6897a2a9b83890e59141cc8c2a98f2dda5080dc15c00ee1e62cd"}, - {file = "black-24.2.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:e37c99f89929af50ffaf912454b3e3b47fd64109659026b678c091a4cd450fb2"}, - {file = "black-24.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4f9de21bafcba9683853f6c96c2d515e364aee631b178eaa5145fc1c61a3cc92"}, - {file = "black-24.2.0-cp311-cp311-win_amd64.whl", hash = "sha256:9db528bccb9e8e20c08e716b3b09c6bdd64da0dd129b11e160bf082d4642ac23"}, - {file = "black-24.2.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:d84f29eb3ee44859052073b7636533ec995bd0f64e2fb43aeceefc70090e752b"}, - {file = "black-24.2.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:1e08fb9a15c914b81dd734ddd7fb10513016e5ce7e6704bdd5e1251ceee51ac9"}, - {file = "black-24.2.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:810d445ae6069ce64030c78ff6127cd9cd178a9ac3361435708b907d8a04c693"}, - {file = "black-24.2.0-cp312-cp312-win_amd64.whl", hash = "sha256:ba15742a13de85e9b8f3239c8f807723991fbfae24bad92d34a2b12e81904982"}, - {file = "black-24.2.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:7e53a8c630f71db01b28cd9602a1ada68c937cbf2c333e6ed041390d6968faf4"}, - {file = "black-24.2.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:93601c2deb321b4bad8f95df408e3fb3943d85012dddb6121336b8e24a0d1218"}, - {file = "black-24.2.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a0057f800de6acc4407fe75bb147b0c2b5cbb7c3ed110d3e5999cd01184d53b0"}, - {file = "black-24.2.0-cp38-cp38-win_amd64.whl", hash = "sha256:faf2ee02e6612577ba0181f4347bcbcf591eb122f7841ae5ba233d12c39dcb4d"}, - {file = "black-24.2.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:057c3dc602eaa6fdc451069bd027a1b2635028b575a6c3acfd63193ced20d9c8"}, - {file = "black-24.2.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:08654d0797e65f2423f850fc8e16a0ce50925f9337fb4a4a176a7aa4026e63f8"}, - {file = "black-24.2.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ca610d29415ee1a30a3f30fab7a8f4144e9d34c89a235d81292a1edb2b55f540"}, - {file = "black-24.2.0-cp39-cp39-win_amd64.whl", hash = "sha256:4dd76e9468d5536abd40ffbc7a247f83b2324f0c050556d9c371c2b9a9a95e31"}, - {file = "black-24.2.0-py3-none-any.whl", hash = "sha256:e8a6ae970537e67830776488bca52000eaa37fa63b9988e8c487458d9cd5ace6"}, - {file = "black-24.2.0.tar.gz", hash = "sha256:bce4f25c27c3435e4dace4815bcb2008b87e167e3bf4ee47ccdc5ce906eb4894"}, -] - -[package.dependencies] -click = ">=8.0.0" -mypy-extensions = ">=0.4.3" -packaging = ">=22.0" -pathspec = ">=0.9.0" -platformdirs = ">=2" -tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} -typing-extensions = {version = ">=4.0.1", markers = "python_version < \"3.11\""} - -[package.extras] -colorama = ["colorama (>=0.4.3)"] -d = ["aiohttp (>=3.7.4)", "aiohttp (>=3.7.4,!=3.9.0)"] -jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"] -uvloop = ["uvloop (>=0.15.2)"] - [[package]] name = "certifi" version = "2024.2.2" @@ -474,21 +391,6 @@ files = [ {file = "darglint-1.8.1.tar.gz", hash = "sha256:080d5106df149b199822e7ee7deb9c012b49891538f14a11be681044f0bb20da"}, ] -[[package]] -name = "dill" -version = "0.3.8" -description = "serialize all of Python" -optional = false -python-versions = ">=3.8" -files = [ - {file = "dill-0.3.8-py3-none-any.whl", hash = "sha256:c36ca9ffb54365bdd2f8eb3eff7d2a21237f8452b57ace88b1ac615b7e815bd7"}, - {file = "dill-0.3.8.tar.gz", hash = "sha256:3ebe3c479ad625c4553aca177444d89b486b1d84982eeacded644afc0cf797ca"}, -] - -[package.extras] -graph = ["objgraph (>=1.7.2)"] -profile = ["gprof2dot (>=2022.7.29)"] - [[package]] name = "distlib" version = "0.3.8" @@ -587,23 +489,6 @@ files = [ {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"}, ] -[[package]] -name = "isort" -version = "5.13.2" -description = "A Python utility / library to sort Python imports." -optional = false -python-versions = ">=3.8.0" -files = [ - {file = "isort-5.13.2-py3-none-any.whl", hash = "sha256:8ca5e72a8d85860d5a3fa69b8745237f2939afe12dbf656afbcb47fe72d947a6"}, - {file = "isort-5.13.2.tar.gz", hash = "sha256:48fdfcb9face5d58a4f6dde2e72a1fb8dcaf8ab26f95ab49fab84c2ddefb0109"}, -] - -[package.dependencies] -colorama = {version = ">=0.4.6", optional = true, markers = "extra == \"colors\""} - -[package.extras] -colors = ["colorama (>=0.4.6)"] - [[package]] name = "jinja2" version = "3.1.3" @@ -734,17 +619,6 @@ docs = ["alabaster (==0.7.15)", "autodocsumm (==0.2.12)", "sphinx (==7.2.6)", "s lint = ["pre-commit (>=2.4,<4.0)"] tests = ["pytest", "pytz", "simplejson"] -[[package]] -name = "mccabe" -version = "0.7.0" -description = "McCabe checker, plugin for flake8" -optional = false -python-versions = ">=3.6" -files = [ - {file = "mccabe-0.7.0-py2.py3-none-any.whl", hash = "sha256:6c2d30ab6be0e4a46919781807b4f0d834ebdd6c6e3dca0bda5a15f863427b6e"}, - {file = "mccabe-0.7.0.tar.gz", hash = "sha256:348e0240c33b60bbdf4e523192ef919f28cb2c3d7d5c7794f74009290f236325"}, -] - [[package]] name = "mdurl" version = "0.1.2" @@ -925,8 +799,8 @@ files = [ [package.dependencies] numpy = [ {version = ">=1.22.4,<2", markers = "python_version < \"3.11\""}, - {version = ">=1.26.0,<2", markers = "python_version >= \"3.12\""}, {version = ">=1.23.2,<2", markers = "python_version == \"3.11\""}, + {version = ">=1.26.0,<2", markers = "python_version >= \"3.12\""}, ] python-dateutil = ">=2.8.2" pytz = ">=2020.1" @@ -957,28 +831,6 @@ sql-other = ["SQLAlchemy (>=2.0.0)", "adbc-driver-postgresql (>=0.8.0)", "adbc-d test = ["hypothesis (>=6.46.1)", "pytest (>=7.3.2)", "pytest-xdist (>=2.2.0)"] xml = ["lxml (>=4.9.2)"] -[[package]] -name = "pathspec" -version = "0.12.1" -description = "Utility library for gitignore style pattern matching of file paths." -optional = false -python-versions = ">=3.8" -files = [ - {file = "pathspec-0.12.1-py3-none-any.whl", hash = "sha256:a0d503e138a4c123b27490a4f7beda6a01c6f288df0e4a8b79c7eb0dc7b4cc08"}, - {file = "pathspec-0.12.1.tar.gz", hash = "sha256:a482d51503a1ab33b1c67a6c3813a26953dbdc71c31dacaef9a838c4e29f5712"}, -] - -[[package]] -name = "pbr" -version = "6.0.0" -description = "Python Build Reasonableness" -optional = false -python-versions = ">=2.6" -files = [ - {file = "pbr-6.0.0-py2.py3-none-any.whl", hash = "sha256:4a7317d5e3b17a3dccb6a8cfe67dab65b20551404c52c8ed41279fa4f0cb4cda"}, - {file = "pbr-6.0.0.tar.gz", hash = "sha256:d1377122a5a00e2f940ee482999518efe16d745d423a670c27773dfbc3c9a7d9"}, -] - [[package]] name = "platformdirs" version = "4.2.0" @@ -1090,23 +942,6 @@ typing-extensions = ">=4.2.0" dotenv = ["python-dotenv (>=0.10.4)"] email = ["email-validator (>=1.0.3)"] -[[package]] -name = "pydocstyle" -version = "6.3.0" -description = "Python docstring style checker" -optional = false -python-versions = ">=3.6" -files = [ - {file = "pydocstyle-6.3.0-py3-none-any.whl", hash = "sha256:118762d452a49d6b05e194ef344a55822987a462831ade91ec5c06fd2169d019"}, - {file = "pydocstyle-6.3.0.tar.gz", hash = "sha256:7ce43f0c0ac87b07494eb9c0b462c0b73e6ff276807f204d6b53edc72b7e44e1"}, -] - -[package.dependencies] -snowballstemmer = ">=2.2.0" - -[package.extras] -toml = ["tomli (>=1.2.3)"] - [[package]] name = "pygments" version = "2.17.2" @@ -1122,36 +957,6 @@ files = [ plugins = ["importlib-metadata"] windows-terminal = ["colorama (>=0.4.6)"] -[[package]] -name = "pylint" -version = "3.1.0" -description = "python code static checker" -optional = false -python-versions = ">=3.8.0" -files = [ - {file = "pylint-3.1.0-py3-none-any.whl", hash = "sha256:507a5b60953874766d8a366e8e8c7af63e058b26345cfcb5f91f89d987fd6b74"}, - {file = "pylint-3.1.0.tar.gz", hash = "sha256:6a69beb4a6f63debebaab0a3477ecd0f559aa726af4954fc948c51f7a2549e23"}, -] - -[package.dependencies] -astroid = ">=3.1.0,<=3.2.0-dev0" -colorama = {version = ">=0.4.5", markers = "sys_platform == \"win32\""} -dill = [ - {version = ">=0.2", markers = "python_version < \"3.11\""}, - {version = ">=0.3.7", markers = "python_version >= \"3.12\""}, - {version = ">=0.3.6", markers = "python_version >= \"3.11\" and python_version < \"3.12\""}, -] -isort = ">=4.2.5,<5.13.0 || >5.13.0,<6" -mccabe = ">=0.6,<0.8" -platformdirs = ">=2.2.0" -tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} -tomlkit = ">=0.10.1" -typing-extensions = {version = ">=3.10.0", markers = "python_version < \"3.10\""} - -[package.extras] -spelling = ["pyenchant (>=3.2,<4.0)"] -testutils = ["gitpython (>3)"] - [[package]] name = "pytest" version = "8.0.2" @@ -1254,20 +1059,6 @@ files = [ {file = "pytz-2024.1.tar.gz", hash = "sha256:2a29735ea9c18baf14b448846bde5a48030ed267578472d8955cd0e7443a9812"}, ] -[[package]] -name = "pyupgrade" -version = "3.15.1" -description = "A tool to automatically upgrade syntax for newer versions." -optional = false -python-versions = ">=3.8.1" -files = [ - {file = "pyupgrade-3.15.1-py2.py3-none-any.whl", hash = "sha256:c5e005de2805edcd333d1deb04553200ec69da85e4bc9db37b16345ed9e27ed9"}, - {file = "pyupgrade-3.15.1.tar.gz", hash = "sha256:7690857cae0f6253f39241dcd2e57118c333c438b78609fc3c17a5aa61227b7d"}, -] - -[package.dependencies] -tokenize-rt = ">=5.2.0" - [[package]] name = "pyyaml" version = "6.0.1" @@ -1533,17 +1324,6 @@ files = [ {file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"}, ] -[[package]] -name = "snowballstemmer" -version = "2.2.0" -description = "This package provides 29 stemmers for 28 languages generated from Snowball algorithms." -optional = false -python-versions = "*" -files = [ - {file = "snowballstemmer-2.2.0-py2.py3-none-any.whl", hash = "sha256:c8e1716e83cc398ae16824e5572ae04e0d9fc2c6b985fb0f900f5f0c96ecba1a"}, - {file = "snowballstemmer-2.2.0.tar.gz", hash = "sha256:09b16deb8547d3412ad7b590689584cd0fe25ec8db3be37788be3810cbf19cb1"}, -] - [[package]] name = "soupsieve" version = "2.5" @@ -1555,31 +1335,6 @@ files = [ {file = "soupsieve-2.5.tar.gz", hash = "sha256:5663d5a7b3bfaeee0bc4372e7fc48f9cff4940b3eec54a6451cc5299f1097690"}, ] -[[package]] -name = "stevedore" -version = "5.2.0" -description = "Manage dynamic plugins for Python applications" -optional = false -python-versions = ">=3.8" -files = [ - {file = "stevedore-5.2.0-py3-none-any.whl", hash = "sha256:1c15d95766ca0569cad14cb6272d4d31dae66b011a929d7c18219c176ea1b5c9"}, - {file = "stevedore-5.2.0.tar.gz", hash = "sha256:46b93ca40e1114cea93d738a6c1e365396981bb6bb78c27045b7587c9473544d"}, -] - -[package.dependencies] -pbr = ">=2.0.0,<2.1.0 || >2.1.0" - -[[package]] -name = "tokenize-rt" -version = "5.2.0" -description = "A wrapper around the stdlib `tokenize` which roundtrips." -optional = false -python-versions = ">=3.8" -files = [ - {file = "tokenize_rt-5.2.0-py2.py3-none-any.whl", hash = "sha256:b79d41a65cfec71285433511b50271b05da3584a1da144a0752e9c621a285289"}, - {file = "tokenize_rt-5.2.0.tar.gz", hash = "sha256:9fe80f8a5c1edad2d3ede0f37481cc0cc1538a2f442c9c2f9e4feacd2792d054"}, -] - [[package]] name = "tomli" version = "2.0.1" @@ -1591,17 +1346,6 @@ files = [ {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, ] -[[package]] -name = "tomlkit" -version = "0.12.3" -description = "Style preserving TOML library" -optional = false -python-versions = ">=3.7" -files = [ - {file = "tomlkit-0.12.3-py3-none-any.whl", hash = "sha256:b0a645a9156dc7cb5d3a1f0d4bab66db287fcb8e0430bdd4664a095ea16414ba"}, - {file = "tomlkit-0.12.3.tar.gz", hash = "sha256:75baf5012d06501f07bee5bf8e801b9f343e7aac5a92581f20f80ce632e6b5a4"}, -] - [[package]] name = "typer" version = "0.9.0" @@ -1688,4 +1432,4 @@ test = ["covdefaults (>=2.3)", "coverage (>=7.2.7)", "coverage-enable-subprocess [metadata] lock-version = "2.0" python-versions = "^3.9" -content-hash = "0c7ec3d5e1be31b3476dffdda2bb836b1a5400990ff9e230dadfc5bf60ef9bd2" +content-hash = "f903b650e3097b26e1e8f15c0a6722a39f3284251961c6b30e2d133ed4667da5" diff --git a/pyproject.toml b/pyproject.toml index 2ad8fca..1f22cdc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,17 +41,11 @@ pandas = "^2.0.0" requests = "^2.31.0" [tool.poetry.dev-dependencies] -bandit = "^1.7.5" -black = {version = "^24.0.0", allow-prereleases = true} darglint = "^1.8.1" -isort = {extras = ["colors"], version = "^5.13.2"} mypy = "^1.8" mypy-extensions = "^1.0.0" pre-commit = "^3.6.0" -pydocstyle = "^6.3.0" -pylint = "^3.0.0" pytest = "^8.0.1" -pyupgrade = "^3.4.0" safety = "^3.0.1" coverage = "^7.3.4" coverage-badge = "^1.1.0" @@ -59,55 +53,46 @@ pytest-html = "^4.1.1" pytest-cov = "^4.0.0" [tool.poetry.group.dev.dependencies] -bandit = "^1.7.4" darglint = "^1.8.1" -isort = {extras = ["colors"], version = "^5.12.0"} mypy = "^1.3" pre-commit = ">=2.20,<4.0" -pydocstyle = "^6.3.0" -pylint = "^3.0.0" pytest = ">=7.3.1,<9.0.0" -pyupgrade = "^3.4.0" safety = ">=2.3.5,<4.0.0" coverage = ">=6.5,<8.0" coverage-badge = "^1.1.0" pytest-html = ">=3.2,<5.0" pytest-cov = "^4.0.0" -[tool.black] -# https://github.com/psf/black -target-version = ["py39"] + +[tool.ruff] +target-version = "py39" line-length = 120 -color = true - -exclude = ''' -/( - \.git - | \.hg - | \.mypy_cache - | \.tox - | \.venv - | _build - | buck-out - | build - | dist - | env - | venv -)/ -''' - -[tool.isort] -# https://github.com/timothycrosley/isort/ -py_version = 39 -line_length = 120 - -known_typing = ["typing", "types", "typing_extensions", "mypy", "mypy_extensions"] -sections = ["FUTURE", "TYPING", "STDLIB", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"] -include_trailing_comma = true -profile = "black" -multi_line_output = 3 -indent = 4 -color_output = true +# Enable Pyflakes `E` and `F` codes by default. +lint.select = [ + "E", "W", # see: https://pypi.org/project/pycodestyle + "F", # see: https://pypi.org/project/pyflakes + "I", # isort + "D", # see: https://pypi.org/project/pydocstyle + "UP", # pyupgrade + "S", # bandit +] + +[tool.ruff.lint.per-file-ignores] +"github_dependents_info/**" = [ + "D100", # todo + "D101", # todo + "D102", # todo + "D103", # todo + "D107", # todo + "D205", # todo +] +"tests/**" = [ + "D103", + "D104", + "D400", + "D415", + "S101", +] [tool.mypy] # https://mypy.readthedocs.io/en/latest/config_file.html#using-a-pyproject-toml-file