Skip to content

Commit

Permalink
pw_presubmit: Add ability to inject CodeFormats into presubmit_checks
Browse files Browse the repository at this point in the history
Change-Id: Id3111180e957efd42fd7246d09b9d237fc387998
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/105180
Reviewed-by: Wyatt Hepler <[email protected]>
Commit-Queue: Tim Laurence <[email protected]>
  • Loading branch information
Tim Laurence authored and CQ Bot Account committed Aug 5, 2022
1 parent 3bf6cd1 commit 75caac6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pw_presubmit/py/pw_presubmit/format_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,15 +392,18 @@ def check_code_format(ctx: pw_presubmit.PresubmitContext):


def presubmit_checks(
*, exclude: Collection[Union[str,
Pattern[str]]] = ()) -> Tuple[Callable, ...]:
*,
exclude: Collection[Union[str, Pattern[str]]] = (),
code_formats: Collection[CodeFormat] = CODE_FORMATS
) -> Tuple[Callable, ...]:
"""Returns a tuple with all supported code format presubmit checks.
Args:
exclude: Additional exclusion regexes to apply.
code_formats: A list of CodeFormat objects to run checks with.
"""

return tuple(presubmit_check(fmt, exclude=exclude) for fmt in CODE_FORMATS)
return tuple(presubmit_check(fmt, exclude=exclude) for fmt in code_formats)


class CodeFormatter:
Expand Down

0 comments on commit 75caac6

Please sign in to comment.