Allow override of clang-format executable

Because GitHub's Ubuntu image offers multiple version fo clang-format, and
sometimes it seems to prefer a version lower than 12 (which is the minimum
required by our config file), I added an override via the new environment
variable `KALEIDOSCOPE_CODE_FORMATTER`.

Signed-off-by: Michael Richters <gedankenexperimenter@gmail.com>
pull/1162/head
Michael Richters 3 years ago
parent 9b04d6663c
commit 7db4fca6c0
No known key found for this signature in database
GPG Key ID: 1288FD13E4EEF0C0

@ -36,7 +36,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- run: make check-code-style - run: KALEIDOSCOPE_CODE_FORMATTER=clang-format-12 make check-code-style
check-shellcheck: check-shellcheck:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:

@ -172,7 +172,9 @@ def main():
return 1 return 1
# Locate `clang-format` executable: # Locate `clang-format` executable:
clang_format_exe = shutil.which('clang-format') clang_format_exe = os.getenv('KALEIDOSCOPE_CODE_FORMATTER')
if clang_format_exe is None:
clang_format_exe = shutil.which('clang-format')
logging.debug("Found `clang-format` executable: %s", clang_format_exe) logging.debug("Found `clang-format` executable: %s", clang_format_exe)
clang_format_cmd = [clang_format_exe, '-i'] clang_format_cmd = [clang_format_exe, '-i']
if opts.loglevel <= logging.INFO: if opts.loglevel <= logging.INFO:

Loading…
Cancel
Save