Lines Matching +full:commit +full:- +full:message
5 # SPDX-License-Identifier: Apache-2.0
56 f"{cp.stdout.decode('utf-8')}\n"
58 f"{cp.stderr.decode('utf-8')}\n")
60 return cp.stdout.decode("utf-8").rstrip()
69 return git('rev-list',
70 f'--max-count={-1 if "." in refspec else 1}', refspec).split()
73 filter_arg = (f'--diff-filter={filter}',) if filter else ()
74 paths_arg = ('--', *paths) if paths else ()
75 out = git('diff', '--name-only', *filter_arg, COMMIT_RANGE, *paths_arg)
124 the message that gets printed when running the test.
127 - The magic string "<zephyr-base>" can be used to refer to the
130 - The magic string "<git-top>" refers to the top-level repository
131 directory. This avoids running 'git' to find the top-level directory
149 Signals a problem with running the test, with message 'msg'.
161 Signals that the test should be skipped, with message 'msg'.
173 Signals that the test failed, with message 'msg'. Can be called many
206 …doc = "See https://docs.zephyrproject.org/latest/contribute/guidelines.html#coding-style for more …
207 path_hint = "<git-top>"
217 …self.failure("Perl not installed - required for checkpatch.pl. Please install Perl or add to PATH.…
226 cmd.extend(['--mailback', '--no-tree', '-'])
227 diff = subprocess.Popen(('git', 'diff', '--no-ext-diff', COMMIT_RANGE),
239 output = ex.output.decode("utf-8")
266 path_hint = "<zephyr-base>"
282 with open(os.path.join(ZEPHYR_BASE, "dts", "bindings", "vendor-prefixes.txt")) as fp:
291 self.error(f"Invalid line in vendor-prefixes.txt:\"{line}\".")
301 Check if clang-format reports any issues
304 …doc = "See https://docs.zephyrproject.org/latest/contribute/guidelines.html#clang-format for more …
305 path_hint = "<git-top>"
308 exe = f"clang-format-diff.{'exe' if platform.system() == 'Windows' else 'py'}"
314 diff = subprocess.Popen(('git', 'diff', '-U0', '--no-color', COMMIT_RANGE, '--', file),
318 subprocess.run((exe, '-p1'),
326 patchset = unidiff.PatchSet.from_string(ex.output, encoding="utf-8")
330 before = next(i for i,v in enumerate(hunk) if str(v).startswith(('-', '+')))
331 … after = next(i for i,v in enumerate(reversed(hunk)) if str(v).startswith(('-', '+')))
332 msg = "".join([str(l) for l in hunk[before:-after or None]])
336 "You may want to run clang-format on this change",
337 file, line=hunk.source_start + hunk.source_length - after,
347 path_hint = "<zephyr-base>"
384 path_hint = "<zephyr-base>"
386 # Top-level Kconfig file. The path can be relative to srctree (ZEPHYR_BASE).
413 # not a module nor a pip-installed Python utility
417 '--kconfig-out', modules_file,
418 '--sysbuild-kconfig-out', sysbuild_modules_file,
419 '--settings-out', settings_file]
424 self.error(ex.output.decode("utf-8"))
436 re.sub('[^a-zA-Z0-9]', '_', module).upper(),
447 # not a module nor a pip-installed Python utility
470 # not a module nor a pip-installed Python utility
481 '--kconfig-out', kconfig_dts_file, '--bindings-dirs']
488 self.error(ex.output.decode("utf-8"))
530 board_str = 'BOARD_' + re.sub(r"[^a-zA-Z0-9_]", "_", board.name).upper()
535 re.sub(r"[^a-zA-Z0-9_]", "_", qualifier)).upper()
661 # Warning: Needs to work with both --perl-regexp and the 're' module.
662 regex = r"^\s*(?:module\s*=\s*)([A-Z0-9_]+)\s*(?:#|$)"
665 grep_stdout = git("grep", "-I", "-h", "--perl-regexp", regex, "--",
688 # 'git grep --only-matching' would get rid of the surrounding context
695 # - ##, for token pasting (CONFIG_FOO_##X)
697 # - $, e.g. for CMake variable expansion (CONFIG_FOO_${VAR})
699 # - @, e.g. for CMakes's configure_file() (CONFIG_FOO_@VAR@)
701 # - {, e.g. for Python scripts ("CONFIG_FOO_{}_BAR".format(...)")
703 # - *, meant for comments like '#endif /* CONFIG_FOO_* */
711 # Warning: Needs to work with both --perl-regexp and the 're' module
712 regex_boards = r"\bCONFIG_[A-Z0-9_]+\b(?!\s*##|[$@{(.*])"
713 regex_socs = r"\bconfig\s+[A-Z0-9_]+$"
715 grep_stdout_boards = git("grep", "--line-number", "-I", "--null",
716 "--perl-regexp", regex_boards, "--", ":boards",
718 grep_stdout_socs = git("grep", "--line-number", "-I", "--null",
719 "--perl-regexp", regex_socs, "--", ":soc",
731 if re.match(disallowed_regex, sym_name) and (path[-len("conf"):] == "conf" or
732 path[-len("defconfig"):] == "defconfig"):
763 # Warning: Needs to work with both --perl-regexp and the 're' module.
764 # (?:...) is a non-capturing group.
765 regex = r"^\s*(?:menu)?config\s*([A-Z0-9_]+)\s*(?:#|$)"
768 grep_stdout = git("grep", "-I", "-h", "--perl-regexp", regex, "--",
783 Checks that there aren't too many items in the top-level menu (which
792 # shown in the menuconfig (outside show-all mode).
800 prompts) in the top-level Kconfig menu, found {n_top_items} items. If you're
809 # pylint: disable=undefined-variable
823 # skip Kconfig nodes not in-tree (will present an absolute path)
828 # pylint: disable=undefined-variable
851 # pylint: disable=undefined-variable
865 https://docs.zephyrproject.org/latest/build/kconfig/tips.html#menuconfig-symbols.
890 # pylint: disable=undefined-variable
921 # 'git grep --only-matching' would get rid of the surrounding context
928 # - ##, for token pasting (CONFIG_FOO_##X)
930 # - $, e.g. for CMake variable expansion (CONFIG_FOO_${VAR})
932 # - @, e.g. for CMakes's configure_file() (CONFIG_FOO_@VAR@)
934 # - {, e.g. for Python scripts ("CONFIG_FOO_{}_BAR".format(...)")
936 # - *, meant for comments like '#endif /* CONFIG_FOO_* */
943 # Warning: Needs to work with both --perl-regexp and the 're' module
944 regex = r"\b" + self.CONFIG_ + r"[A-Z0-9_]+\b(?!\s*##|[$@{(.*])"
948 grep_stdout = git("grep", "--line-number", "-I", "--null",
949 "--perl-regexp", regex, "--", ":!/doc/releases",
963 not (sym_name.endswith("_MODULE") and sym_name[:-7] in defined_syms):
995 # zephyr-keep-sorted-start re(^\s+")
1018 "BOOT_SERIAL_BOOT_MODE", # Used in (sysbuild-based) test/
1020 "BOOT_SERIAL_CDC_ACM", # Used in (sysbuild-based) test
1021 "BOOT_SERIAL_ENTRANCE_GPIO", # Used in (sysbuild-based) test
1025 "BOOT_SHARE_DATA_BOOTINFO", # Used in (sysbuild-based) test
1036 "BOOT_VALIDATE_SLOT0", # Used in (sysbuild-based) test
1037 "BOOT_WATCHDOG_FEED", # Used in (sysbuild-based) test
1043 "CMD_CACHE", # Defined in U-Boot, mentioned in docs
1074 "MCUBOOT_ACTION_HOOKS", # Used in (sysbuild-based) test
1075 "MCUBOOT_CLEANUP_ARM_CORE", # Used in (sysbuild-based) test
1081 "MCUBOOT_SERIAL", # Used in (sysbuild-based) test/
1094 "PSA_H", # This is used in config-psa.h as guard for the header file
1123 # zephyr-keep-sorted-stop
1161 This ensures the board and SoC trees are fully self-contained and reusable.
1182 # zephyr-keep-sorted-start re(^\s+")
1192 # zephyr-keep-sorted-stop
1221 …doc = "See https://docs.zephyrproject.org/latest/contribute/guidelines.html#coding-style for more …
1222 path_hint = "<git-top>"
1244 # Checks for a spammy copy-pasted header format
1246 with open(os.path.join(GIT_TOP, fname), encoding="utf-8") as f:
1249 # 'Kconfig - yada yada' has a copy-pasted redundant filename at the
1250 # top. This probably means all of the header was copy-pasted.
1251 if re.match(r"\s*#\s*(K|k)config[\w.-]*\s*-", contents):
1254 https://docs.zephyrproject.org/latest/build/kconfig/tips.html#header-comments-and-other-nits):
1259 # SPDX-License-Identifier: <License>
1263 Skip the "Kconfig - " part of the first line, since it's clear that the comment
1264 is about Kconfig from context. The "# Kconfig - " is what triggers this
1272 with open(os.path.join(GIT_TOP, fname), encoding="utf-8") as f:
1287 with open(os.path.join(GIT_TOP, fname), encoding="utf-8") as f:
1296 with open(os.path.join(GIT_TOP, fname), encoding="utf-8") as f:
1312 Checks for conflict markers or whitespace errors with git diff --check
1316 path_hint = "<git-top>"
1321 # Reason: `--check` is mutually exclusive with `--name-only` and `-s`
1325 # Ignore non-zero return status code
1326 # Reason: `git diff --check` sets the return code to the number of offending lines
1327 diff = git("diff", f"{shaidx}^!", "--check", ignore_non_zero=True)
1343 …doc = "See https://docs.zephyrproject.org/latest/contribute/guidelines.html#commit-guidelines for …
1344 path_hint = "<git-top>"
1350 subprocess.run('gitlint --commits ' + COMMIT_RANGE,
1357 self.failure(ex.output.decode("utf-8"))
1367 path_hint = "<git-top>"
1378 # List of files added/modified by the commit(s).
1395 pylintcmd = ["pylint", "--output-format=json2", "--rcfile=" + pylintrc,
1396 "--load-plugins=argparse-checker"] + py_files
1406 output = ex.output.decode("utf-8")
1415 m['line'], col=str(m['column']), desc=m['message']
1427 # Uses the python-magic library, so that we can detect Python
1428 # files that don't end in .py as well. python-magic is a frontend
1433 mime=True) == "text/x-python")]
1438 Checks if Emails of author and signed-off messages are consistent.
1441 …doc = "See https://docs.zephyrproject.org/latest/contribute/guidelines.html#commit-guidelines for …
1442 # git rev-list and git log don't depend on the current (sub)directory
1444 path_hint = "<git-top>"
1449 'show', '-s', '--format=%an%n%ae%n%b', shaidx
1452 match_signoff = re.search(r"signed-off-by:\s(.*)", body,
1454 detailed_match = re.search(r"signed-off-by:\s(.*) <(.*)>", body,
1465 failures.append(f'{shaidx}: Missing signed-off-by line')
1468 failures.append(f"{shaidx}: Signed-off-by line ({signoff}) "
1473 "to match one of the signed-off-by entries.")
1485 path_hint = "<git-top>"
1492 for stat in git("diff", "--numstat", "--diff-filter=A",
1495 if added == "-" and deleted == "-":
1508 path_hint = "<git-top>"
1538 path_hint = "<git-top>"
1558 path_hint = "<git-top>"
1593 path_hint = "<git-top>"
1606 yaml_config.rules["line-length"] = False
1607 yaml_config.rules["truthy"]["allowed-values"].extend(['on', 'off'])
1609 yaml_config.rules["truthy"]["allowed-values"].extend(['yes', 'no'])
1623 doc = "Check Sphinx/reStructuredText files with sphinx-lint."
1624 path_hint = "<git-top>"
1626 # Checkers added/removed to sphinx-lint's default set
1627 DISABLE_CHECKERS = ["horizontal-tab", "missing-space-before-default-role"]
1628 ENABLE_CHECKERS = ["default-role"]
1636 # sphinx-lint does not expose a public API so interaction is done via CLI
1638 … f"sphinx-lint -d {','.join(self.DISABLE_CHECKERS)} -e {','.join(self.ENABLE_CHECKERS)} {file}",
1647 for line in ex.output.decode("utf-8").splitlines():
1666 path_hint = "<git-top>"
1668 MARKER = "zephyr-keep-sorted"
1702 return -1
1713 start_marker = f"{self.MARKER}-start"
1714 stop_marker = f"{self.MARKER}-stop"
1741 desc = f"sorted block has out-of-order line at {start_line + idx}"
1762 path_hint = "<git-top>"
1771 f"ruff check --force-exclude --output-format=json {file}",
1779 output = ex.output.decode("utf-8")
1790 desc=m.get("message"),
1794 f"ruff format --force-exclude --diff {file}",
1806 Check that any text file is encoded in ascii or utf-8.
1810 path_hint = "<git-top>"
1812 ALLOWED_CHARSETS = ["us-ascii", "utf-8"]
1825 if mime_type.rsplit('=')[-1] not in self.ALLOWED_CHARSETS:
1838 console.setFormatter(logging.Formatter('%(levelname)-8s: %(message)s'))
1862 …https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#about-work…
1864 msg = res.message.replace('%', '%25').replace('\n', '%0A').replace('\r', '%0D')
1875 if hint == "<zephyr-base>":
1877 elif hint == "<git-top>":
1888 parser.add_argument('-c', '--commits', default=default_range,
1889 help=f'''Commit range in the form: a..[b], default is
1891 parser.add_argument('-o', '--output', default="compliance.xml",
1894 parser.add_argument('-n', '--no-case-output', action="store_true",
1896 parser.add_argument('-l', '--list', action="store_true",
1898 parser.add_argument("-v", "--loglevel", choices=['DEBUG', 'INFO', 'WARNING',
1901 parser.add_argument('-m', '--module', action="append", default=[],
1904 parser.add_argument('-e', '--exclude-module', action="append", default=[],
1907 parser.add_argument('-j', '--previous-run', default=None,
1908 help='''Pre-load JUnit results in XML format
1910 parser.add_argument('--annotate', action="store_true",
1911 help="Print GitHub Actions-compatible annotations.")
1929 # The absolute path of the top-level git directory. Initialize it here so
1932 GIT_TOP = git("rev-parse", "--show-toplevel")
1934 # The commit range passed in --commit, e.g. "HEAD~3"
1940 logger.info(f'Running tests on commit range {COMMIT_RANGE}')
1951 # (the script is currently run multiple times by the ci-pipelines
1971 # been --tests and --exclude-tests or the like, but it's awkward to
2042 # pylint: disable=unused-import
2063 # Formats the command-line arguments in the iterable 'cmd' into a string,