Skip to content

Commit 2707e6f

Browse files
committed
Rename python_files to get_filtered_python_files
1 parent a0215d9 commit 2707e6f

File tree

5 files changed

+17
-18
lines changed

5 files changed

+17
-18
lines changed

exasol/toolbox/nox/_format.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
Mode,
1010
_version,
1111
check_for_config_attribute,
12-
python_files,
12+
get_filtered_python_files,
1313
)
1414
from noxconfig import (
1515
PROJECT_CONFIG,
@@ -45,7 +45,7 @@ def command(*args: str) -> Iterable[str]:
4545
@nox.session(name="project:fix", python=False)
4646
def fix(session: Session) -> None:
4747
"""Runs all automated fixes on the code base"""
48-
py_files = python_files(PROJECT_CONFIG.root)
48+
py_files = get_filtered_python_files(PROJECT_CONFIG.root)
4949
_version(session, Mode.Fix)
5050
_pyupgrade(session, config=PROJECT_CONFIG, files=py_files)
5151
_ruff(session, mode=Mode.Fix, files=py_files)
@@ -55,6 +55,6 @@ def fix(session: Session) -> None:
5555
@nox.session(name="project:format", python=False)
5656
def fmt_check(session: Session) -> None:
5757
"""Checks the project for correct formatting"""
58-
py_files = python_files(PROJECT_CONFIG.root)
58+
py_files = get_filtered_python_files(PROJECT_CONFIG.root)
5959
_ruff(session, mode=Mode.Check, files=py_files)
6060
_code_format(session=session, mode=Mode.Check, files=py_files)

exasol/toolbox/nox/_lint.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import tomlkit
1111
from nox import Session
1212

13-
from exasol.toolbox.nox._shared import python_files
13+
from exasol.toolbox.nox._shared import get_filtered_python_files
1414
from exasol.toolbox.util.dependencies.shared_models import PoetryFiles
1515
from noxconfig import PROJECT_CONFIG
1616

@@ -120,22 +120,22 @@ def report_illegal(illegal: dict[str, list[str]], console: rich.console.Console)
120120
@nox.session(name="lint:code", python=False)
121121
def lint(session: Session) -> None:
122122
"""Runs the static code analyzer on the project"""
123-
py_files = python_files(PROJECT_CONFIG.root / PROJECT_CONFIG.source)
124-
_pylint(session, py_files)
123+
py_files = get_filtered_python_files(PROJECT_CONFIG.root / PROJECT_CONFIG.source)
124+
_pylint(session=session, files=py_files)
125125

126126

127127
@nox.session(name="lint:typing", python=False)
128128
def type_check(session: Session) -> None:
129129
"""Runs the type checker on the project"""
130-
py_files = [f"{file}" for file in python_files(PROJECT_CONFIG.root)]
131-
_type_check(session, py_files)
130+
py_files = get_filtered_python_files(PROJECT_CONFIG.root)
131+
_type_check(session=session, files=py_files)
132132

133133

134134
@nox.session(name="lint:security", python=False)
135135
def security_lint(session: Session) -> None:
136136
"""Runs the security linter on the project"""
137-
py_files = python_files(PROJECT_CONFIG.root / PROJECT_CONFIG.source)
138-
_security_lint(session, py_files)
137+
py_files = get_filtered_python_files(PROJECT_CONFIG.root / PROJECT_CONFIG.source)
138+
_security_lint(session=session, files=py_files)
139139

140140

141141
@nox.session(name="lint:dependencies", python=False)

exasol/toolbox/nox/_shared.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import argparse
44
from collections import ChainMap
55
from collections.abc import (
6-
Iterable,
76
MutableMapping,
87
)
98
from enum import (
@@ -39,9 +38,9 @@ class Mode(Enum):
3938
Check = auto()
4039

4140

42-
def python_files(project_root: Path) -> Iterable[str]:
41+
def get_filtered_python_files(project_root: Path) -> list[str]:
4342
"""
44-
Returns iterable of python files after removing unwanted paths
43+
Returns iterable of Python files after removing excluded paths
4544
"""
4645
check_for_config_attribute(config=PROJECT_CONFIG, attribute="excluded_python_paths")
4746
files = project_root.glob("**/*.py")

exasol/toolbox/nox/tasks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
def check(session: Session) -> None:
3535
"""Runs all available checks on the project"""
3636
context = _context(session, coverage=True)
37-
py_files = python_files(PROJECT_CONFIG.root)
37+
py_files = get_filtered_python_files(PROJECT_CONFIG.root)
3838
_version(session, Mode.Check)
3939
_code_format(session, Mode.Check, py_files)
4040
_pylint(session, py_files)
@@ -65,7 +65,7 @@ def check(session: Session) -> None:
6565
Mode,
6666
_context,
6767
_version,
68-
python_files,
68+
get_filtered_python_files,
6969
)
7070

7171
from exasol.toolbox.nox._ci import (

test/unit/nox/_shared_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from exasol.toolbox.config import BaseConfig
99
from exasol.toolbox.nox._shared import (
1010
check_for_config_attribute,
11-
python_files,
11+
get_filtered_python_files,
1212
)
1313

1414

@@ -48,13 +48,13 @@ def create_files(tmp_directory, directories):
4848
yield file_list
4949

5050

51-
def test_python_files(
51+
def test_get_filtered_python_files(
5252
tmp_directory, create_files, package_directory, path_filter_directory
5353
):
5454
config = BaseConfig(add_to_excluded_python_paths=(path_filter_directory,))
5555

5656
with patch("exasol.toolbox.nox._shared.PROJECT_CONFIG", config):
57-
actual = python_files(tmp_directory)
57+
actual = get_filtered_python_files(tmp_directory)
5858

5959
assert len(actual) == 1
6060
assert "toolbox-dummy" in actual[0]

0 commit comments

Comments
 (0)