Lines Matching +full:files +full:- +full:exclude
5 # SPDX-License-Identifier: Apache-2.0
54 f"{cp.stdout.decode('utf-8')}\n"
56 f"{cp.stderr.decode('utf-8')}\n")
58 return cp.stdout.decode("utf-8").rstrip()
67 return git('rev-list',
68 f'--max-count={-1 if "." in refspec else 1}', refspec).split()
71 filter_arg = (f'--diff-filter={filter}',) if filter else ()
72 paths_arg = ('--', *paths) if paths else ()
73 out = git('diff', '--name-only', *filter_arg, COMMIT_RANGE, *paths_arg)
74 files = out.splitlines()
75 for file in list(files):
78 files.remove(file)
79 return files
120 - The magic string "<zephyr-base>" can be used to refer to the
123 - The magic string "<git-top>" refers to the top-level repository
124 directory. This avoids running 'git' to find the top-level directory
197 …doc = "See https://docs.zephyrproject.org/latest/contribute/guidelines.html#coding-style for more …
198 path_hint = "<git-top>"
205 diff = subprocess.Popen(('git', 'diff', '--no-ext-diff', COMMIT_RANGE),
209 subprocess.run((checkpatch, '--mailback', '--no-tree', '-'),
217 output = ex.output.decode("utf-8")
233 Check the board.yml files
237 path_hint = "<zephyr-base>"
253 with open(os.path.join(ZEPHYR_BASE, "dts", "bindings", "vendor-prefixes.txt")) as fp:
271 path_hint = "<zephyr-base>"
281 Returns a list of dts/bindings/**/*.yaml files
310 path_hint = "<zephyr-base>"
340 # not a module nor a pip-installed Python utility
344 '--kconfig-out', modules_file, '--settings-out', settings_file]
349 self.error(ex.output.decode("utf-8"))
361 re.sub('[^a-zA-Z0-9]', '_', module).upper(),
374 # not a module nor a pip-installed Python utility
391 '--kconfig-out', kconfig_dts_file, '--bindings-dirs']
398 self.error(ex.output.decode("utf-8"))
411 # pylint: disable=undefined-variable
448 board_str = 'BOARD_' + re.sub(r"[^a-zA-Z0-9_]", "_", board.name).upper()
453 re.sub(r"[^a-zA-Z0-9_]", "_", qualifier)).upper()
498 Returns a kconfiglib.Kconfig object for the Kconfig files. We reuse
515 # Look up Kconfig files relative to ZEPHYR_BASE
548 # symbols within Kconfig files
581 # Warning: Needs to work with both --perl-regexp and the 're' module.
582 regex = r"^\s*(?:module\s*=\s*)([A-Z0-9_]+)\s*(?:#|$)"
585 grep_stdout = git("grep", "-I", "-h", "--perl-regexp", regex, "--",
605 # Warning: Needs to work with both --perl-regexp and the 're' module.
606 # (?:...) is a non-capturing group.
607 regex = r"^\s*(?:menu)?config\s*([A-Z0-9_]+)\s*(?:#|$)"
610 grep_stdout = git("grep", "-I", "-h", "--perl-regexp", regex, "--",
625 Checks that there aren't too many items in the top-level menu (which
634 # shown in the menuconfig (outside show-all mode).
642 prompts) in the top-level Kconfig menu, found {n_top_items} items. If you're
651 # pylint: disable=undefined-variable
657 Options must not be defined in defconfig files.
665 # skip Kconfig nodes not in-tree (will present an absolute path)
670 # pylint: disable=undefined-variable
688 # children in the Kconfig files
693 # pylint: disable=undefined-variable
707 https://docs.zephyrproject.org/latest/build/kconfig/tips.html#menuconfig-symbols.
715 the Kconfig files
732 # pylint: disable=undefined-variable
754 outside Kconfig files (any CONFIG_FOO where no FOO symbol exists)
763 # 'git grep --only-matching' would get rid of the surrounding context
770 # - ##, for token pasting (CONFIG_FOO_##X)
772 # - $, e.g. for CMake variable expansion (CONFIG_FOO_${VAR})
774 # - @, e.g. for CMakes's configure_file() (CONFIG_FOO_@VAR@)
776 # - {, e.g. for Python scripts ("CONFIG_FOO_{}_BAR".format(...)")
778 # - *, meant for comments like '#endif /* CONFIG_FOO_* */
785 # Warning: Needs to work with both --perl-regexp and the 're' module
786 regex = r"\bCONFIG_[A-Z0-9_]+\b(?!\s*##|[$@{*])"
790 grep_stdout = git("grep", "--line-number", "-I", "--null",
791 "--perl-regexp", regex, "--", ":!/doc/releases",
805 not (sym_name.endswith("_MODULE") and sym_name[:-7] in defined_syms):
853 "BOOT_SERIAL_BOOT_MODE", # Used in (sysbuild-based) test/
855 "BOOT_SERIAL_CDC_ACM", # Used in (sysbuild-based) test
856 "BOOT_SERIAL_ENTRANCE_GPIO", # Used in (sysbuild-based) test
859 "BOOT_SHARE_DATA_BOOTINFO", # Used in (sysbuild-based) test
866 "BOOT_VALIDATE_SLOT0", # Used in (sysbuild-based) test
867 "BOOT_WATCHDOG_FEED", # Used in (sysbuild-based) test
875 "CMD_CACHE", # Defined in U-Boot, mentioned in docs
900 "MCUBOOT_ACTION_HOOKS", # Used in (sysbuild-based) test
901 "MCUBOOT_CLEANUP_ARM_CORE", # Used in (sysbuild-based) test
902 "MCUBOOT_SERIAL", # Used in (sysbuild-based) test/
913 "PSA_H", # This is used in config-psa.h as guard for the header file
961 path_hint = "<zephyr-base>"
974 path_hint = "<zephyr-base>"
984 This ensures the board and SoC trees are fully self-contained and reusable.
998 Checks various nits in added/modified files. Doesn't check stuff that's
1002 …doc = "See https://docs.zephyrproject.org/latest/contribute/guidelines.html#coding-style for more …
1003 path_hint = "<git-top>"
1006 # Loop through added/modified files
1025 # Checks for a spammy copy-pasted header format
1027 with open(os.path.join(GIT_TOP, fname), encoding="utf-8") as f:
1030 # 'Kconfig - yada yada' has a copy-pasted redundant filename at the
1031 # top. This probably means all of the header was copy-pasted.
1032 if re.match(r"\s*#\s*(K|k)config[\w.-]*\s*-", contents):
1035 https://docs.zephyrproject.org/latest/build/kconfig/tips.html#header-comments-and-other-nits):
1040 # SPDX-License-Identifier: <License>
1044 Skip the "Kconfig - " part of the first line, since it's clear that the comment
1045 is about Kconfig from context. The "# Kconfig - " is what triggers this
1053 with open(os.path.join(GIT_TOP, fname), encoding="utf-8") as f:
1068 with open(os.path.join(GIT_TOP, fname), encoding="utf-8") as f:
1071 Redundant '...' document separator in {fname}. Binding YAML files are never
1075 # Generic nits related to various source files
1077 with open(os.path.join(GIT_TOP, fname), encoding="utf-8") as f:
1093 Checks for conflict markers or whitespace errors with git diff --check
1097 path_hint = "<git-top>"
1102 # Reason: `--check` is mutually exclusive with `--name-only` and `-s`
1106 # Ignore non-zero return status code
1107 # Reason: `git diff --check` sets the return code to the number of offending lines
1108 diff = git("diff", f"{shaidx}^!", "--check", ignore_non_zero=True)
1124 …doc = "See https://docs.zephyrproject.org/latest/contribute/guidelines.html#commit-guidelines for …
1125 path_hint = "<git-top>"
1131 subprocess.run('gitlint --commits ' + COMMIT_RANGE,
1138 self.failure(ex.output.decode("utf-8"))
1143 Runs pylint on all .py files, with a limited set of checks enabled. The
1148 path_hint = "<git-top>"
1159 # List of files added/modified by the commit(s).
1160 files = get_files(filter="d")
1162 # Filter out everything but Python files. Keep filenames
1165 py_files = filter_py(GIT_TOP, files)
1176 pylintcmd = ["pylint", "--output-format=json2", "--rcfile=" + pylintrc,
1177 "--load-plugins=argparse-checker"] + py_files
1187 output = ex.output.decode("utf-8")
1208 # Uses the python-magic library, so that we can detect Python
1209 # files that don't end in .py as well. python-magic is a frontend
1214 mime=True) == "text/x-python")]
1219 Checks if Emails of author and signed-off messages are consistent.
1222 …doc = "See https://docs.zephyrproject.org/latest/contribute/guidelines.html#commit-guidelines for …
1223 # git rev-list and git log don't depend on the current (sub)directory
1225 path_hint = "<git-top>"
1229 commit = git("log", "--decorate=short", "-n 1", shaidx)
1242 match = re.search(r"signed-off-by:\s(.*)", line, re.IGNORECASE)
1247 f"the signed-off-by entries."
1271 Check that the diff contains no binary files.
1274 doc = "No binary files allowed."
1275 path_hint = "<git-top>"
1279 # svg files are always detected as binary, see .gitattributes
1282 for stat in git("diff", "--numstat", "--diff-filter=A",
1285 if added == "-" and deleted == "-":
1297 doc = "Check the size of image files."
1298 path_hint = "<git-top>"
1328 path_hint = "<git-top>"
1348 path_hint = "<git-top>"
1382 doc = "Check YAML files with YAMLLint."
1383 path_hint = "<git-top>"
1395 # Tweak few rules for workflow files.
1396 yaml_config.rules["line-length"] = False
1397 yaml_config.rules["truthy"]["allowed-values"].extend(['on', 'off'])
1399 yaml_config.rules["truthy"]["allowed-values"].extend(['yes', 'no'])
1413 path_hint = "<git-top>"
1415 MARKER = "zephyr-keep-sorted"
1423 lines[-1] += line.strip()
1441 start_marker = f"{self.MARKER}-start"
1442 stop_marker = f"{self.MARKER}-stop"
1461 stop_line = line_num - 1
1465 f"\"ex -s -c '{start_line},{stop_line} sort i|x' {file}\"")
1490 console.setFormatter(logging.Formatter('%(levelname)-8s: %(message)s'))
1514 …https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#about-work…
1524 if hint == "<zephyr-base>":
1526 elif hint == "<git-top>":
1537 parser.add_argument('-c', '--commits', default=default_range,
1540 parser.add_argument('-o', '--output', default="compliance.xml",
1543 parser.add_argument('-n', '--no-case-output', action="store_true",
1545 parser.add_argument('-l', '--list', action="store_true",
1547 parser.add_argument("-v", "--loglevel", choices=['DEBUG', 'INFO', 'WARNING',
1550 parser.add_argument('-m', '--module', action="append", default=[],
1553 parser.add_argument('-e', '--exclude-module', action="append", default=[],
1556 parser.add_argument('-j', '--previous-run', default=None,
1557 help='''Pre-load JUnit results in XML format
1559 parser.add_argument('--annotate', action="store_true",
1560 help="Print GitHub Actions-compatible annotations.")
1578 # The absolute path of the top-level git directory. Initialize it here so
1581 GIT_TOP = git("rev-parse", "--show-toplevel")
1583 # The commit range passed in --commit, e.g. "HEAD~3"
1600 # (the script is currently run multiple times by the ci-pipelines
1620 # been --tests and --exclude-tests or the like, but it's awkward to
1691 # pylint: disable=unused-import
1712 # Formats the command-line arguments in the iterable 'cmd' into a string,