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

@ -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

@ -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,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>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
Good HTML!
</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 {}
}

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

@ -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

@ -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

View file

@ -1,4 +1,6 @@
#!/usr/bin/env bash
# editorconfig-checker-disable
cat <<EOF
--------------------------------------------------------------------------------
@ -20,3 +22,4 @@ cat << EOF
--------------------------------------------------------------------------------
EOF
# editorconfig-checker-enable

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})
################