Skip to content

Commit 252b606

Browse files
committed
Add addition_to_excluded_paths and excluded_paths to BaseConfig
1 parent b1fa4ae commit 252b606

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

exasol/toolbox/config.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,15 @@ class BaseConfig(BaseModel):
4949
default=False,
5050
description="If true, creates also the major version tags (v*) automatically",
5151
)
52+
addition_to_excluded_paths: tuple[str, ...] = Field(
53+
default=(),
54+
description="""
55+
This is used to extend the default excluded_paths. If a more general path that
56+
would be seen in other projects, like .venv, needs to be added into this
57+
argument, please instead modify the
58+
:meth:`exasol.toolbox.config.BaseConfig.excluded_paths` attribute.
59+
""",
60+
)
5261
model_config = ConfigDict(frozen=True, arbitrary_types_allowed=True)
5362

5463
@computed_field # type: ignore[misc]
@@ -65,6 +74,23 @@ def minimum_python_version(self) -> str:
6574
index_min_version = versioned.index(min_version)
6675
return self.python_versions[index_min_version]
6776

77+
@computed_field
78+
@property
79+
def excluded_paths(self) -> tuple[str, ...]:
80+
"""
81+
There are certain nox sessions:
82+
- lint:code
83+
- lint:security
84+
- lint:typing
85+
- project:fix
86+
- project:format
87+
where it is desired restrict which Python files are considered within the
88+
source_path, like excluding `dist`, `.eggs`. As such, this property is used to
89+
exclude such undesired paths.
90+
"""
91+
default_excluded_paths = {"dist", ".eggs", "venv", ".poetry"}
92+
return tuple(default_excluded_paths.union(set(self.addition_to_excluded_paths)))
93+
6894
@computed_field # type: ignore[misc]
6995
@property
7096
def pyupgrade_argument(self) -> tuple[str, ...]:

0 commit comments

Comments
 (0)