Skip to content

Commit

Permalink
format / linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mshafer-NI committed Jun 11, 2024
1 parent c84c1e0 commit 6ae83b8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def remove_auto_suppressions_from_file(file: pathlib.Path):
"""Removes auto-suppressions from file."""
try:
lines = file.read_text(encoding=_utils.DEFAULT_ENCODING).splitlines()
except:
except Exception:
_module_logger.warning("Failed to read %s with encoding %s", file, _utils.DEFAULT_ENCODING)
raise
stripped_lines = [_filter_suppresion_from_line(line) for line in lines]
Expand Down
19 changes: 11 additions & 8 deletions ni_python_styleguide/_fix.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import logging
import pathlib
from collections import defaultdict
from fnmatch import fnmatch
from typing import Iterable

import isort
import pathspec

from ni_python_styleguide import _acknowledge_existing_errors
from ni_python_styleguide import _config_constants
from ni_python_styleguide import _format
from ni_python_styleguide import _utils
from ni_python_styleguide import (
_acknowledge_existing_errors,
_config_constants,
_format,
_utils,
)

_module_logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -99,8 +100,8 @@ def fix(
if aggressive:
glob_spec = pathspec.PathSpec.from_lines(
"gitwildmatch",
["*.py"] +
[f"!{exclude_}" for exclude_ in exclude.split(",") if exclude_]
["*.py"]
+ [f"!{exclude_}" for exclude_ in exclude.split(",") if exclude_]
+ [f"!{exclude_}/*" for exclude_ in exclude.split(",") if exclude_]
+ [f"!{ignore_}" for ignore_ in extend_ignore.split(",") if ignore_]
+ [f"!{ignore_}/*" for ignore_ in extend_ignore.split(",") if ignore_],
Expand All @@ -109,7 +110,9 @@ def fix(
for file_or_dir_ in file_or_dir:
file_path = pathlib.Path(file_or_dir_)
if file_path.is_dir():
all_files.extend([pathlib.Path(o) for o in glob_spec.match_tree(str(file_path), negate=False)])
all_files.extend(
[pathlib.Path(o) for o in glob_spec.match_tree(str(file_path), negate=False)]
)
else:
all_files.append(file_path)
for file in all_files:
Expand Down

0 comments on commit 6ae83b8

Please sign in to comment.