|
1 | 1 | #!/usr/bin/env bash |
2 | 2 |
|
3 | | -################################################################################ |
4 | | -################################################################################ |
5 | | -########### Super-Linter (Lint all the code) @admiralawkbar #################### |
6 | | -################################################################################ |
7 | | -################################################################################ |
8 | | - |
9 | 3 | ################################################################## |
10 | 4 | # Debug Vars # |
11 | 5 | # Define these early, so we can use debug logging ASAP if needed # |
@@ -69,6 +63,33 @@ for batch_worker_script in /action/lib/functions/experimental-batch-workers/*.sh |
69 | 63 | source "$batch_worker_script" |
70 | 64 | done |
71 | 65 |
|
| 66 | +# Initialize RUN_LOCAL early because we need it for logging |
| 67 | +DEFAULT_RUN_LOCAL='false' |
| 68 | + |
| 69 | +if [ -z "${RUN_LOCAL}" ]; then |
| 70 | + RUN_LOCAL="${DEFAULT_RUN_LOCAL}" |
| 71 | +fi |
| 72 | + |
| 73 | +# Convert string to lowercase |
| 74 | +RUN_LOCAL="${RUN_LOCAL,,}" |
| 75 | + |
| 76 | +# Dynamically set the default behavior for GitHub Actions log markers because |
| 77 | +# we want to give users a chance to enable this even when running locally, but |
| 78 | +# we still want to provide a default value in case they don't want to explictly |
| 79 | +# configure it. |
| 80 | +if [[ "${RUN_LOCAL}" == "true" ]]; then |
| 81 | + DEFAULT_ENABLE_GITHUB_ACTIONS_GROUP_TITLE="false" |
| 82 | +else |
| 83 | + DEFAULT_ENABLE_GITHUB_ACTIONS_GROUP_TITLE="true" |
| 84 | +fi |
| 85 | +# Let users configure GitHub Actions log markers regardless of running locally or not |
| 86 | +ENABLE_GITHUB_ACTIONS_GROUP_TITLE="${ENABLE_GITHUB_ACTIONS_GROUP_TITLE:-"${DEFAULT_ENABLE_GITHUB_ACTIONS_GROUP_TITLE}"}" |
| 87 | + |
| 88 | +startGitHubActionsLogGroup "${SUPER_LINTER_INITIALIZATION_LOG_GROUP_TITLE}" |
| 89 | + |
| 90 | +debug "RUN_LOCAL: ${RUN_LOCAL}" |
| 91 | +debug "ENABLE_GITHUB_ACTIONS_GROUP_TITLE: ${ENABLE_GITHUB_ACTIONS_GROUP_TITLE}" |
| 92 | + |
72 | 93 | ########### |
73 | 94 | # GLOBALS # |
74 | 95 | ########### |
@@ -377,7 +398,6 @@ debug "IGNORE_GENERATED_FILES: ${IGNORE_GENERATED_FILES}" |
377 | 398 | DEFAULT_VALIDATE_ALL_CODEBASE='true' # Default value for validate all files |
378 | 399 | DEFAULT_SUPER_LINTER_WORKSPACE="/tmp/lint" # Fall-back value for the workspace |
379 | 400 | DEFAULT_WORKSPACE="${DEFAULT_WORKSPACE:-${DEFAULT_SUPER_LINTER_WORKSPACE}}" # Default workspace if running locally |
380 | | -DEFAULT_RUN_LOCAL='false' # Default value for debugging locally |
381 | 401 | DEFAULT_TEST_CASE_RUN='false' # Flag to tell code to run only test cases |
382 | 402 |
|
383 | 403 | if [ -z "${TEST_CASE_RUN}" ]; then |
|
388 | 408 | TEST_CASE_RUN="${TEST_CASE_RUN,,}" |
389 | 409 | debug "TEST_CASE_RUN: ${TEST_CASE_RUN}" |
390 | 410 |
|
391 | | -if [ -z "${RUN_LOCAL}" ]; then |
392 | | - RUN_LOCAL="${DEFAULT_RUN_LOCAL}" |
393 | | -fi |
394 | | - |
395 | | -# Convert string to lowercase |
396 | | -RUN_LOCAL="${RUN_LOCAL,,}" |
397 | | -debug "RUN_LOCAL: ${RUN_LOCAL}" |
398 | | - |
399 | 411 | ############################################################### |
400 | 412 | # Default Vars that are called in Subs and need to be ignored # |
401 | 413 | ############################################################### |
@@ -1057,7 +1069,10 @@ else |
1057 | 1069 | EXPERIMENTAL_BATCH_WORKER="false" |
1058 | 1070 | fi |
1059 | 1071 |
|
| 1072 | +endGitHubActionsLogGroup "${SUPER_LINTER_INITIALIZATION_LOG_GROUP_TITLE}" |
| 1073 | + |
1060 | 1074 | for LANGUAGE in "${LANGUAGE_ARRAY[@]}"; do |
| 1075 | + startGitHubActionsLogGroup "${LANGUAGE}" |
1061 | 1076 | debug "Running linter for the ${LANGUAGE} language..." |
1062 | 1077 | VALIDATE_LANGUAGE_VARIABLE_NAME="VALIDATE_${LANGUAGE}" |
1063 | 1078 | debug "Setting VALIDATE_LANGUAGE_VARIABLE_NAME to ${VALIDATE_LANGUAGE_VARIABLE_NAME}..." |
@@ -1106,6 +1121,7 @@ for LANGUAGE in "${LANGUAGE_ARRAY[@]}"; do |
1106 | 1121 | debug "Invoking ${LINTER_NAME} linter. TEST_CASE_RUN: ${TEST_CASE_RUN}" |
1107 | 1122 | LintCodebase "${LANGUAGE}" "${LINTER_NAME}" "${LINTER_COMMAND}" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${TEST_CASE_RUN}" "${EXPERIMENTAL_BATCH_WORKER}" "${!LANGUAGE_FILE_ARRAY}" |
1108 | 1123 | fi |
| 1124 | + endGitHubActionsLogGroup "${LANGUAGE}" |
1109 | 1125 | done |
1110 | 1126 |
|
1111 | 1127 | ########## |
|
0 commit comments