Skip to content

Commit

Permalink
feat: bump code quality tooling
Browse files Browse the repository at this point in the history
Updates pre-commit, black, pylint, isort and prettier to current versions
  • Loading branch information
FabianScheidt committed Jul 2, 2024
1 parent 9c7848a commit b8e9fc5
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 37 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ default_install_hook_types: [pre-commit, commit-msg]
default_stages: [commit, manual]
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.6.0
hooks:
- id: check-added-large-files
args:
Expand All @@ -23,10 +23,10 @@ repos:
- manual
- id: requirements-txt-fixer
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
rev: v9.11.0
rev: v9.16.0
hooks:
- id: commitlint
additional_dependencies: ['@commitlint/config-conventional@18.6.2']
additional_dependencies: ['@commitlint/config-conventional@19.2.2']
pass_filenames: true
stages:
- commit-msg
Expand All @@ -52,7 +52,7 @@ repos:
language: system
types: [python]
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.7.1
rev: v3.1.0
hooks:
- id: prettier
stages:
Expand Down
38 changes: 30 additions & 8 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,11 @@ ignore-paths=
# Emacs file locks
ignore-patterns=^\.#

# 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.
# List of module names for which member attributes should not be checked and
# will not be imported (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=

# Python code to execute, usually for sys.path manipulation such as
Expand All @@ -86,13 +87,23 @@ load-plugins=
# Pickle collected data for later comparisons.
persistent=yes

# Resolve imports to .pyi stubs if available. May reduce no-member messages and
# increase not-an-iterable messages.
prefer-stubs=no

# Minimum Python version to use for version dependent checks. Will default to
# the version used to run pylint.
py-version=3.10

# Discover python modules and packages in the file system subtree.
recursive=no

# Add paths to the list of the source roots. Supports globbing patterns. The
# source root is an absolute path or a path relative to the current working
# directory used to determine a package namespace for modules located under the
# source root.
source-roots=

# When enabled, pylint would attempt to guess common misconfiguration and emit
# user-friendly hints instead of false-positive error messages.
suggestion-mode=yes
Expand Down Expand Up @@ -229,6 +240,10 @@ no-docstring-rgx=^_
# These decorators are taken in consideration only for invalid-name.
property-classes=abc.abstractproperty

# Regular expression matching correct type alias names. If left empty, type
# alias names will be checked with the set naming style.
#typealias-rgx=

# Regular expression matching correct type variable names. If left empty, type
# variable names will be checked with the set naming style.
#typevar-rgx=
Expand All @@ -251,6 +266,7 @@ check-protected-access-in-special-methods=no
defining-attr-methods=__init__,
__new__,
setUp,
asyncSetUp,
__post_init__

# List of member names, which should be excluded from the protected access
Expand Down Expand Up @@ -483,6 +499,11 @@ max-nested-blocks=5
# printed.
never-returning-functions=sys.exit,argparse.parse_error

# Let 'consider-using-join' be raised when the separator to join on would be
# non-empty (resulting in expected fixes of the type: ``"- " + " -
# ".join(items)``)
suggest-join-with-non-empty-separator=yes


[REPORTS]

Expand All @@ -497,8 +518,9 @@ evaluation=max(0, 0 if fatal else 10.0 - ((float(5 * error + warning + refactor
# 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, e.g.
# Set the output format. Available formats are: text, parseable, colorized,
# json2 (improved json format), json (old json format) and msvs (visual
# studio). You can also give a reporter class, e.g.
# mypackage.mymodule.MyReporterClass.
#output-format=

Expand Down Expand Up @@ -532,8 +554,8 @@ min-similarity-lines=4
# Limits count of emitted suggestions for spelling mistakes.
max-spelling-suggestions=4

# Spelling dictionary name. Available dictionaries: none. To make it work,
# install the 'python-enchant' package.
# Spelling dictionary name. No available dictionaries : You need to install
# both the python package and the system dependency for enchant to work.
spelling-dict=

# List of comma separated words that should be considered directives if they
Expand Down
6 changes: 3 additions & 3 deletions environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ name: data-science-project-template
channels:
- conda-forge
dependencies:
- black=23.1.0
- black=24.4.2
- python=3.10.9
- pre-commit=3.0.4
- pylint=2.16.1
- pre-commit=3.7.1
- pylint=3.2.5
- pytest=7.2.1
- cookiecutter=2.1.1
- pytest=7.2.1
15 changes: 5 additions & 10 deletions {{cookiecutter.repo_name}}/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ default_install_hook_types: [pre-commit, commit-msg]
default_stages: [commit, manual]
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.6.0
hooks:
- id: check-added-large-files
args:
Expand All @@ -25,15 +25,15 @@ repos:
- manual
- id: requirements-txt-fixer
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
rev: v9.11.0
rev: v9.16.0
hooks:
- id: commitlint
additional_dependencies: ['@commitlint/config-conventional']
additional_dependencies: ['@commitlint/config-conventional@19.2.2']
pass_filenames: true
stages:
- commit-msg
- repo: https://github.com/pycqa/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
name: isort (python)
Expand All @@ -48,11 +48,6 @@ repos:
args: [--config=./pyproject.toml]
language: system
types: [python]
- id: nbqa-black
name: nbqa-black
entry: nbqa black
language: system
files: \.ipynb
- id: pylint
name: pylint
entry: pylint
Expand All @@ -67,7 +62,7 @@ repos:
- --disable=pointless-statement,duplicate-code,expression-not-assigned
- --const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__)|([a-z_][a-z0-9_]{0,50}))$
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.7.1
rev: v3.1.0
hooks:
- id: prettier
stages:
Expand Down
38 changes: 30 additions & 8 deletions {{cookiecutter.repo_name}}/.pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,11 @@ ignore-paths=
# Emacs file locks
ignore-patterns=^\.#

# 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.
# List of module names for which member attributes should not be checked and
# will not be imported (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=

# Python code to execute, usually for sys.path manipulation such as
Expand All @@ -86,13 +87,23 @@ load-plugins=
# Pickle collected data for later comparisons.
persistent=yes

# Resolve imports to .pyi stubs if available. May reduce no-member messages and
# increase not-an-iterable messages.
prefer-stubs=no

# Minimum Python version to use for version dependent checks. Will default to
# the version used to run pylint.
py-version=3.10

# Discover python modules and packages in the file system subtree.
recursive=no

# Add paths to the list of the source roots. Supports globbing patterns. The
# source root is an absolute path or a path relative to the current working
# directory used to determine a package namespace for modules located under the
# source root.
source-roots=

# When enabled, pylint would attempt to guess common misconfiguration and emit
# user-friendly hints instead of false-positive error messages.
suggestion-mode=yes
Expand Down Expand Up @@ -229,6 +240,10 @@ no-docstring-rgx=^_
# These decorators are taken in consideration only for invalid-name.
property-classes=abc.abstractproperty

# Regular expression matching correct type alias names. If left empty, type
# alias names will be checked with the set naming style.
#typealias-rgx=

# Regular expression matching correct type variable names. If left empty, type
# variable names will be checked with the set naming style.
#typevar-rgx=
Expand All @@ -251,6 +266,7 @@ check-protected-access-in-special-methods=no
defining-attr-methods=__init__,
__new__,
setUp,
asyncSetUp,
__post_init__

# List of member names, which should be excluded from the protected access
Expand Down Expand Up @@ -483,6 +499,11 @@ max-nested-blocks=5
# printed.
never-returning-functions=sys.exit,argparse.parse_error

# Let 'consider-using-join' be raised when the separator to join on would be
# non-empty (resulting in expected fixes of the type: ``"- " + " -
# ".join(items)``)
suggest-join-with-non-empty-separator=yes


[REPORTS]

Expand All @@ -497,8 +518,9 @@ evaluation=max(0, 0 if fatal else 10.0 - ((float(5 * error + warning + refactor
# 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, e.g.
# Set the output format. Available formats are: text, parseable, colorized,
# json2 (improved json format), json (old json format) and msvs (visual
# studio). You can also give a reporter class, e.g.
# mypackage.mymodule.MyReporterClass.
#output-format=

Expand Down Expand Up @@ -532,8 +554,8 @@ min-similarity-lines=4
# Limits count of emitted suggestions for spelling mistakes.
max-spelling-suggestions=4

# Spelling dictionary name. Available dictionaries: none. To make it work,
# install the 'python-enchant' package.
# Spelling dictionary name. No available dictionaries : You need to install
# both the python package and the system dependency for enchant to work.
spelling-dict=

# List of comma separated words that should be considered directives if they
Expand Down
8 changes: 4 additions & 4 deletions {{cookiecutter.repo_name}}/environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ name: '{{cookiecutter.env_name}}'
channels:
- conda-forge
dependencies:
- black=23.1.0
- nbqa=1.6.1
- black=24.4.2
- nbqa=1.8.5
{%- if cookiecutter.install_jupyter == 'yes' %}
- jupyter=1.0.0
{%- endif %}
- python=3.10.9
- pre-commit=3.0.4
- pylint=2.16.1
- pre-commit=3.7.1
- pylint=3.2.5

0 comments on commit b8e9fc5

Please sign in to comment.