Skip to content

Commit

Permalink
Default arguments should not be mutable
Browse files Browse the repository at this point in the history
  • Loading branch information
DimitriPapadopoulos committed Apr 10, 2024
1 parent f3ea6ce commit 17da0fe
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions codespell_lib/_codespell.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,6 @@ def parse_options(
"accepts globs as well. E.g.: if you want "
"codespell to skip .eps and .txt files, "
'you\'d give "*.eps,*.txt" to this option.',
default=[],
)

parser.add_argument(
Expand Down Expand Up @@ -1103,7 +1102,7 @@ def parse_file(


def flatten_clean_comma_separated_arguments(
arguments: List[str],
arguments: Iterable[str],
) -> List[str]:
"""
>>> flatten_clean_comma_separated_arguments(["a, b ,\n c, d,", "e"])
Expand Down Expand Up @@ -1263,7 +1262,9 @@ def main(*args: str) -> int:

file_opener = FileOpener(options.hard_encoding_detection, options.quiet_level)

glob_match = GlobMatch(flatten_clean_comma_separated_arguments(options.skip))
glob_match = GlobMatch(
flatten_clean_comma_separated_arguments(options.skip) if options.skip else []
)
try:
glob_match.match("/random/path") # does not need a real path
except re.error:
Expand Down

0 comments on commit 17da0fe

Please sign in to comment.