diff --git a/pyproject.toml b/pyproject.toml index 2b4ad36..15f6482 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,6 +2,20 @@ src_paths = ["."] profile = "black" +[tool.mypy] +strict = true +enable_error_code = [ + "redundant-self", + "redundant-expr", + "possibly-undefined", + "truthy-bool", + "truthy-iterable", + "ignore-without-code", + "unused-awaitable", + "explicit-override", +] +warn_unreachable = true + [tool.ruff] # See https://github.com/charliermarsh/ruff#rules for error code definitions. select = [ diff --git a/zulint/lister.py b/zulint/lister.py index 31e8a95..8d56e1e 100755 --- a/zulint/lister.py +++ b/zulint/lister.py @@ -137,19 +137,22 @@ def list_files( ): continue - if ftypes or group_by_ftype: - try: - filetype = get_ftype(fpath, use_shebang) - except (OSError, UnicodeDecodeError) as e: - etype = e.__class__.__name__ - print( - f'Error: {etype} while determining type of file "{fpath}":', - file=sys.stderr, - ) - print(e, file=sys.stderr) - filetype = "" - if ftypes and filetype not in ftypes_set: - continue + if not ftypes and not group_by_ftype: + result_list.append(fpath) + continue + + try: + filetype = get_ftype(fpath, use_shebang) + except (OSError, UnicodeDecodeError) as e: + etype = e.__class__.__name__ + print( + f'Error: {etype} while determining type of file "{fpath}":', + file=sys.stderr, + ) + print(e, file=sys.stderr) + filetype = "" + if ftypes and filetype not in ftypes_set: + continue if group_by_ftype: result_dict[filetype].append(fpath)