mirror of
https://github.com/super-linter/super-linter.git
synced 2024-11-22 16:51:05 -05:00
Merge pull request #221 from mstruebing/addEditorconfigChecker
Add `editorconfig-checker`
This commit is contained in:
commit
159a1b5c8c
10 changed files with 117 additions and 0 deletions
3
.automation/test/editorconfig-checker/.editorconfig
Normal file
3
.automation/test/editorconfig-checker/.editorconfig
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
[*.ext]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 4
|
13
.automation/test/editorconfig-checker/README.md
Normal file
13
.automation/test/editorconfig-checker/README.md
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
# EDITORCONFIG_CHECKER Test Cases
|
||||||
|
This folder holds the test cases for **EDITORCONFIG_CHECKER**.
|
||||||
|
|
||||||
|
## Additional Docs
|
||||||
|
No Additional information is needed for this test case.
|
||||||
|
|
||||||
|
## Good Test Cases
|
||||||
|
The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted.
|
||||||
|
- **Note:** They are linted utilizing the default linter rules.
|
||||||
|
|
||||||
|
## Bad Test Cases
|
||||||
|
The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted.
|
||||||
|
- **Note:** They are linted utilizing the default linter rules.
|
|
@ -0,0 +1,3 @@
|
||||||
|
some line
|
||||||
|
some line
|
||||||
|
some line
|
|
@ -0,0 +1,3 @@
|
||||||
|
some line
|
||||||
|
some line
|
||||||
|
some line
|
18
.github/linters/.ecrc
vendored
Normal file
18
.github/linters/.ecrc
vendored
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
{
|
||||||
|
"Verbose": false,
|
||||||
|
"Debug": false,
|
||||||
|
"IgnoreDefaults": false,
|
||||||
|
"SpacesAftertabs": false,
|
||||||
|
"NoColor": false,
|
||||||
|
"Exclude": [],
|
||||||
|
"AllowedContentTypes": [],
|
||||||
|
"PassedFiles": [],
|
||||||
|
"Disable": {
|
||||||
|
"EndOfLine": false,
|
||||||
|
"Indentation": false,
|
||||||
|
"InsertFinalNewline": false,
|
||||||
|
"TrimTrailingWhitespace": false,
|
||||||
|
"IndentSize": false,
|
||||||
|
"MaxLineLength": false
|
||||||
|
}
|
||||||
|
}
|
|
@ -181,6 +181,12 @@ RUN curl -sLO https://github.com/borkdude/clj-kondo/releases/download/v${CLJ_KON
|
||||||
RUN curl -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && chmod a+x ktlint \
|
RUN curl -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && chmod a+x ktlint \
|
||||||
&& mv "ktlint" /usr/bin/
|
&& mv "ktlint" /usr/bin/
|
||||||
|
|
||||||
|
################################
|
||||||
|
# Install editorconfig-checker #
|
||||||
|
################################
|
||||||
|
RUN wget -qO- "https://github.com/editorconfig-checker/editorconfig-checker/releases/latest/download/ec-linux-amd64.tar.gz" | tar -xzf - \
|
||||||
|
&& mv "bin/ec-linux-amd64" /usr/bin/editorconfig-checker
|
||||||
|
|
||||||
###########################################
|
###########################################
|
||||||
# Load GitHub Env Vars for GitHub Actions #
|
# Load GitHub Env Vars for GitHub Actions #
|
||||||
###########################################
|
###########################################
|
||||||
|
@ -216,6 +222,7 @@ ENV GITHUB_SHA=${GITHUB_SHA} \
|
||||||
VALIDATE_ARM=${VALIDATE_ARM} \
|
VALIDATE_ARM=${VALIDATE_ARM} \
|
||||||
VALIDATE_OPENAPI=${VALIDATE_OPENAPI} \
|
VALIDATE_OPENAPI=${VALIDATE_OPENAPI} \
|
||||||
VALIDATE_PROTOBUF=${VALIDATE_PROTOBUF} \
|
VALIDATE_PROTOBUF=${VALIDATE_PROTOBUF} \
|
||||||
|
VALIDATE_EDITORCONFIG=${VALIDATE_EDITORCONFIG} \
|
||||||
ANSIBLE_DIRECTORY=${ANSIBLE_DIRECTORY} \
|
ANSIBLE_DIRECTORY=${ANSIBLE_DIRECTORY} \
|
||||||
RUN_LOCAL=${RUN_LOCAL} \
|
RUN_LOCAL=${RUN_LOCAL} \
|
||||||
TEST_CASE_RUN=${TEST_CASE_RUN} \
|
TEST_CASE_RUN=${TEST_CASE_RUN} \
|
||||||
|
|
|
@ -40,6 +40,7 @@ Developers on **GitHub** can call the **GitHub Action** to lint their code base
|
||||||
| **Clojure** | [clj-kondo](https://github.com/borkdude/clj-kondo) |
|
| **Clojure** | [clj-kondo](https://github.com/borkdude/clj-kondo) |
|
||||||
| **CoffeeScript** | [coffeelint](https://coffeelint.github.io/) |
|
| **CoffeeScript** | [coffeelint](https://coffeelint.github.io/) |
|
||||||
| **Dockerfile** | [dockerfilelint](https://github.com/replicatedhq/dockerfilelint.git) |
|
| **Dockerfile** | [dockerfilelint](https://github.com/replicatedhq/dockerfilelint.git) |
|
||||||
|
| **EDITORCONFIG** | [editorconfig-checker](https://github.com/editorconfig-checker/editorconfig-checker) |
|
||||||
| **ENV** | [dotenv-linter](https://github.com/dotenv-linter/dotenv-linter) |
|
| **ENV** | [dotenv-linter](https://github.com/dotenv-linter/dotenv-linter) |
|
||||||
| **Golang** | [golangci-lint](https://github.com/golangci/golangci-lint) |
|
| **Golang** | [golangci-lint](https://github.com/golangci/golangci-lint) |
|
||||||
| **HTMLHint** | [HTMLHint](https://github.com/htmlhint/HTMLHint) |
|
| **HTMLHint** | [HTMLHint](https://github.com/htmlhint/HTMLHint) |
|
||||||
|
@ -183,6 +184,7 @@ and won't run anything unexpected.
|
||||||
| **VALIDATE_OPENAPI** | `true` | Flag to enable or disable the linting process of the language. |
|
| **VALIDATE_OPENAPI** | `true` | Flag to enable or disable the linting process of the language. |
|
||||||
| **VALIDATE_CLOUDFORMATION** | `true` | Flag to enable or disable the linting process of the language. |
|
| **VALIDATE_CLOUDFORMATION** | `true` | Flag to enable or disable the linting process of the language. |
|
||||||
| **VALIDATE_PROTOBUF** | `true` | Flag to enable or disable the linting process of the language. |
|
| **VALIDATE_PROTOBUF** | `true` | Flag to enable or disable the linting process of the language. |
|
||||||
|
| **VALIDATE_EDITORCONFIG** | `true` | Flag to enable or disable the linting process with the editorconfig. |
|
||||||
| **ANSIBLE_DIRECTORY** | `/ansible` | Flag to set the root directory for Ansible file location(s). |
|
| **ANSIBLE_DIRECTORY** | `/ansible` | Flag to set the root directory for Ansible file location(s). |
|
||||||
| **ACTIONS_RUNNER_DEBUG** | `false` | Flag to enable additional information about the linter, versions, and additional output. |
|
| **ACTIONS_RUNNER_DEBUG** | `false` | Flag to enable additional information about the linter, versions, and additional output. |
|
||||||
| **DISABLE_ERRORS** | `false` | Flag to have the linter complete with exit code 0 even if errors were detected. |
|
| **DISABLE_ERRORS** | `false` | Flag to have the linter complete with exit code 0 even if errors were detected. |
|
||||||
|
|
|
@ -36,6 +36,7 @@ For some linters it is also possible to override rules on a case by case level w
|
||||||
- [Kotlin](#kotlin)
|
- [Kotlin](#kotlin)
|
||||||
- [OpenAPI](#openapi)
|
- [OpenAPI](#openapi)
|
||||||
- [Protocol Buffers](#protocol-buffers)
|
- [Protocol Buffers](#protocol-buffers)
|
||||||
|
- [EDITORCONFIG-CHECKER](#editorconfig-checker)
|
||||||
- [HTML](#html)
|
- [HTML](#html)
|
||||||
|
|
||||||
<!-- toc -->
|
<!-- toc -->
|
||||||
|
@ -743,6 +744,38 @@ lint:
|
||||||
### clj-kondo disable entire file
|
### clj-kondo disable entire file
|
||||||
```clojure
|
```clojure
|
||||||
{:output {:exclude-files ["path/to/file"]}}
|
{:output {:exclude-files ["path/to/file"]}}
|
||||||
|
|
||||||
|
## EDITORCONFIG-CHECKER
|
||||||
|
- [editorconfig-checker](https://github.com/editorconfig-checker/editorconfig-checker)
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
### editorconfig-checker Config file
|
||||||
|
- `.github/linters/.ecrc`
|
||||||
|
- This linter will also use the [`.editorconfig`](https://editorconfig.org/) of your project
|
||||||
|
|
||||||
|
### editorconfig-checker disable single line
|
||||||
|
-
|
||||||
|
```js
|
||||||
|
<LINE> // editorconfig-checker-disable-line
|
||||||
|
```
|
||||||
|
|
||||||
|
### editorconfig-checker disable code block
|
||||||
|
- There is currently **No** way to disable rules inline of the file(s)
|
||||||
|
|
||||||
|
### editorconfig-checker disable entire file
|
||||||
|
-
|
||||||
|
```js
|
||||||
|
// editorconfig-checker-disable-file
|
||||||
|
```
|
||||||
|
- You can disable entire files with the `Exclude` property in `.ecrc`
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"Exclude": [
|
||||||
|
"path/to/file",
|
||||||
|
"^regular\\/expression\\.ext$"
|
||||||
|
]
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## HTML
|
## HTML
|
||||||
|
|
|
@ -137,6 +137,7 @@ VALIDATE_POWERSHELL="${VALIDATE_POWERSHELL}" # Boolean to vali
|
||||||
VALIDATE_ARM="${VALIDATE_ARM}" # Boolean to validate language
|
VALIDATE_ARM="${VALIDATE_ARM}" # Boolean to validate language
|
||||||
VALIDATE_KOTLIN="${VALIDATE_KOTLIN}" # Boolean to validate language
|
VALIDATE_KOTLIN="${VALIDATE_KOTLIN}" # Boolean to validate language
|
||||||
VALIDATE_OPENAPI="${VALIDATE_OPENAPI}" # Boolean to validate language
|
VALIDATE_OPENAPI="${VALIDATE_OPENAPI}" # Boolean to validate language
|
||||||
|
VALIDATE_EDITORCONFIG="${VALIDATE_EDITORCONFIG}" # Boolean to validate files with editorconfig
|
||||||
TEST_CASE_RUN="${TEST_CASE_RUN}" # Boolean to validate only test cases
|
TEST_CASE_RUN="${TEST_CASE_RUN}" # Boolean to validate only test cases
|
||||||
DISABLE_ERRORS="${DISABLE_ERRORS}" # Boolean to enable warning-only output without throwing errors
|
DISABLE_ERRORS="${DISABLE_ERRORS}" # Boolean to enable warning-only output without throwing errors
|
||||||
VALIDATE_HTML="${VALIDATE_HTML}" # Boolean to validate language
|
VALIDATE_HTML="${VALIDATE_HTML}" # Boolean to validate language
|
||||||
|
@ -800,6 +801,7 @@ Footer() {
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
############################### MAIN ###########################################
|
############################### MAIN ###########################################
|
||||||
################################################################################
|
################################################################################
|
||||||
|
@ -1130,6 +1132,18 @@ if [ "$VALIDATE_KOTLIN" == "true" ]; then
|
||||||
LintCodebase "KOTLIN" "ktlint" "ktlint" ".*\.\(kt\|kts\)\$" "${FILE_ARRAY_KOTLIN[@]}"
|
LintCodebase "KOTLIN" "ktlint" "ktlint" ".*\.\(kt\|kts\)\$" "${FILE_ARRAY_KOTLIN[@]}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
########################
|
||||||
|
# EDITORCONFIG LINTING #
|
||||||
|
########################
|
||||||
|
echo ed: "$VALIDATE_EDITORCONFIG"
|
||||||
|
if [ "$VALIDATE_EDITORCONFIG" == "true" ]; then
|
||||||
|
####################################
|
||||||
|
# Lint the files with editorconfig #
|
||||||
|
####################################
|
||||||
|
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILE_ARRAY"
|
||||||
|
LintCodebase "EDITORCONFIG" "editorconfig-checker" "editorconfig-checker" "^.*$" "${FILE_ARRAY_ENV[@]}"
|
||||||
|
fi
|
||||||
|
|
||||||
##################
|
##################
|
||||||
# DOCKER LINTING #
|
# DOCKER LINTING #
|
||||||
##################
|
##################
|
||||||
|
|
|
@ -72,6 +72,7 @@ function GetValidationInfo() {
|
||||||
VALIDATE_KOTLIN=$(echo "$VALIDATE_KOTLIN" | awk '{print tolower($0)}')
|
VALIDATE_KOTLIN=$(echo "$VALIDATE_KOTLIN" | awk '{print tolower($0)}')
|
||||||
VALIDATE_PROTOBUF=$(echo "$VALIDATE_PROTOBUF" | awk '{print tolower($0)}')
|
VALIDATE_PROTOBUF=$(echo "$VALIDATE_PROTOBUF" | awk '{print tolower($0)}')
|
||||||
VALIDATE_OPENAPI=$(echo "$VALIDATE_OPENAPI" | awk '{print tolower($0)}')
|
VALIDATE_OPENAPI=$(echo "$VALIDATE_OPENAPI" | awk '{print tolower($0)}')
|
||||||
|
VALIDATE_EDITORCONFIG=$(echo "$VALIDATE_EDITORCONFIG" | awk '{print tolower($0)}')
|
||||||
VALIDATE_HTML=$(echo "$VALIDATE_HTML" | awk '{print tolower($0)}')
|
VALIDATE_HTML=$(echo "$VALIDATE_HTML" | awk '{print tolower($0)}')
|
||||||
|
|
||||||
################################################
|
################################################
|
||||||
|
@ -104,6 +105,7 @@ function GetValidationInfo() {
|
||||||
$VALIDATE_PROTOBUF || -n \
|
$VALIDATE_PROTOBUF || -n \
|
||||||
$VALIDATE_OPENAPI || -n \
|
$VALIDATE_OPENAPI || -n \
|
||||||
$VALIDATE_KOTLIN || -n \
|
$VALIDATE_KOTLIN || -n \
|
||||||
|
$VALIDATE_EDITORCONFIG || -n \
|
||||||
$VALIDATE_HTML ]]; then
|
$VALIDATE_HTML ]]; then
|
||||||
ANY_SET="true"
|
ANY_SET="true"
|
||||||
fi
|
fi
|
||||||
|
@ -472,6 +474,20 @@ function GetValidationInfo() {
|
||||||
VALIDATE_CLOJURE="true"
|
VALIDATE_CLOJURE="true"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
############################################
|
||||||
|
# Validate if we should check editorconfig #
|
||||||
|
############################################
|
||||||
|
if [[ $ANY_SET == "true" ]]; then
|
||||||
|
# Some linter flags were set - only run those set to true
|
||||||
|
if [[ -z $VALIDATE_EDITORCONFIG ]]; then
|
||||||
|
# EDITORCONFIG flag was not set - default to false
|
||||||
|
VALIDATE_EDITORCONFIG="false"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# No linter flags were set - default all to true
|
||||||
|
VALIDATE_EDITORCONFIG="true"
|
||||||
|
fi
|
||||||
|
|
||||||
####################################
|
####################################
|
||||||
# Validate if we should check HTML #
|
# Validate if we should check HTML #
|
||||||
####################################
|
####################################
|
||||||
|
@ -619,6 +635,11 @@ function GetValidationInfo() {
|
||||||
else
|
else
|
||||||
PRINT_ARRAY+=("- Excluding [PROTOBUF] files in code base...")
|
PRINT_ARRAY+=("- Excluding [PROTOBUF] files in code base...")
|
||||||
fi
|
fi
|
||||||
|
if [[ $VALIDATE_EDITORCONFIG == "true" ]]; then
|
||||||
|
PRINT_ARRAY+=("- Validating [EDITORCONFIG] files in code base...")
|
||||||
|
else
|
||||||
|
PRINT_ARRAY+=("- Excluding [EDITORCONFIG] files in code base...")
|
||||||
|
fi
|
||||||
if [[ $VALIDATE_HTML == "true" ]]; then
|
if [[ $VALIDATE_HTML == "true" ]]; then
|
||||||
PRINT_ARRAY+=("- Validating [HTML] files in code base...")
|
PRINT_ARRAY+=("- Validating [HTML] files in code base...")
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue