Skip to content

Conversation

@Borda
Copy link
Contributor

@Borda Borda commented Jan 13, 2026

This pull request updates the project's linting configuration by removing the standalone yesqa pre-commit hook and enabling the equivalent rule in ruff. This streamlines the code quality checks and reduces dependency complexity.

Linting configuration updates:

  • Removed the yesqa hook from .pre-commit-config.yaml, eliminating the need for its additional dependencies and exclusions.
  • Enabled the RUF100 rule in the pyproject.toml configuration for ruff, which provides the same functionality as yesqa for identifying unused noqa comments.

Signed-off-by: jirka <jirka.borovec@seznam.cz>
Copilot AI review requested due to automatic review settings January 13, 2026 08:42
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 13, 2026

📝 Walkthrough

Walkthrough

The pull request removes the yesqa pre-commit hook from the configuration and replaces it with Ruff's RUF100 rule in pyproject.toml. Associated noqa comments no longer needed are removed from multiple files. All changes are lint-related with no runtime behavior modifications.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The PR description explains the changes well and covers the main updates. However, it lacks the required template structure with sections like 'Fixes #', 'Types of changes', and test verification checkboxes. Add the standard template sections including issue reference, types of changes checkboxes, and test verification status to match repository conventions.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: replacing the yesqa pre-commit hook with Ruff's RUF100 rule, which is the core objective of this PR.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between 57fdd59 and c04bb14.

📒 Files selected for processing (5)
  • .pre-commit-config.yaml
  • monai/apps/nnunet/nnunetv2_runner.py
  • monai/utils/profiling.py
  • pyproject.toml
  • tests/runner.py
💤 Files with no reviewable changes (1)
  • .pre-commit-config.yaml
🧰 Additional context used
📓 Path-based instructions (1)
**/*.py

⚙️ CodeRabbit configuration file

Review the Python code for quality and correctness. Ensure variable names adhere to PEP8 style guides, are sensible and informative in regards to their function, though permitting simple names for loop and comprehension variables. Ensure routine names are meaningful in regards to their function and use verbs, adjectives, and nouns in a semantically appropriate way. Docstrings should be present for all definition which describe each variable, return value, and raised exception in the appropriate section of the Google-style of docstrings. Examine code for logical error or inconsistencies, and suggest what may be changed to addressed these. Suggest any enhancements for code improving efficiency, maintainability, comprehensibility, and correctness. Ensure new or modified definitions will be covered by existing or new unit tests.

Files:

  • tests/runner.py
  • monai/apps/nnunet/nnunetv2_runner.py
  • monai/utils/profiling.py
🧬 Code graph analysis (1)
monai/apps/nnunet/nnunetv2_runner.py (1)
monai/apps/nnunet/utils.py (1)
  • NNUNETMode (31-35)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (19)
  • GitHub Check: min-dep-os (windows-latest)
  • GitHub Check: min-dep-os (ubuntu-latest)
  • GitHub Check: min-dep-py3 (3.12)
  • GitHub Check: min-dep-py3 (3.9)
  • GitHub Check: min-dep-py3 (3.11)
  • GitHub Check: min-dep-pytorch (2.5.1)
  • GitHub Check: min-dep-pytorch (2.7.1)
  • GitHub Check: min-dep-py3 (3.10)
  • GitHub Check: min-dep-pytorch (2.8.0)
  • GitHub Check: min-dep-os (macOS-latest)
  • GitHub Check: min-dep-pytorch (2.6.0)
  • GitHub Check: flake8-py3 (pytype)
  • GitHub Check: quick-py3 (ubuntu-latest)
  • GitHub Check: build-docs
  • GitHub Check: quick-py3 (macOS-latest)
  • GitHub Check: flake8-py3 (codeformat)
  • GitHub Check: flake8-py3 (mypy)
  • GitHub Check: quick-py3 (windows-latest)
  • GitHub Check: packaging
🔇 Additional comments (6)
tests/runner.py (2)

35-40: LGTM!

Noqa comment removal is valid. N802 isn't enforced in ruff config, so the mixedCase override names won't trigger lint errors.


42-50: LGTM!

Same rationale as startTest — N802 not in ruff select.

pyproject.toml (1)

46-51: LGTM!

RUF100 consolidates yesqa functionality into Ruff. Clean approach.

monai/apps/nnunet/nnunetv2_runner.py (2)

21-21: LGTM!

Unnecessary type-ignore removed.


37-37: LGTM!

N801 not in ruff select. Class name intentionally follows nnU-Net convention.

monai/utils/profiling.py (1)

338-356: LGTM!

Lint comment removed; _self naming remains correct for avoiding outer scope shadowing.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request attempts to streamline linting by replacing the standalone yesqa pre-commit hook with Ruff's equivalent RUF100 rule. However, the implementation has a critical flaw: the project still actively uses flake8 with pep8-naming and flake8-bugbear plugins, but Ruff is not configured to check the corresponding "N" and "B" rule categories.

Changes:

  • Removed the yesqa hook from .pre-commit-config.yaml
  • Enabled RUF100 rule in Ruff configuration in pyproject.toml
  • Removed noqa comments from 5 locations across 3 files

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
.pre-commit-config.yaml Removed yesqa hook and its dependencies
pyproject.toml Enabled RUF100 rule for detecting unused noqa comments
tests/runner.py Removed noqa comments for N802 violations (camelCase method names)
monai/utils/profiling.py Removed noqa comments for B902 and N805 violations (non-standard self parameter)
monai/apps/nnunet/nnunetv2_runner.py Removed noqa comments for N814 and N801 violations (naming conventions)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.



class nnUNetV2Runner: # noqa: N801
class nnUNetV2Runner:
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

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

The removal of the noqa: N801 comment will cause flake8 violations. The project still uses flake8 with pep8-naming plugin (configured in setup.cfg with "N" rules selected). The class name nnUNetV2Runner violates N801 (class name should use CapWords convention), but this naming is intentional to match the nnU-Net library's naming convention. Since Ruff doesn't have the "N" rule category enabled, RUF100 won't detect this, but flake8 will still flag it.

Suggested change
class nnUNetV2Runner:
class nnUNetV2Runner: # noqa: N801

Copilot uses AI. Check for mistakes.
self.timed_tests = {}

def startTest(self, test): # noqa: N802
def startTest(self, test):
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

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

The removal of the noqa: N802 comment will cause flake8 violations. The project still uses flake8 with pep8-naming plugin (configured in setup.cfg line 183 with "N" rules selected, and listed in requirements-dev.txt). The method name startTest violates N802 (function name should be lowercase) but must use this name to override the parent class method from unittest.TextTestResult. Since Ruff doesn't have the "N" rule category enabled in pyproject.toml, RUF100 won't detect this, but flake8 will still flag it when run via runtests.sh --flake8.

Suggested change
def startTest(self, test):
def startTest(self, test): # noqa: N802

Copilot uses AI. Check for mistakes.
super().startTest(test)

def stopTest(self, test): # noqa: N802
def stopTest(self, test):
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

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

The removal of the noqa: N802 comment will cause flake8 violations. The project still uses flake8 with pep8-naming plugin (configured in setup.cfg). The method name stopTest violates N802 (function name should be lowercase) but must use this name to override the parent class method from unittest.TextTestResult. Since Ruff doesn't have the "N" rule category enabled, RUF100 won't detect this, but flake8 will still flag it.

Suggested change
def stopTest(self, test):
def stopTest(self, test): # noqa: N802

Copilot uses AI. Check for mistakes.
class _Iterable:

def __iter__(_self): # noqa: B902, N805 pylint: disable=E0213
def __iter__(_self):
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

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

The removal of the noqa: B902, N805 comment will cause flake8 violations. The project still uses flake8 with flake8-bugbear and pep8-naming plugins (configured in setup.cfg with "B" and "N" rules selected). This method intentionally uses _self instead of self as the first parameter, which violates B902 (invalid first argument for instance method) and N805 (first argument should be named 'self'). Since Ruff doesn't have the "B" or "N" rule categories enabled, RUF100 won't detect this, but flake8 will still flag these violations.

Suggested change
def __iter__(_self):
def __iter__(self):

Copilot uses AI. Check for mistakes.

import monai
from monai.apps.nnunet.utils import NNUNETMode as M # noqa: N814
from monai.apps.nnunet.utils import NNUNETMode as M
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

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

The removal of the noqa: N814 comment will cause flake8 violations. The project still uses flake8 with pep8-naming plugin (configured in setup.cfg with "N" rules selected). Importing NNUNETMode as M violates N814 (camelcase imported as uppercase). Since Ruff doesn't have the "N" rule category enabled, RUF100 won't detect this, but flake8 will still flag it when run via runtests.sh --flake8.

Suggested change
from monai.apps.nnunet.utils import NNUNETMode as M
from monai.apps.nnunet.utils import NNUNETMode as M # noqa: N814

Copilot uses AI. Check for mistakes.
@Borda
Copy link
Contributor Author

Borda commented Jan 13, 2026

seems first we need to land #8694

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant