Skip to content

Commit

Permalink
Merge pull request #8 from daniel-code/feat/ruff
Browse files Browse the repository at this point in the history
Feat/ruff
  • Loading branch information
daniel-code authored Apr 8, 2023
2 parents 20dd212 + 2f7a19a commit 29f1e56
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 14 deletions.
4 changes: 3 additions & 1 deletion tests/test_creation.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def verify_folders(root, config):
'reports/figures',
'scripts',
'shells',
'tests',
config['module_name'],
f"{config['module_name']}/data",
f"{config['module_name']}/models",
Expand Down Expand Up @@ -80,7 +81,7 @@ def verify_files(root, config):
".gitignore",
"README.md",
"setup.py",
".flake8",
"pyproject.toml",
".style.yapf",
".pre-commit-config.yaml",

Expand All @@ -96,6 +97,7 @@ def verify_files(root, config):
"scripts/train.py",
"scripts/evaluate.py",
"shells/train.sh",
"tests/__init__.py",
f"{config['module_name']}/__init__.py",
f"{config['module_name']}/data/__init__.py",
f"{config['module_name']}/models/__init__.py",
Expand Down
7 changes: 0 additions & 7 deletions {{ cookiecutter.repo_name }}/.flake8

This file was deleted.

10 changes: 5 additions & 5 deletions {{ cookiecutter.repo_name }}/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ repos:
hooks:
- id: yapf
entry: bash -c 'yapf "$@"; git add -u' --
- repo: https://gitlab.com/pycqa/flake8
rev: 3.7.3
- repo: https://github.com/charliermarsh/ruff-pre-commit
# Ruff version.
rev: 'v0.0.260'
hooks:
- id: flake8
args: ['--config=.flake8']
- id: ruff
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
rev: 'v4.4.0'
hooks:
- id: detect-private-key
- id: check-added-large-files
Expand Down
2 changes: 1 addition & 1 deletion {{ cookiecutter.repo_name }}/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ create_environment:
{% if cookiecutter.dependency_file != 'environment.yml' %}
conda create --name $(PROJECT_NAME) python=$(PYTHON_VERSION) -y
{% else -%}
conda env create --name $(PROJECT_NAME) python=$(PYTHON_VERSION) -f environment.yml
conda env create --name $(PROJECT_NAME) -f environment.yml
{% endif %}
@echo ">>> conda env created. Activate with:\nconda activate $(PROJECT_NAME)"
{% elif cookiecutter.environment_manager == 'virtualenv' -%}
Expand Down
22 changes: 22 additions & 0 deletions {{ cookiecutter.repo_name }}/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[tool.ruff]
# Enable pycodestyle (`E`) and Pyflakes (`F`) codes by default.
select = ["E", "F"]
ignore = []

# Allow autofix for all enabled rules (when `--fix`) is provided.
fixable = ["A", "B", "C", "D", "E", "F"]
unfixable = []


# Same as Black.
line-length = 120

# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"

# Assume Python 3.10.
target-version = "py310"

[tool.ruff.mccabe]
# Unlike Flake8, default to a complexity level of 10.
max-complexity = 10
Empty file.

0 comments on commit 29f1e56

Please sign in to comment.