summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xfirmware_builder.py19
-rw-r--r--pylintrc7
-rwxr-xr-xutil/kconfig_check.py2
-rw-r--r--util/test_kconfig_check.py1
4 files changed, 19 insertions, 10 deletions
diff --git a/firmware_builder.py b/firmware_builder.py
index 6c74bf8409..1a8f52df56 100755
--- a/firmware_builder.py
+++ b/firmware_builder.py
@@ -65,8 +65,8 @@ def build(opts):
"When --code-coverage is selected, 'build' is a no-op. "
"Run 'test' with --code-coverage instead."
)
- with open(opts.metrics, "w") as f:
- f.write(json_format.MessageToJson(metric_list))
+ with open(opts.metrics, "w") as file:
+ file.write(json_format.MessageToJson(metric_list))
return
ec_dir = pathlib.Path(__file__).parent
@@ -90,8 +90,8 @@ def build(opts):
)
if memsize_file.exists():
parse_memsize(memsize_file, metric, variant)
- with open(opts.metrics, "w") as f:
- f.write(json_format.MessageToJson(metric_list))
+ with open(opts.metrics, "w") as file:
+ file.write(json_format.MessageToJson(metric_list))
# Ensure that there are no regressions for boards that build successfully
# with clang: b/172020503.
@@ -109,6 +109,7 @@ UNITS = {
def parse_memsize(filename, metric, variant):
+ """Parse the output of the build to extract the image size."""
with open(filename, "r") as infile:
# Skip header line
infile.readline()
@@ -122,6 +123,7 @@ def parse_memsize(filename, metric, variant):
def bundle(opts):
+ """Bundle the artifacts."""
if opts.code_coverage:
bundle_coverage(opts)
else:
@@ -147,8 +149,8 @@ def write_metadata(opts, info):
bundle_metadata_file = (
opts.metadata if opts.metadata else DEFAULT_BUNDLE_METADATA_FILE
)
- with open(bundle_metadata_file, "w") as f:
- f.write(json_format.MessageToJson(info))
+ with open(bundle_metadata_file, "w") as file:
+ file.write(json_format.MessageToJson(info))
def bundle_coverage(opts):
@@ -207,8 +209,8 @@ def test(opts):
"""Runs all of the unit tests for EC firmware"""
# TODO(b/169178847): Add appropriate metric information
metrics = firmware_pb2.FwTestMetricList()
- with open(opts.metrics, "w") as f:
- f.write(json_format.MessageToJson(metrics))
+ with open(opts.metrics, "w") as file:
+ file.write(json_format.MessageToJson(metrics))
# Run python unit tests.
subprocess.run(
@@ -266,6 +268,7 @@ def main(args):
def parse_args(args):
+ """Parse all command line args and return opts dict."""
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument(
diff --git a/pylintrc b/pylintrc
index 51f1236221..5af5f4e4dd 100644
--- a/pylintrc
+++ b/pylintrc
@@ -6,7 +6,12 @@
[MESSAGES CONTROL]
-disable=bad-continuation,bad-whitespace
+disable=
+ bad-continuation,
+ bad-whitespace,
+ # These have nothing to do with black, they are just annoying
+ fixme,
+ too-many-arguments
[format]
diff --git a/util/kconfig_check.py b/util/kconfig_check.py
index 74dfcf183d..651078448d 100755
--- a/util/kconfig_check.py
+++ b/util/kconfig_check.py
@@ -470,7 +470,7 @@ def main(argv):
search_paths=args.search_path,
ignore=args.ignore,
)
- elif args.cmd == "build":
+ if args.cmd == "build":
return checker.do_build(
configs_file=args.configs,
srcdir=args.srctree,
diff --git a/util/test_kconfig_check.py b/util/test_kconfig_check.py
index 4c5a287ab6..d4942821ae 100644
--- a/util/test_kconfig_check.py
+++ b/util/test_kconfig_check.py
@@ -66,6 +66,7 @@ class KconfigCheck(unittest.TestCase):
)
def check_read_configs(self, use_defines):
+ """Check that kconfigs can be read."""
checker = kconfig_check.KconfigCheck()
with tempfile.NamedTemporaryFile() as configs:
with open(configs.name, "w") as out: