Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
11 changes: 11 additions & 0 deletions .github/workflows/mkdocs-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: MkDocs Build (RationAI Standard)
on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
workflow_dispatch:

jobs:
run:
uses: RationAI/.github/.github/workflows/mkdocs-build.yml@main
11 changes: 11 additions & 0 deletions .github/workflows/python-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Python Lint (RationAI Standard)
on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
workflow_dispatch:

jobs:
run:
uses: RationAI/.github/.github/workflows/python-lint.yml@main
9 changes: 0 additions & 9 deletions .gitlab-ci.yml

This file was deleted.

6 changes: 6 additions & 0 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
MD013: false # Line length
MD023: false # Heading start left
MD024: false # Duplicate headings
MD033: false # Inline HTML
MD041: false # First line in file should be a top level heading
MD046: false # Fenced code blocks
6 changes: 5 additions & 1 deletion .mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@ strict = True
ignore_missing_imports = True
disallow_untyped_calls = False
disable_error_code = no-any-return
explicit_package_bases = True
explicit_package_bases = True

# Ignore type errors in the external piqe.py file
[mypy-rationai.qc.blur.piqe]
ignore_errors = True
7 changes: 3 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,15 @@ repos:
args: [--unsafe]

- repo: https://github.com/commitizen-tools/commitizen
rev: v4.8.3
rev: v4.10.0
hooks:
- id: commitizen

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.12.10
rev: v0.14.10
hooks:
# Run the linter.
- id: ruff
entry: pdm lint --force-exclude
args: [--fix]
# Run the formatter.
- id: ruff-format
Comment on lines 17 to 22

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

tmp="$(mktemp -d)"
trap 'rm -rf "$tmp"' EXIT

python -m pip install --quiet "ruff==0.14.10"

cat >"$tmp/.ruff.toml" <<'EOF'
extend-exclude = ["excluded.py"]
EOF

cat >"$tmp/excluded.py" <<'EOF'
import os
EOF

cd "$tmp"

echo "ruff check without --force-exclude"
python -m ruff check --config .ruff.toml excluded.py || true

echo
echo "ruff check with --force-exclude"
python -m ruff check --force-exclude --config .ruff.toml excluded.py || true

echo
echo "ruff format without --force-exclude"
python -m ruff format --check --config .ruff.toml excluded.py || true

echo
echo "ruff format with --force-exclude"
python -m ruff format --check --force-exclude --config .ruff.toml excluded.py || true

Repository: RationAI/quality-control

Length of output: 752


🏁 Script executed:

git ls-files | grep -E "(\.ruff\.toml|\.pre-commit-config\.yaml|piqe\.py)" | head -20

Repository: RationAI/quality-control

Length of output: 163


🏁 Script executed:

cat -n .ruff.toml | head -20

Repository: RationAI/quality-control

Length of output: 640


🏁 Script executed:

cat -n .pre-commit-config.yaml | sed -n '15,25p'

Repository: RationAI/quality-control

Length of output: 321


Add --force-exclude to both Ruff hooks to ensure the excluded vendored file is not linted or formatted.

Pre-commit passes staged files explicitly to Ruff, which bypasses extend-exclude patterns in .ruff.toml without the --force-exclude flag. This can cause the excluded piqe.py file to be checked and formatted unexpectedly.

Suggested change
      - id: ruff
        args: [--fix, --force-exclude]
      # Run the formatter.
      - id: ruff-format
+        args: [--force-exclude]
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
hooks:
# Run the linter.
- id: ruff
entry: pdm lint --force-exclude
args: [--fix]
# Run the formatter.
- id: ruff-format
hooks:
# Run the linter.
- id: ruff
args: [--fix, --force-exclude]
# Run the formatter.
- id: ruff-format
args: [--force-exclude]
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.pre-commit-config.yaml around lines 17 - 22, Update the ruff and
ruff-format pre-commit hooks to pass the --force-exclude flag so excluded
vendored files (e.g., piqe.py) are not linted or formatted; specifically, add
--force-exclude to the args array for the hook with id "ruff" (currently args:
[--fix]) and add --force-exclude to the hook with id "ruff-format" so both hooks
honor .ruff.toml exclude patterns even when pre-commit passes staged files
explicitly.

entry: pdm format --force-exclude
8 changes: 5 additions & 3 deletions .ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ fix = true
line-length = 88
target-version = "py311"

extend-exclude = ["rationai/qc/blur/piqe.py"]

[format]
# Enable reformatting of code snippets in docstrings.
docstring-code-format = true
Expand All @@ -20,10 +22,10 @@ extend-select = [
"PGH", # pygrep
"RUF", # ruff checks
"SIM", # flake8-simplify
"TCH", # flake8-type-checking
"TC", # flake8-type-checking
"TID", # flake8-tidy-imports
"UP", # pyupgrade
"D", # pydocstyle
"D", # pydocstyle
]
extend-ignore = [
"ERA001", # commented out code
Expand All @@ -36,7 +38,7 @@ extend-ignore = [
"D106", # missing docstring in public nested class
"D107", # missing docstring in __init__
"N812", # lowercase imported as non lowercase
"TCH002", # move third-party into a type-checking block
"TC002", # move third-party into a type-checking block
"F722", # jaxtyping
]

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ for QC methods** developed at RationAI. These functions are meant to be run on s
regions and they **offer a straightforward and well-documented access** to the key parts
of the complete QC methods to allow for easier debugging and experimenting.

TODO: Add link to mkdocs documentation
TODO: Add link to mkdocs documentation

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Don't ship a literal TODO in the published README.

README.md is also the project readme in pyproject.toml, Line 12, so this placeholder will show up anywhere the package metadata is rendered.

If you want, I can draft the final docs-link line once the MkDocs URL is settled.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@README.md` at line 8, Remove the literal "TODO: Add link to mkdocs
documentation" from README.md and replace it with a real documentation link or a
neutral placeholder that won't be published (e.g., "Documentation:
https://docs.example.com" or "Documentation: link to be added"); ensure the same
README referenced by pyproject.toml (line 12) no longer contains the TODO string
so package metadata renders cleanly. Locate the README.md line that contains the
TODO and update the markdown to either the final MkDocs URL or a non-TODO
placeholder; if the URL is not yet available, use a clear placeholder like
"Documentation: link to be added" instead of "TODO".

1,712 changes: 0 additions & 1,712 deletions pdm.lock

This file was deleted.

29 changes: 11 additions & 18 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,37 +1,30 @@
[project]
name = "rationai-qc"
version = "1.0.0"
version = "1.0.1"
description = ""
authors = [
{ name = "Tomáš Balák", email = "tomasbalak@mail.muni.cz" },
{ name = "Erik Sedlák", email = "521008@mail.muni.cz" },
{ name = "Tomáš Balák", email = "525126@mail.muni.cz" },
{ name = "Samuel Tichý", email = "524626@mail.muni.cz" },
{ name = "Karel Štěpka", email = "chuckie@mail.muni.cz" },
]
requires-python = ">=3.11"
readme = "README.md"
license = { file = "LICENSE" }

dependencies = [
"scikit-image>=0.24.0",
"pyvips>=2.2.3",
"rationai-staining @ git+https://gitlab.ics.muni.cz/rationai/digital-pathology/libraries/staining.git",
"opencv-python>=4.10.0.84",
"rationai-masks @ git+https://gitlab.ics.muni.cz/rationai/digital-pathology/libraries/masks.git",
"rationai-staining @ git+https://gitlab.ics.muni.cz/rationai/digital-pathology/libraries/staining.git",
Comment thread
TomasBalak marked this conversation as resolved.
]

[tool.pdm.dev-dependencies]
[dependency-groups]
dev = ["mypy", "pre-commit", "ruff"]
test = ["pytest", "pytest-cov"]
docs = ["mkdocs-material>=9.5.32", "mkdocstrings[python]>=0.25.2"]

[tool.pdm.scripts]
l = { composite = ["lint", "format", "mypy"] }
test = "pytest tests"
lint = "ruff check --fix"
format = "ruff format"
mypy = "mypy ."
docs = "mkdocs serve"
post_install = { composite = [
"pre-commit autoupdate",
"pre-commit install",
"pre-commit install --hook-type commit-msg",
] }
docs = [
"mkdocs-material>=9.5.32",
"mkdocstrings[python]>=0.25.2",
"pymdown-extensions>=10.20.1",
]
Loading
Loading