Commit Graph

59 Commits

Author SHA1 Message Date
Wyatt Hepler
bc292b9152 pw_presubmit: Rename format_cc to format_code
- Rename format_cc.py to format_code.py to make it language-agnostic.
- Exclude non-existing paths in the presubmit to handle deletions.

Change-Id: If07decfd9fe11539bd5ccc74243f00cbf33736b8
2019-12-04 23:50:19 +00:00
Wyatt Hepler
f2278ee6b0 presubmit: Fix invoking script directly
Change-Id: I1dff5a6d91335ecf7213b0c3f9e511cc067318ef
2019-12-03 17:06:14 +00:00
Wyatt Hepler
3767c3a5b2 Script for installing a presubmit pre-push hook
- The install_hook.py script installs a simple presubmit hook that wraps
  another command.
- Add an --install option to Pigweed's presubmit that installs the
  commit hook and exits.

Change-Id: I1b9296b103e0b94e1ff44cc5b274590f56f72831
2019-12-02 14:26:14 -08:00
Wyatt Hepler
c426bdc032 pw_presubmit: Improve final summary
List total, passed, failed, and skipped presubmit checks.

Example:
╔════════╦═══════════════════════════════════════════════════╦════════╗
║ FAILED ║ 14 checks: 8 passed, 1 failed, 5 skipped          ║ 0:01.9 ║
╚════════╩═══════════════════════════════════════════════════╩════════╝

Change-Id: Icccc718ebd194acad1760dadb9f76f81995103ed
2019-12-02 14:25:58 -08:00
Wyatt Hepler
c18f4b28d7 presubmit: Make pw_presubmit a package and plugin
- Organize pw_presubmit as a Python package.
- Move presubmit.py to into the package as pigweed_presubmit.py.
- Set up pigweed_presubmit.py to run whether the pw_presubmit package is
  installed or not.

Change-Id: Id85937971d554332ab7d4adfd668eeafa6379976
2019-12-02 22:00:40 +00:00
Wyatt Hepler
dac350b8e1 presubmit: Improve venv setup; expand checks
- Use env_setup/virtualenv/init.py to setup the Python venv.
- Improve diff colorization.
- Add function for finding Python packages from .py file changes.
- Add check that runs Python tests.
- Enable full pylint and yapf as warnings.
- Delete unused code in watch.py that used an undefined variable.
- Enable required python -E check.

Change-Id: I5ba9882ea9ec93f006260d5636031dd0b5005a85
2019-12-02 21:37:19 +00:00
Wyatt Hepler
13225146e9 pw_presubmit: clang-format wrapper; misc
- Add format_cc.py, which simplifies using clang-format in presubmits by
  checking for changes and printing a colorized diff.
- Add --continue option to presubmit_tools.py to continue running checks
  after a failure.
- Add exclude option to filter_paths.

Change-Id: If17cf84b3e33550054a10f36df6403dada9005b4
2019-11-27 22:34:02 +00:00
Wyatt Hepler
204b00d561 Update presubmit.py to use pw_presubmit
- Run presubmits with presubmit_tools's parse_args_and_run_presubmit.
  Running without arguments runs against the whole repo, as before.
- Move the call helper into presubmit_tools.py and expand it.
- Add gn_format and pylint presubmit checks.
- Add --check to gn invocation.

Change-Id: I5b20c2ccaac92d7550888aa2eed03043885e8502
2019-11-23 02:09:11 +00:00
Wyatt Hepler
7f3000e058 pw_presubmit: Common tools for running presubmits
pw_presubmit provides a presubmit runner and functions that can be
used to run presubmits in a Git repository.

Change-Id: I556bb6f7b70b66e5df0af7552f9ed41ce9ca08a0
2019-11-23 02:09:11 +00:00