Skip to content

Commit

Permalink
added linting to pre-commit hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
Adeemy committed Jul 1, 2024
1 parent 90a364a commit 2bf18a1
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 10 deletions.
1 change: 0 additions & 1 deletion .devcontainer/setup_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ python3 -m venv .venv
echo 'source .venv/bin/activate' >> ~/.bashrc
pip install --upgrade pip
pip install -r requirements.txt
pre-commit install

# To remove the deprecation warning from jupyter_client when running tests
touch pytest.ini
Expand Down
19 changes: 18 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,25 @@ repos:
hooks:
- id: isort
args: ["--profile", "black", "--filter-files"]

- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.4.2
hooks:
- id: black
language_version: python3.10
language_version: python3.10

- repo: local
hooks:
- id: pylint
name: pylint
entry: pylint
language: system
types: [python]
args: [
./src,
./tests, # Directories to lint
"-rn", # Only display messages
"--rcfile=.pylintrc", # Link to your config file
"--disable=R,C,E0401,E0110,I1101,W0718,W9008",
"--load-plugins=pylint.extensions.docparams", # Load an extension
]
13 changes: 6 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,17 @@ update_reqs:
PIP_CACHE_DIR ?= $(HOME)/.cache/pip
install:
pip install --upgrade pip &&\
pip install black[jupyter] pytest pylint isort pytest-cov pytest-mock &&\
pip install black[jupyter] pytest pylint isort pytest-cov pytest-mock pre-commit &&\
pip install --cache-dir $(PIP_CACHE_DIR) -r requirements.txt

pre-commit:
pre-commit install --hook-type pre-commit --hook-type pre-merge-commit

isort:
isort --profile black ./notebooks
isort --profile black ./src
isort --profile black ./tests
isort --profile black --filter-files ./notebooks ./src ./tests

format:
black ./notebooks
black ./src
black ./tests
black ./notebooks ./src ./tests

test:
coverage run -m pytest -vvv
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ optuna_distributed==0.6.1
pandas==1.5.3
plotly==5.18.0
polars==0.20.10
pre-commit==3.6.2
pytest==7.4.4
python-dotenv==1.0.1
PyYAML==6.0.1
Expand Down

0 comments on commit 2bf18a1

Please sign in to comment.