From 28d55aaf52ca62c6d97a8b9125ad6bae9c2d3aac Mon Sep 17 00:00:00 2001 From: Ilyes Batatia <48651863+ilyes319@users.noreply.github.com> Date: Tue, 23 Apr 2024 20:53:42 +0100 Subject: [PATCH] add pylint to pre-commit --- .pre-commit-config.yaml | 71 ++++++++++++++++++++----------------- mace/cli/run_train.py | 2 +- mace/tools/scripts_utils.py | 4 +-- 3 files changed, 41 insertions(+), 36 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 32319396..ae573d90 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,9 +1,17 @@ +exclude: &exclude_files > + (?x)^( + docs/.*| + tests/.*| + .github/.*| + LICENSE| + )$ + repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v2.5.0 hooks: - - id: end-of-file-fixer - - id: trailing-whitespace + - id: mixed-line-ending + - id: trailing-whitespace - repo: https://github.com/psf/black-pre-commit-mirror rev: 23.12.1 @@ -17,34 +25,31 @@ repos: - id: isort name: Sort imports - # Failing - to be investigated separately - # - repo: local - # hooks: - # - id: pylint - # name: Pylint Checks - # entry: pylint - # language: system - # types: [python] - # args: - # [ - # "--rcfile=pyproject.toml", - # "mace", - # "tests", - # "scripts" - # ] - - # - repo: local - # hooks: - # - id: mypy - # name: mypy type checks - # entry: mypy - # language: system - # types: [python] - # args: - # [ - # --config-file=.mypy.ini, - # mace, - # tests, - # scripts - # ] + - repo: https://github.com/PyCQA/pylint + rev: pylint-2.5.2 + hooks: + - id: pylint + language: system + args: [ + '--disable=line-too-long', + '--disable=no-member', + '--disable=missing-module-docstring', + '--disable=missing-class-docstring', + '--disable=missing-function-docstring', + '--disable=too-many-arguments', + '--disable=too-many-locals', + '--disable=not-callable', + '--disable=logging-fstring-interpolation', + '--disable=logging-not-lazy', + '--disable=invalid-name', + '--disable=too-few-public-methods', + '--disable=too-many-instance-attributes', + '--disable=too-many-statements', + '--disable=too-many-branches', + '--disable=import-outside-toplevel', + '--disable=cell-var-from-loop', + '--disable=duplicate-code', + ] + exclude: *exclude_files + \ No newline at end of file diff --git a/mace/cli/run_train.py b/mace/cli/run_train.py index 050e896a..d1957dea 100644 --- a/mace/cli/run_train.py +++ b/mace/cli/run_train.py @@ -823,7 +823,7 @@ def main() -> None: path_complied, _extra_files=extra_files, ) - except Exception as e: # pylint: disable=W070344 + except Exception as e: # pylint: disable=W0703 pass if args.distributed: diff --git a/mace/tools/scripts_utils.py b/mace/tools/scripts_utils.py index 756627ad..17630bf3 100644 --- a/mace/tools/scripts_utils.py +++ b/mace/tools/scripts_utils.py @@ -388,9 +388,9 @@ def step(self, metrics=None, epoch=None): # pylint: disable=E1123 if self.scheduler == "ExponentialLR": self.lr_scheduler.step(epoch=epoch) elif self.scheduler == "ReduceLROnPlateau": - self.lr_scheduler.step( + self.lr_scheduler.step( # pylint: disable=E1123 metrics=metrics, epoch=epoch - ) # pylint: disable=E1123 + ) def __getattr__(self, name): if name == "step":