From a68cac3c7e847138ed0b80e669faf0025117511a Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Sat, 18 May 2024 18:57:12 +0200 Subject: [PATCH 1/2] Apply ruff rule RUF100 RUF100 Unused `noqa` directive --- distutils/bcppcompiler.py | 2 +- distutils/command/__init__.py | 2 +- distutils/msvccompiler.py | 2 +- distutils/tests/test_unixccompiler.py | 2 +- ruff.toml | 1 + 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/distutils/bcppcompiler.py b/distutils/bcppcompiler.py index c1341e43..d1af267d 100644 --- a/distutils/bcppcompiler.py +++ b/distutils/bcppcompiler.py @@ -84,7 +84,7 @@ def __init__(self, verbose=0, dry_run=0, force=0): # -- Worker methods ------------------------------------------------ - def compile( # noqa: C901 + def compile( self, sources, output_dir=None, diff --git a/distutils/command/__init__.py b/distutils/command/__init__.py index 028dcfa0..1e8fbe60 100644 --- a/distutils/command/__init__.py +++ b/distutils/command/__init__.py @@ -3,7 +3,7 @@ Package containing implementation of all the standard Distutils commands.""" -__all__ = [ # noqa: F822 +__all__ = [ 'build', 'build_py', 'build_ext', diff --git a/distutils/msvccompiler.py b/distutils/msvccompiler.py index ac8b68c0..05ef01fa 100644 --- a/distutils/msvccompiler.py +++ b/distutils/msvccompiler.py @@ -684,6 +684,6 @@ def set_path_env_var(self, name): OldMSVCCompiler = MSVCCompiler # get_build_architecture not really relevant now we support cross-compile from distutils.msvc9compiler import ( - MacroExpander, # noqa: F811 + MacroExpander, MSVCCompiler, ) diff --git a/distutils/tests/test_unixccompiler.py b/distutils/tests/test_unixccompiler.py index 543aa20d..d2c88e91 100644 --- a/distutils/tests/test_unixccompiler.py +++ b/distutils/tests/test_unixccompiler.py @@ -32,7 +32,7 @@ def rpath_foo(self): class TestUnixCCompiler(support.TempdirManager): - @pytest.mark.skipif('platform.system == "Windows"') # noqa: C901 + @pytest.mark.skipif('platform.system == "Windows"') def test_runtime_libdir_option(self): # noqa: C901 # Issue #5900; GitHub Issue #37 # diff --git a/ruff.toml b/ruff.toml index 70612985..f2c67aeb 100644 --- a/ruff.toml +++ b/ruff.toml @@ -1,6 +1,7 @@ [lint] extend-select = [ "C901", + "RUF100", "W", ] ignore = [ From df0502f7837f682e6157b597e0e5526dda128850 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 27 Jun 2024 04:46:29 -0400 Subject: [PATCH 2/2] Move local ruff rules into a local section. --- ruff.toml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ruff.toml b/ruff.toml index f2c67aeb..3550acad 100644 --- a/ruff.toml +++ b/ruff.toml @@ -1,8 +1,10 @@ [lint] extend-select = [ "C901", - "RUF100", "W", + + # local + "RUF100", ] ignore = [ # https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules