diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..73da038c --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,55 @@ +--- +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks + +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v5.0.0 + hooks: + - id: check-added-large-files + - id: check-ast + - id: check-builtin-literals + - id: check-docstring-first + - id: check-executables-have-shebangs + - id: check-merge-conflict + - id: check-symlinks + - id: check-json + - id: check-toml + - id: check-yaml + - id: debug-statements + - id: end-of-file-fixer + - id: mixed-line-ending + - id: name-tests-test + - id: requirements-txt-fixer + - id: trailing-whitespace + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.11.2 # ruff version + hooks: + - id: ruff # linter + args: ["--fix"] + - id: ruff-format # formatter + - repo: https://github.com/asottile/pyupgrade + rev: v3.19.1 + hooks: + - id: pyupgrade + args: ["--py310-plus"] + - repo: https://github.com/shellcheck-py/shellcheck-py + rev: v0.10.0.1 + hooks: + - id: shellcheck + - repo: https://github.com/google/yamlfmt + rev: v0.16.0 + hooks: + - id: yamlfmt + - repo: https://github.com/adrienverge/yamllint + rev: v1.36.2 + hooks: + - id: yamllint + - repo: https://github.com/pre-commit/mirrors-clang-format + rev: v18.1.3 # clang-format version + hooks: + - id: clang-format + - repo: https://github.com/cpplint/cpplint + rev: 2.0.0 + hooks: + - id: cpplint diff --git a/.pylintrc b/.pylintrc new file mode 100644 index 00000000..fd8806b4 --- /dev/null +++ b/.pylintrc @@ -0,0 +1,34 @@ +[FORMAT] +indent-string=' ' +max-line-length=120 + +[BASIC] +variable-rgx=(?:(?P[a-z_]+)) + +[TYPECHECK] +generated-members=RdBu + +[DESIGN] +max-args=10 +max-locals=40 + +[MESSAGES CONTROL] +disable= + useless-suppression, + too-few-public-methods, + too-many-arguments, + too-many-branches, + too-many-instance-attributes, + too-many-lines, + too-many-locals, + too-many-nested-blocks, + too-many-positional-arguments, + too-many-public-methods, + too-many-return-statements, + too-many-statements + +[MISCELLANEOUS] +notes=FIXME,XXX + +[IMPORTS] +ignored-modules=ROOT,yaml,pandas,numpy,shap,uproot diff --git a/.yamlfmt.yml b/.yamlfmt.yml new file mode 100644 index 00000000..3553080f --- /dev/null +++ b/.yamlfmt.yml @@ -0,0 +1,15 @@ +--- +# yamlfmt configuration +# Reference: https://github.com/google/yamlfmt/blob/main/docs/config-file.md#configuration-1 + +formatter: + type: basic + indent: 2 + include_document_start: true + line_ending: lf + retain_line_breaks_single: true + max_line_length: -1 + drop_merge_tag: true + pad_line_comments: 1 + trim_trailing_whitespace: true + eof_newline: true diff --git a/.yamllint.yml b/.yamllint.yml new file mode 100644 index 00000000..d0af0342 --- /dev/null +++ b/.yamllint.yml @@ -0,0 +1,15 @@ +--- +# yamllint configuration +# Reference: https://yamllint.readthedocs.io/en/stable/rules.html + +extends: default +rules: + line-length: + max: 120 + level: warning + indentation: + spaces: 2 + level: warning + comments: + require-starting-space: true + min-spaces-from-content: 1 diff --git a/README.md b/README.md index 5eaa0872..c46402fd 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # Run 3 validation framework -[![GitHub MegaLinter](https://github.com/AliceO2Group/Run3Analysisvalidation/workflows/MegaLinter/badge.svg?branch=master)](https://github.com/marketplace/actions/megalinter) +[![MegaLinter](https://github.com/AliceO2Group/Run3Analysisvalidation/workflows/MegaLinter/badge.svg?branch=master)](https://github.com/AliceO2Group/Run3Analysisvalidation/actions?query=workflow%3AMegaLinter+branch%3Amaster) +[![pre-commit.ci](https://results.pre-commit.ci/badge/github/AliceO2Group/Run3AnalysisValidation/master.svg)](https://results.pre-commit.ci/latest/github/AliceO2Group/Run3AnalysisValidation/master) ## Introduction diff --git a/pyproject.toml b/pyproject.toml index edc61be3..1f5b7f63 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,12 +1,30 @@ -[tool.black] -line-length = 120 - -[tool.isort] -profile = "black" - [tool.pyright] reportMissingImports = false reportUnboundVariable = false [tool.ruff] line-length = 120 + +[tool.ruff.lint] +select = [ # defaults: ["E4", "E7", "E9", "F"], see https://docs.astral.sh/ruff/rules/ + "A", # flake8-builtins + "ARG", # flake8-unused-arguments + "B", # flake8-bugbear + "C4", # flake8-comprehensions + "E", # pycodestyle Error + "F", # Pyflakes + "FLY", # flynt + "FURB", # refurb + "I", # isort + "NPY", # NumPy-specific rules + "PD", # pandas-vet + "PL", # Pylint + "RUF", # Ruff-specific rules + "SIM", # flake8-simplify + "UP", # pyupgrade + "W", # pycodestyle Warning +] +ignore = [ + "PD901", # pandas-df-variable-name + "PLR09", # too-many-... +]