Skip to content

Commit

Permalink
Add ruff files (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulf81 authored Dec 19, 2023
1 parent 1e9955a commit 0b11561
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/continuous-integration-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -e ".[develop]"
- uses: pre-commit/[email protected]
- name: Run tests and collect coverage
run: |
# -rA displays the captured output for all tests after they're run
Expand Down
26 changes: 26 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

repos:

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-executables-have-shebangs
- id: check-yaml
args: [--unsafe]
- id: check-merge-conflict
- id: check-symlinks
- id: mixed-line-ending

- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.1.7
hooks:
# Run the linter.
- id: ruff
types_or: [ python, pyi, jupyter ]
args: [ --fix ]
# Run the formatter.
- id: ruff-format
types_or: [ python, pyi, jupyter ]
79 changes: 79 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
[build-system]
requires = ["setuptools >= 40.6.0", "wheel"]
build-backend = "setuptools.build_meta"


[coverage.run]
# Coverage.py configuration file
# https://coverage.readthedocs.io/en/latest/config.html
branch = true
source = "whoc/*"
omit = [
"setup.py",
"tests/*"
]


[tool.pytest.ini_options]
testpaths = "tests"
filterwarnings = [
"ignore::DeprecationWarning:pandas.*:"
]


[tool.ruff]
src = ["whoc", "tests"]
line-length = 100
target-version = "py310"
extend-include = ["*.ipynb"]
ignore-init-module-imports = true

# See https://github.com/charliermarsh/ruff#supported-rules
# for rules included and matching to prefix.
select = ["E", "F", "I"]

# F401 unused-import: Ignore until all used isort flags are adopted in ruff
# ignore = ["F401"]

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

# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".hg",
".mypy_cache",
".nox",
".pants.d",
".ruff_cache",
".svn",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"venv",
]

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


[tool.ruff.isort]
combine-as-imports = true
known-first-party = ["flasc"]
order-by-type = false

# [tool.ruff.format]

[tool.ruff.per-file-ignores]
# Ignore `F401` (import violations) in all `__init__.py` files, and in `path/to/file.py`.
"__init__.py" = ["F401"]

0 comments on commit 0b11561

Please sign in to comment.