Repository navigation
[ruff] Enable additional rules: RSE, FLY, ICN, PIE, FURB - #4277
Merged
AlexanderDokuchaev merged 7 commits intoOct 22, 2026
Merged
AlexanderDokuchaev merged 7 commits into
AlexanderDokuchaev merged 7 commits into
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The mechanical lint cleanups preserve behavior, with no blocking issues identified in static review; tests were not run.
No open issues 🎉
What changed in this PR
Strengthens NNCF’s linting standards and applies corresponding cleanups across source code, tests, examples, and tools.
Changes:
- Enables RSE, FLY, ICN, PIE, and FURB rules with selected exclusions.
- Simplifies equivalent expressions, collection operations, and file handling.
- Removes the unused
commands_are_equaltest helper.
| File | Description |
|---|---|
| tools/other/extract_ov_subgraph.py | Uses pathlib for XML output. |
| tools/memory_monitor/memory_monitor.py | Writes measurements with writelines. |
| tools/data_visualizer/visualize_compression_results.py | Uses pathlib for Markdown output. |
| tests/torch/quantization/test_solver_quantization_traits.py | Uses bulk set updates. |
| tests/torch/quantization/test_functions.py | Simplifies range expressions. |
| tests/torch/quantization/extensions/isolated_cases.py | Simplifies singleton comparison. |
| tests/torch/helpers.py | Removes unused helper and imports. |
| tests/torch/fx/test_smooth_quant.py | Combines prefix checks. |
| tests/torch/function_hook/quantization/test_smooth_quant.py | Combines prefix checks. |
| tests/torch/function_hook/quantization/test_calculation_quantizer_params.py | Simplifies range expressions. |
| tests/openvino/tools/config.py | Simplifies defaults and extension comparison. |
| tests/openvino/native/quantization/test_graphs.py | Uses an explicit keyword argument. |
| tests/onnx/test_e2e_ptq.py | Uses pathlib for HTML output. |
| tests/docs/test_version.py | Uses explicit regex flag names. |
| tests/docs/test_md_pypiplishing.py | Uses explicit regex flag names. |
| tests/cross_fw/test_templates/test_statistics_caching.py | Removes redundant pass statements. |
| tests/cross_fw/examples/test_examples.py | Uses pathlib to read requirements. |
| tests/common/test_telemetry.py | Simplifies exception raising. |
| tests/common/test_reducers_and_aggregators.py | Simplifies a range expression. |
| tests/common/quantization/test_quantizer_propagation_graph.py | Simplifies a range expression. |
| tests/common/quantization/test_passes.py | Removes a redundant pass. |
| tests/common/quantization/mock_graphs.py | Simplifies a range expression. |
| tests/common/quantization/data_generators.py | Simplifies ranges and fallback selection. |
| src/nncf/scopes.py | Uses bulk set updates. |
| src/nncf/quantization/algorithms/weight_compression/torch_backend.py | Simplifies exception raising. |
| src/nncf/quantization/algorithms/weight_compression/onnx_backend.py | Simplifies exception raising. |
| src/nncf/quantization/algorithms/bias_correction/algorithm.py | Simplifies fallback selection. |
| src/nncf/openvino/rt_info.py | Simplifies path defaulting. |
| src/nncf/openvino/graph/transformations/commands.py | Simplifies exception raising. |
| src/nncf/openvino/graph/node_utils.py | Uses max for dimension clamping. |
| src/nncf/onnx/graph/onnx_helper.py | Simplifies directory defaulting. |
| src/nncf/experimental/torch/fx/transformations.py | Simplifies comparisons and defaulting. |
| src/nncf/experimental/torch/fx/nncf_graph_builder.py | Simplifies singleton comparisons. |
| src/nncf/experimental/common/graph/netron.py | Uses pathlib for binary output. |
| src/nncf/errors.py | Removes redundant pass statements. |
| src/nncf/common/utils/patcher.py | Uses an f-string for object paths. |
| src/nncf/common/quantization/quantizer_propagation/solver.py | Simplifies defaulting and set updates. |
| src/nncf/common/hardware/config.py | Removes a redundant pass. |
| src/nncf/common/graph/model_transformer.py | Simplifies exception raising. |
| src/nncf/common/graph/graph.py | Uses bulk set updates. |
| src/nncf/common/deprecation.py | Uses an f-string for messages. |
| src/custom_version.py | Uses explicit regex flag names. |
| pyproject.toml | Enables rule sets and sorts configuration lists. |
| examples/post_training_quantization/torch/ssd300_vgg16/main.py | Iterates directly over file lines. |
| examples/llm_compression/torch/gptq_model_convertor/main.py | Simplifies blank-line printing. |
| examples/llm_compression/openvino/tiny_llama_find_hyperparams/main.py | Applies the conventional datetime alias. |
Review effort: Balanced
anzr299
reviewed
Oct 22, 2026
anzr299
approved these changes
Oct 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
pyproject.toml:RSE(flake8-raise)FLY(flynt)ICN(flake8-import-conventions)PIE(flake8-pie)FURB(refurb), withFURB113,FURB118,FURB140,FURB187ignoredsrc/,tests/,examples/andtools/.commands_are_equalhelper fromtests/torch/helpers.py.select/ignorelists in the ruff config alphabetically.Reason for changes
Improve code quality and consistency through stricter linting.
Related tickets
N/A
Tests
Test examples - success