Skip to content

Commit

Permalink
pw_presubmit: Exclude third_party/fuchsia/repo from formatting
Browse files Browse the repository at this point in the history
Do not automatically format sources that will be imported from
Fuchsia. A .clang-format file is included for these sources, but they
may have been formatted by a different version of clang-format.

Change-Id: I587047340425aa8521abfcf97b77845dae3b834a
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/103884
Pigweed-Auto-Submit: Wyatt Hepler <hepler@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
Reviewed-by: Rob Mohr <mohrr@google.com>
  • Loading branch information
255 authored and CQ Bot Account committed Jul 29, 2022
1 parent 1d411dc commit c8bb7b1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions PW_PLUGINS
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# return an int to use as the exit code.

# Pigweed's presubmit check script
format pw_presubmit.format_code _pigweed_upstream_main
heap-viewer pw_allocator.heap_viewer main
package pw_package.pigweed_packages main
presubmit pw_presubmit.pigweed_presubmit main
Expand Down
13 changes: 13 additions & 0 deletions pw_presubmit/py/pw_presubmit/format_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,19 @@ def main() -> int:
return format_paths_in_repo(**vars(arguments(git_paths=True).parse_args()))


def _pigweed_upstream_main() -> int:
"""Check and fix formatting for source files in upstream Pigweed.
Excludes third party sources.
"""
args = arguments(git_paths=True).parse_args()

# Exclude paths with third party code from formatting.
args.exclude.append(re.compile('^third_party/fuchsia/repo/'))

return format_paths_in_repo(**vars(args))


if __name__ == '__main__':
try:
# If pw_cli is available, use it to initialize logs.
Expand Down

0 comments on commit c8bb7b1

Please sign in to comment.