Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
157 changes: 122 additions & 35 deletions config/ruff.toml
Original file line number Diff line number Diff line change
@@ -1,53 +1,105 @@


target-version = "py39"
output-format = "full"
line-length = 99
fix = true
include = [
"src/readii/loaders.py",
"src/readii/feature_extraction.py"
]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Inconsistent inclusion and exclusion of src/readii/loaders.py

The file src/readii/loaders.py is listed in both the include and extend-exclude sections. This may result in the file being excluded from linting even though it's explicitly included.

Consider removing src/readii/loaders.py from the extend-exclude section to ensure it is linted as intended.

Also applies to: 13-13



# extend-exclude is used to exclude directories from the flake8 checks
extend-exclude = [
"docs/*",
"tests/*",
".pixi/",
]

"src/readii/image_processing.py",
"src/readii/loaders.py",
"src/readii/metadata.py",
"src/readii/negative_controls.py",
"src/readii/pipeline.py",
]

extend-include = []
# Same as Black.
line-length = 100

include = [
"src/readii/loaders.py"
]

[lint]
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
# McCabe complexity (`C901`) by default.

select = [
"E",
###########################################################################
# TYPE ANNOTATIONS
# Ensure all functions have type annotations
# https://docs.astral.sh/ruff/rules/#flake8-annotations-ann
"ANN",
# Use type hinting consistently
# https://docs.astral.sh/ruff/rules/#flake8-type-checking-tch
"TCH",

###########################################################################
# IMPORTS
# Sort imports naturally
# https://docs.astral.sh/ruff/rules/#isort-i
"I",
# Follow import conventions
# https://docs.astral.sh/ruff/rules/#flake8-import-conventions-icn
"ICN",
# Clean up and organize imports
# https://docs.astral.sh/ruff/rules/#flake8-tidy-imports-tid
"TID",

###########################################################################
# CODE QUALITY
# Detect possible bugs, like unused variables or exception handling issues
# https://docs.astral.sh/ruff/rules/#flake8-bugbear-b
"B",
# Avoid using Python builtins incorrectly
# https://docs.astral.sh/ruff/rules/#flake8-builtins-a
"A",
# Enforce correct usage of commas in lists, tuples, etc.
# https://docs.astral.sh/ruff/rules/#flake8-commas-com
"COM",
# Prevent use of debugging code, like breakpoints
# https://docs.astral.sh/ruff/rules/#flake8-debugger-t10
"T10",
# Disallow print statements
# https://docs.astral.sh/ruff/rules/#flake8-print-t20
"T20",
# Provide clear and explanatory error messages
# https://docs.astral.sh/ruff/rules/#flake8-errmsg-em
"EM",

###########################################################################
# STANDARDS & STYLE
# Prefer pathlib for path manipulation
# https://docs.astral.sh/ruff/rules/#flake8-use-pathlib-pth
"PTH",
# Adhere to Pylint conventions
# https://docs.astral.sh/ruff/rules/#pylint-pl
"PL",
# Simplify code to reduce complexity
# https://docs.astral.sh/ruff/rules/#flake8-simplify-sim
"SIM",
# errors like undefined names and unused imports without enforcing style rules.
# https://docs.astral.sh/ruff/rules/#pyflakes-f
"F",
"W", # flake8
"C", # mccabe
"I", # isort
"D", # pydocstyle
# "N", # pep8-naming
"ANN", # flake8-annotations
"BLE", # flake8-blind-except
"B", # flake8-bugbear
"A", # flake8-builtins
# "G", # flake8-logging-format
"ERA", # eradicate
"RUF", # Ruff-specific rules
"TCH", # flake8-type-checking
]
ignore = ["ANN101"]


[lint.per-file-ignores]
"tests/*" = ["S101"]

# Pydocstyle
# https://docs.astral.sh/ruff/rules/#pydocstyle-d
# "D",
]

[lint.mccabe]
max-complexity = 10

ignore = [
# allow self to not need type annotations
"ANN101",
# Allow too many arguments for functions
"PLR0913",
# Public Module Docstrings
"D100",
# Ignored because https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules
"COM812", # https://docs.astral.sh/ruff/rules/missing-trailing-comma/#missing-trailing-comma-com812
"D206",
]

[lint.isort]
known-first-party = ["readii"]
Expand All @@ -56,12 +108,47 @@ combine-as-imports = true
lines-after-imports = 1
relative-imports-order = "closest-to-furthest"

[lint.mccabe]
max-complexity = 10


[lint.per-file-ignores]
"tests/*" = ["S101"]


[lint.pydocstyle]
convention = "numpy"



[format]

quote-style = "double"
indent-style = "tab"
docstring-code-format = true
docstring-code-line-length = 20
docstring-code-line-length = 20


# [lint] # commented for now, will iterate on this later
# select = [
# "E",
# "F",
# "W", # flake8
# "C", # mccabe
# "I", # isort
# "D", # pydocstyle
# # "N", # pep8-naming
# "ANN", # flake8-annotations
# "BLE", # flake8-blind-except
# "B", # flake8-bugbear
# "A", # flake8-builtins
# # "G", # flake8-logging-format
# "ERA", # eradicate
# "RUF", # Ruff-specific rules
# "TCH", # flake8-type-checking
# ]
# ignore = ["ANN101"]

# Readii uses a lot of camelcase so ignoring pep-8 conventions.
# https://docs.astral.sh/ruff/rules/#pep8-naming-n
# "N",
Loading
Loading