Lines Matching +full:files +full:- +full:exclude
5 # SPDX-License-Identifier: Apache-2.0
51 f"{cp.stdout.decode('utf-8')}\n"
53 f"{cp.stderr.decode('utf-8')}\n")
55 return cp.stdout.decode("utf-8").rstrip()
64 return git('rev-list',
65 f'--max-count={-1 if "." in refspec else 1}', refspec).split()
68 filter_arg = (f'--diff-filter={filter}',) if filter else ()
69 paths_arg = ('--', *paths) if paths else ()
70 out = git('diff', '--name-only', *filter_arg, COMMIT_RANGE, *paths_arg)
71 files = out.splitlines()
72 for file in list(files):
75 files.remove(file)
76 return files
117 - The magic string "<zephyr-base>" can be used to refer to the
120 - The magic string "<git-top>" refers to the top-level repository
121 directory. This avoids running 'git' to find the top-level directory
195 …doc = "See https://docs.zephyrproject.org/latest/contribute/guidelines.html#coding-style for more …
196 path_hint = "<git-top>"
207 subprocess.run((checkpatch, '--mailback', '--no-tree', '-'),
215 output = ex.output.decode("utf-8")
235 path_hint = "<zephyr-base>"
245 Returns a list of dts/bindings/**/*.yaml files
274 path_hint = "<zephyr-base>"
303 # not a module nor a pip-installed Python utility
307 '--kconfig-out', modules_file, '--settings-out', settings_file]
312 self.error(ex.output.decode("utf-8"))
324 re.sub('[^a-zA-Z0-9]', '_', module).upper(),
337 # not a module nor a pip-installed Python utility
354 '--kconfig-out', kconfig_dts_file, '--bindings-dirs']
361 self.error(ex.output.decode("utf-8"))
366 Returns a kconfiglib.Kconfig object for the Kconfig files. We reuse
383 # Look up Kconfig files relative to ZEPHYR_BASE
407 # symbols within Kconfig files
431 # Warning: Needs to work with both --perl-regexp and the 're' module.
432 # (?:...) is a non-capturing group.
433 regex = r"^\s*(?:menu)?config\s*([A-Z0-9_]+)\s*(?:#|$)"
436 grep_stdout = git("grep", "-I", "-h", "--perl-regexp", regex, "--",
450 Checks that there aren't too many items in the top-level menu (which
459 # shown in the menuconfig (outside show-all mode).
467 prompts) in the top-level Kconfig menu, found {n_top_items} items. If you're
476 # pylint: disable=undefined-variable
482 Options must not be defined in defconfig files.
490 # skip Kconfig nodes not in-tree (will present an absolute path)
495 # pylint: disable=undefined-variable
513 # children in the Kconfig files
518 # pylint: disable=undefined-variable
532 https://docs.zephyrproject.org/latest/build/kconfig/tips.html#menuconfig-symbols.
540 the Kconfig files
551 outside Kconfig files (any CONFIG_FOO where no FOO symbol exists)
560 # 'git grep --only-matching' would get rid of the surrounding context
567 # - ##, for token pasting (CONFIG_FOO_##X)
569 # - $, e.g. for CMake variable expansion (CONFIG_FOO_${VAR})
571 # - @, e.g. for CMakes's configure_file() (CONFIG_FOO_@VAR@)
573 # - {, e.g. for Python scripts ("CONFIG_FOO_{}_BAR".format(...)")
575 # - *, meant for comments like '#endif /* CONFIG_FOO_* */
582 # Warning: Needs to work with both --perl-regexp and the 're' module
583 regex = r"\bCONFIG_[A-Z0-9_]+\b(?!\s*##|[$@{*])"
586 grep_stdout = git("grep", "--line-number", "-I", "--null",
587 "--perl-regexp", regex, "--", ":!/doc/releases",
645 "BOOT_SERIAL_BOOT_MODE", # Used in (sysbuild-based) test/
647 "BOOT_SERIAL_CDC_ACM", # Used in (sysbuild-based) test
648 "BOOT_SERIAL_ENTRANCE_GPIO", # Used in (sysbuild-based) test
651 "BOOT_SHARE_DATA_BOOTINFO", # Used in (sysbuild-based) test
658 "BOOT_VALIDATE_SLOT0", # Used in (sysbuild-based) test
659 "BOOT_WATCHDOG_FEED", # Used in (sysbuild-based) test
669 "CMD_CACHE", # Defined in U-Boot, mentioned in docs
695 "MCUBOOT_ACTION_HOOKS", # Used in (sysbuild-based) test
696 "MCUBOOT_CLEANUP_ARM_CORE", # Used in (sysbuild-based) test
697 "MCUBOOT_SERIAL", # Used in (sysbuild-based) test/
756 path_hint = "<zephyr-base>"
769 path_hint = "<zephyr-base>"
776 Checks various nits in added/modified files. Doesn't check stuff that's
780 …doc = "See https://docs.zephyrproject.org/latest/contribute/guidelines.html#coding-style for more …
781 path_hint = "<git-top>"
784 # Loop through added/modified files
803 # Checks for a spammy copy-pasted header format
805 with open(os.path.join(GIT_TOP, fname), encoding="utf-8") as f:
808 # 'Kconfig - yada yada' has a copy-pasted redundant filename at the
809 # top. This probably means all of the header was copy-pasted.
810 if re.match(r"\s*#\s*(K|k)config[\w.-]*\s*-", contents):
813 https://docs.zephyrproject.org/latest/build/kconfig/tips.html#header-comments-and-other-nits):
818 # SPDX-License-Identifier: <License>
822 Skip the "Kconfig - " part of the first line, since it's clear that the comment
823 is about Kconfig from context. The "# Kconfig - " is what triggers this
831 with open(os.path.join(GIT_TOP, fname), encoding="utf-8") as f:
846 with open(os.path.join(GIT_TOP, fname), encoding="utf-8") as f:
849 Redundant '...' document separator in {fname}. Binding YAML files are never
853 # Generic nits related to various source files
855 with open(os.path.join(GIT_TOP, fname), encoding="utf-8") as f:
871 Checks for conflict markers or whitespace errors with git diff --check
875 path_hint = "<git-top>"
880 # Reason: `--check` is mutually exclusive with `--name-only` and `-s`
884 # Ignore non-zero return status code
885 # Reason: `git diff --check` sets the return code to the number of offending lines
886 diff = git("diff", f"{shaidx}^!", "--check", ignore_non_zero=True)
902 …doc = "See https://docs.zephyrproject.org/latest/contribute/guidelines.html#commit-guidelines for …
903 path_hint = "<git-top>"
909 subprocess.run('gitlint --commits ' + COMMIT_RANGE,
916 self.failure(ex.output.decode("utf-8"))
921 Runs pylint on all .py files, with a limited set of checks enabled. The
926 path_hint = "<git-top>"
937 # List of files added/modified by the commit(s).
938 files = get_files(filter="d")
940 # Filter out everything but Python files. Keep filenames
943 py_files = filter_py(GIT_TOP, files)
954 pylintcmd = ["pylint", "--rcfile=" + pylintrc,
955 "--load-plugins=argparse-checker"] + py_files
965 output = ex.output.decode("utf-8")
966 regex = r'^\s*(\S+):(\d+):(\d+):\s*([A-Z]\d{4}):\s*(.*)$'
988 # Uses the python-magic library, so that we can detect Python
989 # files that don't end in .py as well. python-magic is a frontend
994 mime=True) == "text/x-python")]
999 Checks if Emails of author and signed-off messages are consistent.
1002 …doc = "See https://docs.zephyrproject.org/latest/contribute/guidelines.html#commit-guidelines for …
1003 # git rev-list and git log don't depend on the current (sub)directory
1005 path_hint = "<git-top>"
1009 commit = git("log", "--decorate=short", "-n 1", shaidx)
1022 match = re.search(r"signed-off-by:\s(.*)", line, re.IGNORECASE)
1027 f"the signed-off-by entries."
1051 Check that the diff contains no binary files.
1054 doc = "No binary files allowed."
1055 path_hint = "<git-top>"
1059 # svg files are always detected as binary, see .gitattributes
1062 for stat in git("diff", "--numstat", "--diff-filter=A",
1065 if added == "-" and deleted == "-":
1077 doc = "Check the size of image files."
1078 path_hint = "<git-top>"
1108 path_hint = "<git-top>"
1128 path_hint = "<git-top>"
1162 doc = "Check YAML files with YAMLLint."
1163 path_hint = "<git-top>"
1175 # Tweak few rules for workflow files.
1176 yaml_config.rules["line-length"] = False
1177 yaml_config.rules["truthy"]["allowed-values"].extend(['on', 'off'])
1179 yaml_config.rules["truthy"]["allowed-values"].extend(['yes', 'no'])
1193 path_hint = "<git-top>"
1195 MARKER = "zephyr-keep-sorted"
1203 lines[-1] += line.strip()
1221 start_marker = f"{self.MARKER}-start"
1222 stop_marker = f"{self.MARKER}-stop"
1265 console.setFormatter(logging.Formatter('%(levelname)-8s: %(message)s'))
1289 …https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#about-work…
1299 if hint == "<zephyr-base>":
1301 elif hint == "<git-top>":
1312 parser.add_argument('-c', '--commits', default=default_range,
1315 parser.add_argument('-o', '--output', default="compliance.xml",
1318 parser.add_argument('-n', '--no-case-output', action="store_true",
1320 parser.add_argument('-l', '--list', action="store_true",
1322 parser.add_argument("-v", "--loglevel", choices=['DEBUG', 'INFO', 'WARNING',
1325 parser.add_argument('-m', '--module', action="append", default=[],
1328 parser.add_argument('-e', '--exclude-module', action="append", default=[],
1331 parser.add_argument('-j', '--previous-run', default=None,
1332 help='''Pre-load JUnit results in XML format
1334 parser.add_argument('--annotate', action="store_true",
1335 help="Print GitHub Actions-compatible annotations.")
1353 # The absolute path of the top-level git directory. Initialize it here so
1356 GIT_TOP = git("rev-parse", "--show-toplevel")
1358 # The commit range passed in --commit, e.g. "HEAD~3"
1375 # (the script is currently run multiple times by the ci-pipelines
1395 # been --tests and --exclude-tests or the like, but it's awkward to
1466 # pylint: disable=unused-import
1487 # Formats the command-line arguments in the iterable 'cmd' into a string,