From ff4727068194cd70d3b9e53f99a23a105b50dde2 Mon Sep 17 00:00:00 2001 From: Willi Ballenthin Date: Thu, 6 Jul 2023 19:42:57 +0200 Subject: [PATCH] add flake8-encoding plugin --- scripts/detect_duplicate_features.py | 2 +- scripts/setup-linter-dependencies.py | 2 +- setup.py | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/detect_duplicate_features.py b/scripts/detect_duplicate_features.py index ff21fd0b..7d96f564 100644 --- a/scripts/detect_duplicate_features.py +++ b/scripts/detect_duplicate_features.py @@ -42,7 +42,7 @@ def get_features(rule_path: str) -> list: list: A list of all feature statements contained within the rule file. """ feature_list = [] - with open(rule_path, "r") as f: + with open(rule_path, "r", encoding="utf-8") as f: try: new_rule = capa.rules.Rule.from_yaml(f.read()) feature_list = get_child_features(new_rule.statement) diff --git a/scripts/setup-linter-dependencies.py b/scripts/setup-linter-dependencies.py index ff271ab6..806ad79c 100644 --- a/scripts/setup-linter-dependencies.py +++ b/scripts/setup-linter-dependencies.py @@ -172,7 +172,7 @@ def main(args: argparse.Namespace) -> None: logging.info(f"Writing results to {args.output}") try: - with open(args.output, "w") as jf: + with open(args.output, "w", encoding="utf-8") as jf: json.dump(data, jf, indent=2) except BaseException as e: logging.error(f"Exception encountered when writing results: {e}") diff --git a/setup.py b/setup.py index 2b1be6be..ea845635 100644 --- a/setup.py +++ b/setup.py @@ -76,6 +76,7 @@ setuptools.setup( "pytest-cov==4.1.0", "flake8==6.0.0", "flake8-bugbear==23.6.5", + "flake8-encodings==0.5.0.post1", "ruff==0.0.275", "black==23.3.0", "isort==5.11.4",