Skip to content

Commit 0ae4572

Browse files
feat: add clang-format style configuration (#5424)
1 parent e71a37d commit 0ae4572

File tree

5 files changed

+6
-1
lines changed

5 files changed

+6
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ You can configure super-linter using the following environment variables:
194194
| **BASH_EXEC_IGNORE_LIBRARIES** | `false` | If set to `true`, shell files with a file extension and no shebang line are ignored when checking if the executable bit is set. |
195195
| **BASH_SEVERITY** | `style` | Specify the minimum severity of errors to consider in shellcheck. Valid values in order of severity are error, warning, info and style. |
196196
| **CHECKOV_FILE_NAME** | `.checkov.yaml` | Configuration filename for Checkov. |
197+
| **CLANG_FORMAT_FILE_NAME** | `.clang-format` | Configuration filename for [clang-format](https://clang.llvm.org/docs/ClangFormatStyleOptions.html). |
197198
| **CREATE_LOG_FILE** | `false` | If set to `true`, it creates the log file. You can set the log filename using the `LOG_FILE` environment variable. This overrides any existing log files. |
198199
| **CSS_FILE_NAME** | `.stylelintrc.json` | Filename for [Stylelint configuration](https://github.com/stylelint/stylelint) (ex: `.stylelintrc.yml`, `.stylelintrc.yaml`) |
199200
| **DEFAULT_BRANCH** | Default repository branch when running on GitHub Actions, `master` otherwise | The name of the repository default branch. There's no need to configure this variable when running on GitHub Actions |

TEMPLATES/.clang-format

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
BasedOnStyle: LLVM

lib/functions/linterCommands.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ else
3131
debug "Adding the '--directory' option to the Checkov command."
3232
LINTER_COMMANDS_ARRAY_CHECKOV+=(--directory)
3333
fi
34-
LINTER_COMMANDS_ARRAY_CLANG_FORMAT=(clang-format --Werror --dry-run)
34+
LINTER_COMMANDS_ARRAY_CLANG_FORMAT=(clang-format --style=file:"${CLANG_FORMAT_LINTER_RULES}" --Werror --dry-run)
3535
LINTER_COMMANDS_ARRAY_CLOJURE=(clj-kondo --config "${CLOJURE_LINTER_RULES}" --lint)
3636
LINTER_COMMANDS_ARRAY_CLOUDFORMATION=(cfn-lint --config-file "${CLOUDFORMATION_LINTER_RULES}")
3737
LINTER_COMMANDS_ARRAY_COFFEESCRIPT=(coffeelint -f "${COFFEESCRIPT_LINTER_RULES}")

lib/linter.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@ ARM_FILE_NAME=".arm-ttk.psd1"
152152
BASH_SEVERITY="${BASH_SEVERITY:-""}"
153153
CHECKOV_FILE_NAME="${CHECKOV_FILE_NAME:-".checkov.yaml"}"
154154
# shellcheck disable=SC2034 # Variable is referenced indirectly
155+
CLANG_FORMAT_FILE_NAME="${CLANG_FORMAT_FILE_NAME:-".clang-format"}"
156+
# shellcheck disable=SC2034 # Variable is referenced indirectly
155157
CLOJURE_FILE_NAME=".clj-kondo/config.edn"
156158
# shellcheck disable=SC2034 # Variable is referenced indirectly
157159
CLOUDFORMATION_FILE_NAME=".cfnlintrc.yml"

test/inspec/super-linter/controls/super_linter.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,7 @@
474474
"/action/lib/.automation/.cfnlintrc.yml",
475475
"/action/lib/.automation/.checkov.yaml",
476476
"/action/lib/.automation/.chktexrc",
477+
"/action/lib/.automation/.clang-format",
477478
"/action/lib/.automation/.clj-kondo",
478479
"/action/lib/.automation/.coffee-lint.json",
479480
"/action/lib/.automation/.ecrc",

0 commit comments

Comments
 (0)