Merge pull request #966 from github/editorconfig

Add an .editorconfig configuration file
This commit is contained in:
Lukas Gravley 2020-11-09 08:52:54 -06:00 committed by GitHub
commit 4b96adeb04
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
61 changed files with 362 additions and 299 deletions

View file

@ -11,7 +11,7 @@ GITHUB_WORKSPACE="${GITHUB_WORKSPACE}" # Git
GITHUB_SHA="${GITHUB_SHA}" # Sha used to create this branch
TEST_FOLDER='.automation/test' # Folder where test are stored
CLEAN_FOLDER='.automation/automation' # Folder to rename to prevent skip
(( LOG_TRACE=LOG_DEBUG=LOG_VERBOSE=LOG_NOTICE=LOG_WARN=LOG_ERROR="true" )) # Enable all loging
((LOG_TRACE = LOG_DEBUG = LOG_VERBOSE = LOG_NOTICE = LOG_WARN = LOG_ERROR = "true")) # Enable all loging
export LOG_TRACE LOG_DEBUG LOG_VERBOSE LOG_NOTICE LOG_WARN LOG_ERROR
############################
@ -39,7 +39,10 @@ CleanTestFiles() {
##################
# Find the files #
##################
mapfile -t FIND_CMD < <(cd "${GITHUB_WORKSPACE}" || exit 1 ; find "${GITHUB_WORKSPACE}" -type f -name "*_bad_*" 2>&1)
mapfile -t FIND_CMD < <(
cd "${GITHUB_WORKSPACE}" || exit 1
find "${GITHUB_WORKSPACE}" -type f -name "*_bad_*" 2>&1
)
#######################
# Load the error code #
@ -70,7 +73,10 @@ CleanTestFiles() {
################################
# Its a test, we can delete it #
################################
REMOVE_FILE_CMD=$(cd "${GITHUB_WORKSPACE}" || exit 1; rm -f "$FILE" 2>&1)
REMOVE_FILE_CMD=$(
cd "${GITHUB_WORKSPACE}" || exit 1
rm -f "$FILE" 2>&1
)
#######################
# Load the error code #
@ -96,7 +102,10 @@ CleanTestDockerFiles() {
##################
# Find the files #
##################
mapfile -t FIND_CMD < <(cd "${GITHUB_WORKSPACE}" || exit 1 ; find "${GITHUB_WORKSPACE}" -type f -name "*Dockerfile" 2>&1)
mapfile -t FIND_CMD < <(
cd "${GITHUB_WORKSPACE}" || exit 1
find "${GITHUB_WORKSPACE}" -type f -name "*Dockerfile" 2>&1
)
#######################
# Load the error code #
@ -127,7 +136,10 @@ CleanTestDockerFiles() {
################################
# Its a test, we can delete it #
################################
REMOVE_FILE_CMD=$(cd "${GITHUB_WORKSPACE}" || exit 1; rm -f "$FILE" 2>&1)
REMOVE_FILE_CMD=$(
cd "${GITHUB_WORKSPACE}" || exit 1
rm -f "$FILE" 2>&1
)
#######################
# Load the error code #
@ -153,7 +165,10 @@ CleanSHAFolder() {
##################
# Find the files #
##################
REMOVE_CMD=$(cd "${GITHUB_WORKSPACE}" || exit 1; sudo rm -rf "${GITHUB_SHA}" 2>&1)
REMOVE_CMD=$(
cd "${GITHUB_WORKSPACE}" || exit 1
sudo rm -rf "${GITHUB_SHA}" 2>&1
)
#######################
# Load the error code #
@ -178,7 +193,10 @@ RenameTestFolder() {
#####################
# Rename the folder #
#####################
RENAME_FOLDER_CMD=$(cd "${GITHUB_WORKSPACE}" || exit 1; mv "${TEST_FOLDER}" "${CLEAN_FOLDER}" 2>&1)
RENAME_FOLDER_CMD=$(
cd "${GITHUB_WORKSPACE}" || exit 1
mv "${TEST_FOLDER}" "${CLEAN_FOLDER}" 2>&1
)
#######################
# Load the error code #
@ -205,7 +223,10 @@ CleanPowershell() {
##################
# Find the files #
##################
mapfile -t FIND_CMD < <(cd "${GITHUB_WORKSPACE}" || exit 1 ; find "${GITHUB_WORKSPACE}" -type f -name "*.psd1" 2>&1)
mapfile -t FIND_CMD < <(
cd "${GITHUB_WORKSPACE}" || exit 1
find "${GITHUB_WORKSPACE}" -type f -name "*.psd1" 2>&1
)
#######################
# Load the error code #
@ -236,7 +257,10 @@ CleanPowershell() {
################################
# Its a test, we can delete it #
################################
REMOVE_FILE_CMD=$(cd "${GITHUB_WORKSPACE}" || exit 1; rm -f "$FILE" 2>&1)
REMOVE_FILE_CMD=$(
cd "${GITHUB_WORKSPACE}" || exit 1
rm -f "$FILE" 2>&1
)
#######################
# Load the error code #

View file

@ -22,7 +22,7 @@ DOCKER_PASSWORD="${DOCKER_PASSWORD}" # Pas
IMAGE_REPO="${IMAGE_REPO}" # Image repo to upload the image
IMAGE_VERSION="${IMAGE_VERSION}" # Version to tag the image
DOCKERFILE_PATH="${DOCKERFILE_PATH}" # Path to the Dockerfile to be uploaded
(( LOG_TRACE=LOG_DEBUG=LOG_VERBOSE=LOG_NOTICE=LOG_WARN=LOG_ERROR="true" )) # Enable all loging
((LOG_TRACE = LOG_DEBUG = LOG_VERBOSE = LOG_NOTICE = LOG_WARN = LOG_ERROR = "true")) # Enable all loging
export LOG_TRACE LOG_DEBUG LOG_VERBOSE LOG_NOTICE LOG_WARN LOG_ERROR
#########################

View file

@ -21,8 +21,7 @@ PROCESS_CHECK=0 # Count of times to check the process
################################################################################
################################################################################
#### Function CheckGHEPid ######################################################
CheckGHEPid()
{
CheckGHEPid() {
##################################
# Check to prevent infinite loop #
##################################
@ -75,8 +74,7 @@ CheckGHEPid()
}
################################################################################
#### Function CheckGHEProcess ##################################################
CheckGHEProcess()
{
CheckGHEProcess() {
##################################
# Check to prevent infinite loop #
##################################
@ -139,8 +137,7 @@ CheckGHEProcess()
}
################################################################################
#### Function RunConfigApply ###################################################
RunConfigApply()
{
RunConfigApply() {
##########
# Header #
##########

View file

@ -1,15 +1,15 @@
{
"Resources" : {
"myDNSRecord" : {
"Type" : "AWS::Route53::RecordSet",
"Properties" : {
"HostedZoneId" : "Z8VLZEXAMPLE",
"Name" : "test.example.com",
"ResourceRecords" : [
"Resources": {
"myDNSRecord": {
"Type": "AWS::Route53::RecordSet",
"Properties": {
"HostedZoneId": "Z8VLZEXAMPLE",
"Name": "test.example.com",
"ResourceRecords": [
"192.0.2.99"
],
"TTL" : 300,
"Type" : "A"
"TTL": 300,
"Type": "A"
}
}
}

View file

@ -1,6 +1,6 @@
# EDITORCONFIG_CHECKER Test Cases
# EDITORCONFIG Test Cases
This folder holds the test cases for **EDITORCONFIG_CHECKER**.
This folder holds the test cases for **EDITORCONFIG**.
## Additional Docs

View file

@ -1,10 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
</head>
<body>
Good HTML!
</body>
</body>
</html>

View file

@ -2,6 +2,6 @@ TAP version 13
1..2
not ok 1 - kotlin_bad_1.kt
---
message: /tmp/lint/.automation/test/kotlin/kotlin_bad_1.kt 1 1 File must end with a newline (\n)\n/tmp/lint/.automation/test/kotlin/kotlin_bad_1.kt 2 20 Unnecessary semicolon\n/tmp/lint/.automation/test/kotlin/kotlin_bad_1.kt 3 16 Redundant curly braces\n/tmp/lint/.automation/test/kotlin/kotlin_bad_1.kt 3 27 Unnecessary semicolon\n/tmp/lint/.automation/test/kotlin/kotlin_bad_1.kt 5 15 Unnecessary semicolon\n
message: /tmp/lint/.automation/test/kotlin/kotlin_bad_1.kt 1 1 File must end with a newline (\n)\n/tmp/lint/.automation/test/kotlin/kotlin_bad_1.kt 2 1 Unexpected indentation (4) (should be 2)\n/tmp/lint/.automation/test/kotlin/kotlin_bad_1.kt 2 20 Unnecessary semicolon\n/tmp/lint/.automation/test/kotlin/kotlin_bad_1.kt 3 1 Unexpected indentation (4) (should be 2)\n/tmp/lint/.automation/test/kotlin/kotlin_bad_1.kt 3 16 Redundant curly braces\n/tmp/lint/.automation/test/kotlin/kotlin_bad_1.kt 3 27 Unnecessary semicolon\n/tmp/lint/.automation/test/kotlin/kotlin_bad_1.kt 5 1 Unexpected indentation (4) (should be 2)\n/tmp/lint/.automation/test/kotlin/kotlin_bad_1.kt 5 15 Unnecessary semicolon\n
...
ok 2 - /tmp/lint/.automation/test/kotlin/kotlint_good_1.kt

View file

@ -11,4 +11,3 @@ function BadFunction {
'Empty Catch Block'
} catch {}
}

View file

@ -41,7 +41,7 @@ CONTAINER_URL='' # Final URL to upload
BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') # Current build date EX> "2017-08-28T09:24:41Z"
BUILD_REVISION=$(git rev-parse --short HEAD) # Current git commit EX> "e89faa7"
BUILD_VERSION='' # Current version of the container being built
(( LOG_TRACE=LOG_DEBUG=LOG_VERBOSE=LOG_NOTICE=LOG_WARN=LOG_ERROR="true" )) # Enable all loging
((LOG_TRACE = LOG_DEBUG = LOG_VERBOSE = LOG_NOTICE = LOG_WARN = LOG_ERROR = "true")) # Enable all loging
export LOG_TRACE LOG_DEBUG LOG_VERBOSE LOG_NOTICE LOG_WARN LOG_ERROR
#########################

View file

@ -13,7 +13,7 @@ BUILD_DATE="${BUILD_DATE}" # Dat
BUILD_REVISION="${GITHUB_SHA}" # GitHub Sha
BUILD_VERSION="${GITHUB_SHA}" # Version of the container
ORG_REPO="github/super-linter" # Org/repo
(( LOG_TRACE=LOG_DEBUG=LOG_VERBOSE=LOG_NOTICE=LOG_WARN=LOG_ERROR="true" )) # Enable all loging
((LOG_TRACE = LOG_DEBUG = LOG_VERBOSE = LOG_NOTICE = LOG_WARN = LOG_ERROR = "true")) # Enable all loging
ERROR=0 # Error count
export LOG_TRACE LOG_DEBUG LOG_VERBOSE LOG_NOTICE LOG_WARN LOG_ERROR

30
.editorconfig Normal file
View file

@ -0,0 +1,30 @@
# EditorConfig is awesome: http://EditorConfig.org
# top-most EditorConfig file
root = true
# Unix-style newlines at the bottom of every file
[*]
end_of_line = lf
charset = utf-8
# Tab indentation
indent_style = space
indent_size = 2
# Make sure every file has a blank line at the end
insert_final_newline = true
# Remove any whitespace characters preceding newline characters
trim_trailing_whitespace = true
# Give operators breathing room, but not brackets
spaces_around_operators = true
spaces_around_brackets = false
# Max line length (not supported by all editors)
# Enable this option by un-commenting the following line
# max_line_length = 150
[{Makefile,go.mod,go.sum,*.go,.gitmodules}]
indent_style = tab
indent_size = 4

View file

@ -14,18 +14,18 @@ about: Used for requesting enhancements to the GitHub Super-Linter
**Your impression of priority / how important this request is**
- [ ] Critical: Can't use the tool without it.
- [ ] Business Critical: Immediate opportunity to win business with this feature
- [ ] Important: Will significantly enhance the overall utility of the demo
- [ ] Nice to have: self-explanatory
- [ ] Critical: Can't use the tool without it.
- [ ] Business Critical: Immediate opportunity to win business with this feature
- [ ] Important: Will significantly enhance the overall utility of the demo
- [ ] Nice to have: self-explanatory
**Business case or other information justifying priority**
**Agreed upon priority**
- [ ] Critical: Can't use the tool without it.
- [ ] Business Critical: Immediate opportunity to win business with this feature
- [ ] Important: Will significantly enhance the overall utility of the demo
- [ ] Nice to have: self-explanatory
- [ ] Critical: Can't use the tool without it.
- [ ] Business Critical: Immediate opportunity to win business with this feature
- [ ] Important: Will significantly enhance the overall utility of the demo
- [ ] Nice to have: self-explanatory
**Other information** (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, gitter, etc)
<!-- markdownlint-restore -->

View file

@ -1,2 +1,2 @@
include_checks:
- I
- I

View file

@ -1,2 +1,7 @@
{:linters {:unresolved-symbol {:exclude [(compojure.api.sweet/defroutes)]}
:refer-all {:exclude [clj-time.jdbc]}}}
{:linters
{:unresolved-symbol
{:exclude [(compojure.api.sweet/defroutes)]}
:refer-all
{:exclude [clj-time.jdbc]}
}
}

View file

@ -418,8 +418,7 @@ max-module-lines=1000
# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}.
# `trailing-comma` allows a space between comma and closing bracket: (a, ).
# `empty-line` allows space-only lines.
no-space-check=trailing-comma,
dict-separator
no-space-check=trailing-comma,dict-separator
# Allow the body of a class to be on the same line as the declaration if body
# contains single statement.

View file

@ -1,2 +1,7 @@
{:linters {:unresolved-symbol {:exclude [(compojure.api.sweet/defroutes)]}
:refer-all {:exclude [clj-time.jdbc]}}}
{:linters
{:unresolved-symbol
{:exclude [(compojure.api.sweet/defroutes)]}
:refer-all
{:exclude [clj-time.jdbc]}
}
}

View file

@ -419,8 +419,7 @@ max-module-lines=1000
# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}.
# `trailing-comma` allows a space between comma and closing bracket: (a, ).
# `empty-line` allows space-only lines.
no-space-check=trailing-comma,
dict-separator
no-space-check=trailing-comma,dict-separator
# Allow the body of a class to be on the same line as the declaration if body
# contains single statement.

View file

@ -279,7 +279,7 @@ for LANGUAGE in "${LANGUAGE_ARRAY[@]}"; do
LINTER_NAME="${LINTER_NAMES_ARRAY["${LANGUAGE}"]}"
debug "Checking if linter with name ${LINTER_NAME} for the ${LANGUAGE} language is available..."
if ! command -v "${LINTER_NAME}" 1&>/dev/null 2>&1; then
if ! command -v "${LINTER_NAME}" 1 &>/dev/null 2>&1; then
# Failed
fatal "Failed to find [${LINTER_NAME}] in system!"
else
@ -288,8 +288,6 @@ for LANGUAGE in "${LANGUAGE_ARRAY[@]}"; do
fi
done
################################################################################
########################## FUNCTIONS BELOW #####################################
################################################################################
@ -1271,7 +1269,6 @@ LINTER_COMMANDS_ARRAY['TYPESCRIPT_STANDARD']="standard --parser @typescript-esli
LINTER_COMMANDS_ARRAY['XML']="xmllint"
LINTER_COMMANDS_ARRAY['YAML']="yamllint -c ${YAML_LINTER_RULES}"
debug "--- Linter commands ---"
debug "-----------------------"
for i in "${!LINTER_COMMANDS_ARRAY[@]}"; do
@ -1331,14 +1328,14 @@ for LANGUAGE in "${LANGUAGE_ARRAY[@]}"; do
LintAnsibleFiles "${ANSIBLE_LINTER_RULES}" # Passing rules but not needed, dont want to exclude unused var
else
LINTER_NAME="${LINTER_NAMES_ARRAY["${LANGUAGE}"]}"
if [ -z "${LINTER_NAME}" ];then
if [ -z "${LINTER_NAME}" ]; then
fatal "Cannot find the linter name for ${LANGUAGE} language."
else
debug "Setting LINTER_NAME to ${LINTER_NAME}..."
fi
LINTER_COMMAND="${LINTER_COMMANDS_ARRAY["${LANGUAGE}"]}"
if [ -z "${LINTER_COMMAND}" ];then
if [ -z "${LINTER_COMMAND}" ]; then
fatal "Cannot find the linter command for ${LANGUAGE} language."
else
debug "Setting LINTER_COMMAND to ${LINTER_COMMAND}..."

View file

@ -74,7 +74,7 @@ WriteFile() {
#################################
# Write the data to output file #
#################################
echo "${LINTER}: ${VERSION}" >> "${VERSION_FILE}" 2>&1
echo "${LINTER}: ${VERSION}" >>"${VERSION_FILE}" 2>&1
#######################
# Load the error code #

View file

@ -29,7 +29,7 @@ export NC
# Log Functions
LOG_TEMP=$(mktemp) || echo "Failed to create temporary log file."
export LOG_TEMP
echo "super-linter Log" > "${LOG_TEMP}"
echo "super-linter Log" >"${LOG_TEMP}"
log() {
local TOTERM=${1:-}
local MESSAGE=${2:-}
@ -37,7 +37,7 @@ log() {
if [[ -n ${TOTERM} ]]; then
tee -a "${LOG_TEMP}" >&2
else
cat >> "${LOG_TEMP}" 2>&1
cat >>"${LOG_TEMP}" 2>&1
fi
)
}

View file

@ -1,5 +1,7 @@
#!/usr/bin/env bash
cat << EOF
# editorconfig-checker-disable
cat <<EOF
--------------------------------------------------------------------------------
/@@#///////@@/(@//@%/(@.@( @@
@ -20,3 +22,4 @@ cat << EOF
--------------------------------------------------------------------------------
EOF
# editorconfig-checker-enable

View file

@ -7,7 +7,7 @@
###########
# Globals #
###########
(( LOG_TRACE=LOG_DEBUG=LOG_VERBOSE=LOG_NOTICE=LOG_WARN=LOG_ERROR="true" )) # Enable all loging
((LOG_TRACE = LOG_DEBUG = LOG_VERBOSE = LOG_NOTICE = LOG_WARN = LOG_ERROR = "true")) # Enable all loging
ERROR=0 # Error count
export LOG_TRACE LOG_DEBUG LOG_VERBOSE LOG_NOTICE LOG_WARN LOG_ERROR

View file

@ -10,6 +10,8 @@
################################################################################
#### Function LintCodebase #####################################################
function LintCodebase() {
# Call comes thorugh as:
# LintCodebase "${LANGUAGE}" "${LINTER_NAME}" "${LINTER_COMMAND}" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${TEST_CASE_RUN}" "${!LANGUAGE_FILE_ARRAY}"
####################
# Pull in the vars #
####################
@ -18,7 +20,7 @@ function LintCodebase() {
LINTER_COMMAND="${1}" && shift # Pull the variable and remove from array path (Example: jsonlint -c ConfigFile /path/to/file)
FILTER_REGEX_INCLUDE="${1}" && shift # Pull the variable and remove from array path (Example: */src/*,*/test/*)
FILTER_REGEX_EXCLUDE="${1}" && shift # Pull the variable and remove from array path (Example: */examples/*,*/test/*.test)
TEST_CASE_RUN="${1}" && shift
TEST_CASE_RUN="${1}" && shift # Flag for if running in test cases
FILE_ARRAY=("$@") # Array of files to validate (Example: ${FILE_ARRAY_JSON})
################