Skip to content

MAINT: Enforce ruff/pygrep-hooks rules (PGH) #1499

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 22, 2025
Merged
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
2 changes: 1 addition & 1 deletion asv/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from importlib_metadata import version as get_version

from asv import plugin_manager # noqa F401 Needed to load the plugins
from asv import plugin_manager # noqa: F401 Needed to load the plugins

__version__ = get_version("asv")

Expand Down
2 changes: 1 addition & 1 deletion asv/plugins/virtualenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def __init__(self, conf, python, requirements, tagged_env_vars):
tagged_env_vars)

try:
import virtualenv # noqa F401 unused, but required to test whether virtualenv is installed or not
import virtualenv # noqa: F401 unused, but required to test whether virtualenv is installed or not
except ImportError:
raise environment.EnvironmentUnavailable(
"virtualenv package not installed")
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ extend-exclude = [
[tool.ruff.lint]
extend-select = [
"I",
"PGH",
]
ignore = [
"E741", # Do not use variables named 'I', 'O', or 'l'
Expand Down
2 changes: 1 addition & 1 deletion test/benchmark/time_secondary.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
if sys.version_info[0] < 3:
import commands
try:
import commands.quickstart # noqa F401 unused import
import commands.quickstart # noqa: F401 unused import
assert False
except ImportError:
# OK
Expand Down
2 changes: 1 addition & 1 deletion test/test_repo_template/asv_test_repo/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Licensed under a 3-clause BSD style license - see LICENSE.rst

dummy_value = {dummy_value} # noqa F821 This is a template that will be rendered to valid Python
dummy_value = {dummy_value} # noqa: F821 This is a template that will be rendered to valid Python
2 changes: 1 addition & 1 deletion test/test_repo_template/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# This file is a template, and will be rendered before executed.
# So the double curly brackets will become single after rendering, and
# when executed, this will work as expected
content = 'env = {{}}\n'.format(repr(dict(os.environ))) # noqa W291 see above comment
content = 'env = {{}}\n'.format(repr(dict(os.environ))) # noqa: F523 see above comment
with open('asv_test_repo/build_time_env.py', 'w') as f:
f.write(content)

Expand Down
4 changes: 2 additions & 2 deletions test/test_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def test_get_result_hash_from_prefix(tmpdir):
assert 'one of multiple commits' in str(excinfo.value)


def test_backward_compat_load(example_results): # noqa F811 redefinition of the imported fixture,it can be removed when the fixture is moved to conftest.py file and the import deleted
def test_backward_compat_load(example_results): # noqa: F811 redefinition of the imported fixture,it can be removed when the fixture is moved to conftest.py file and the import deleted
resultsdir = example_results
filename = join('cheetah', '624da0aa-py2.7-Cython-numpy1.8.json')

Expand Down Expand Up @@ -204,7 +204,7 @@ def test_json_timestamp(tmpdir):
assert values['duration'] == duration


def test_iter_results(capsys, tmpdir, example_results): # noqa F811 noqa F811 redefinition of the imported fixture,it can be removed when the fixture is moved to conftest.py file and the import deleted
def test_iter_results(capsys, tmpdir, example_results): # noqa: F811 noqa F811 redefinition of the imported fixture,it can be removed when the fixture is moved to conftest.py file and the import deleted
dst = os.path.join(str(tmpdir), 'example_results')
shutil.copytree(example_results, dst)

Expand Down
4 changes: 2 additions & 2 deletions test/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ def _check_conda():


try:
import virtualenv # noqa F401 checking if installed
import virtualenv # noqa: F401 checking if installed
HAS_VIRTUALENV = True
except ImportError:
HAS_VIRTUALENV = False


try:
import rattler # noqa F401 checking if installed
import rattler # noqa: F401 checking if installed
HAS_RATTLER = True
except ImportError:
HAS_RATTLER = False
Expand Down
Loading