Skip to content
Draft
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
17 changes: 0 additions & 17 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,6 @@ repos:
^monai/_version.py
)

- repo: https://github.com/asottile/yesqa
rev: v1.5.0
hooks:
- id: yesqa
name: Unused noqa
additional_dependencies:
- flake8>=3.8.1
- flake8-bugbear<=24.2.6
- flake8-comprehensions
- pep8-naming
exclude: |
(?x)^(
monai/__init__.py|
docs/source/conf.py|
tests/utils.py
)$

- repo: https://github.com/hadialqattan/pycln
rev: v2.5.0
hooks:
Expand Down
4 changes: 2 additions & 2 deletions monai/apps/nnunet/nnunetv2_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from typing import Any

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.
from monai.apps.nnunet.utils import analyze_data, create_new_data_copy, create_new_dataset_json
from monai.bundle import ConfigParser
from monai.utils import ensure_tuple, optional_import
Expand All @@ -34,7 +34,7 @@
__all__ = ["nnUNetV2Runner"]


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.
"""
``nnUNetV2Runner`` provides an interface in MONAI to use `nnU-Net` V2 library to analyze, train, and evaluate
neural networks for medical image segmentation tasks.
Expand Down
2 changes: 1 addition & 1 deletion monai/utils/profiling.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ def profile_iter(self, name, iterable):

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.
do_iter = True
orig_iter = iter(iterable)
caller = getframeinfo(stack()[1][0])
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ select = [
"E", "F", "W", # flake8
"NPY", # NumPy specific rules
"UP", # pyupgrade
# "RUF100", # aka yesqa
"RUF100", # aka yesqa
]
extend-ignore = [
"E741", # ambiguous variable name
Expand Down
4 changes: 2 additions & 2 deletions tests/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
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.
"""Start timer, print test name, do normal test."""
self.start_time = time.time()
name = self.getDescription(test)
self.stream.write(f"Starting test: {name}...\n")
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.
"""On test end, get time, print, store and do normal behaviour."""
elapsed = time.time() - self.start_time
name = self.getDescription(test)
Expand Down
Loading