Skip to content

Commit

Permalink
add pylint to pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyes319 committed Apr 23, 2024
1 parent e6d1630 commit 28d55aa
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 36 deletions.
71 changes: 38 additions & 33 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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


2 changes: 1 addition & 1 deletion mace/cli/run_train.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions mace/tools/scripts_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down

0 comments on commit 28d55aa

Please sign in to comment.