common_fs.file_filter
¶
-
class cpp_linter.common_fs.file_filter.FileFilter(ignore_value: str =
''
, extensions: list[str] | None =None
, not_ignored: list[str] | None =None
, tool_specific_name: str | None =None
)[source]¶ A reusable mechanism for parsing and validating file filters.
- Parameters:¶
- extensions: list[str] | None =
None
¶ A list of file extensions in which to focus.
- ignore_value: str =
''
¶ The user input specified via
--ignore
CLI argument.- not_ignored: list[str] | None =
None
¶ A list of files or paths that will be explicitly not ignored.
- tool_specific_name: str | None =
None
¶ A clang tool name for which the file filter is specifically applied. This only gets used in debug statements.
- extensions: list[str] | None =
-
parse_submodules(path: str =
'.gitmodules'
)[source]¶ Automatically detect submodules from the given relative
path
. This will add each submodule to theignored
list unless already specified asnot_ignored
.
- is_file_in_list(ignored: bool, file_name: PurePath) bool [source]¶
Determine if a file is specified in a list of paths and/or filenames.
- is_source_or_ignored(file_name: str) bool [source]¶
Exclude undesired files (specified by user input
--extensions
and--ignore
options).- Parameters:¶
- Returns:¶
True
if (in order of precedence)file_name
is using one of the specifiedextensions
ANDfile_name
is innot_ignored
ORfile_name
is not inignored
.
Otherwise
False
.
-
class cpp_linter.common_fs.file_filter.TidyFileFilter(ignore_value: str =
''
, extensions: list[str] | None =None
, not_ignored: list[str] | None =None
)[source]¶ A specialized
FileFilter
whose debug prompts indicate clang-tidy preparation.
-
class cpp_linter.common_fs.file_filter.FormatFileFilter(ignore_value: str =
''
, extensions: list[str] | None =None
, not_ignored: list[str] | None =None
)[source]¶ A specialized
FileFilter
whose debug prompts indicate clang-format preparation.