-
Notifications
You must be signed in to change notification settings - Fork 13
Configure pre-commit #42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
+38
−10
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add a pre-commit configuration file Signed-off-by: Joe Block <[email protected]>
for more information, see https://pre-commit.ci
✅
|
| Descriptor | Linter | Files | Fixed | Errors | Warnings | Elapsed time |
|---|---|---|---|---|---|---|
| ✅ ACTION | actionlint | 1 | 0 | 0 | 0.01s | |
| ✅ BASH | bash-exec | 6 | 0 | 0 | 0.02s | |
| ✅ BASH | shellcheck | 6 | 0 | 0 | 0.4s | |
| shfmt | 6 | 5 | 0 | 0.01s | ||
| ✅ COPYPASTE | jscpd | yes | no | no | 1.23s | |
| ✅ REPOSITORY | devskim | yes | no | no | 1.58s | |
| ✅ REPOSITORY | dustilock | yes | no | no | 0.02s | |
| ✅ REPOSITORY | gitleaks | yes | no | no | 0.15s | |
| ✅ REPOSITORY | git_diff | yes | no | no | 0.01s | |
| ✅ REPOSITORY | grype | yes | no | no | 27.63s | |
| kics | yes | 2 | no | 1.44s | ||
| ✅ REPOSITORY | secretlint | yes | no | no | 1.05s | |
| ✅ REPOSITORY | syft | yes | no | no | 2.16s | |
| ✅ REPOSITORY | trivy | yes | no | no | 9.5s | |
| ✅ REPOSITORY | trivy-sbom | yes | no | no | 0.1s | |
| ✅ REPOSITORY | trufflehog | yes | no | no | 3.85s | |
| prettier | 2 | 1 | 2 | 0.36s | ||
| ✅ YAML | v8r | 2 | 0 | 0 | 4.56s | |
| yamllint | 2 | 6 | 0 | 0.3s |
Detailed Issues
⚠️ REPOSITORY / kics - 2 errors
MLLLLLM MLLLLLLLLL LLLLLLL KLLLLLLLLLLLLLLLL LLLLLLLLLLLLLLLLLLLLLLL
MMMMMMM MMMMMMMMMML MMMMMMMK LMMMMMMMMMMMMMMMMMMMML KLMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMM MMMMMMMMML MMMMMMMK LMMMMMMMMMMMMMMMMMMMMMML LMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMM MMMMMMMMMML MMMMMMMK LMMMMMMMMMMMMMMMMMMMMMMMML LMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMM LMMMMMMMMML MMMMMMMK LMMMMMMMMMLLMLLLLLLLLLLLLLL LMMMMMMMLLLLLLLLLLLLLLLLLLLLM
MMMMMMM MMMMMMMMMLM MMMMMMMK LMMMMMMMM LMMMMMML
MMMMMMMLMMMMMMMML MMMMMMMK MMMMMMML LMMMMMMMMLLLLLLLLLLLLLMLL
MMMMMMMMMMMMMMMM MMMMMMMK MMMMMML LMMMMMMMMMMMMMMMMMMMMMMMMML
MMMMMMMMMMMMMMMMMM MMMMMMMK MMMMMMM LMMMMMMMMMMMMMMMMMMMMMMMML
MMMMMMM KLMMMMMMMMML MMMMMMMK LMMMMMMM MMMMMMMML
MMMMMMM LMMMMMMMMMM MMMMMMMK LMMMMMMMMLL MMMMMMML
MMMMMMM LMMMMMMMMMLL MMMMMMMK LMMMMMMMMMMMMMMMMMMMMMMMMML LLLLLLLLLLLLLLLLLLLLMMMMMMMMMM
MMMMMMM MMMMMMMMMMML MMMMMMMK MMMMMMMMMMMMMMMMMMMMMMMMML LMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMM LLMMMMMMMMML MMMMMMMK LLMMMMMMMMMMMMMMMMMMMMML LMMMMMMMMMMMMMMMMMMMMMMMMMML
MMMMMMM MMMMMMMMMML MMMMMMMK KLMMMMMMMMMMMMMMMMML LMMMMMMMMMMMMMMMMMMMMMMMLK
Scanning with Keeping Infrastructure as Code Secure v2.1.14
Unpinned Actions Full Length Commit SHA, Severity: LOW, Results: 2
Description: Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps mitigate the risk of a bad actor adding a backdoor to the action's repository, as they would need to generate a SHA-1 collision for a valid Git object payload. When selecting a SHA, you should verify it is from the action's repository and not a repository fork.
Platform: CICD
CWE: 829
Learn more about this vulnerability: https://docs.kics.io/latest/queries/cicd-queries/555ab8f9-2001-455e-a077-f2d0f41e2fb9
[1]: .github/workflows/mega-linter.yml:52
051: - name: Lint Code Base
052: uses: megalinter/megalinter@v9
053: env:
[2]: .github/workflows/awesomebot.yml:17
016: - uses: actions/checkout@v5
017: - uses: docker://dkhamsing/awesome_bot:latest
018: with:
Results Summary:
CRITICAL: 0
HIGH: 0
MEDIUM: 0
LOW: 2
INFO: 0
TOTAL: 2
⚠️ YAML / prettier - 1 error
Checking formatting...
[warn] .github/workflows/awesomebot.yml
[warn] Code style issues found in the above file. Run Prettier with --write to fix.
⚠️ BASH / shfmt - 5 errors
diff bin/ansi.orig bin/ansi
--- bin/ansi.orig
+++ bin/ansi
@@ -8,107 +8,107 @@
# shellcheck disable=SC2004
add-code() {
- local N
-
- if [[ "$1" == *=* ]]; then
- N="${1#*=}"
- N="${N//,/;}"
- else
- N=""
- fi
-
- OUTPUT="$OUTPUT$CSI$N$2"
+ local N
+
+ if [[ "$1" == *=* ]]; then
+ N="${1#*=}"
+ N="${N//,/;}"
+ else
+ N=""
+ fi
+
+ OUTPUT="$OUTPUT$CSI$N$2"
}
add-color() {
- OUTPUT="$OUTPUT$CSI${1}m"
-
- if [ ! -z "$2" ]; then
- SUFFIX="$CSI${2}m$SUFFIX"
- fi
+ OUTPUT="$OUTPUT$CSI${1}m"
+
+ if [ ! -z "$2" ]; then
+ SUFFIX="$CSI${2}m$SUFFIX"
+ fi
}
color-table() {
- local FNB_LOWER FNB_UPPER PADDED
-
- FNB_LOWER="$(colorize 2 22 f)n$(colorize 1 22 b)"
- FNB_UPPER="$(colorize 2 22 F)N$(colorize 1 22 B)"
- echo -n "bold $(colorize 1 22 Sample) "
- echo -n "faint $(colorize 2 22 Sample) "
- echo "italic $(colorize 3 23 Sample)"
- echo -n "underline $(colorize 4 24 Sample) "
- echo -n "blink $(colorize 5 25 Sample) "
- echo "inverse $(colorize 7 27 Sample)"
- echo "invisible $(colorize 8 28 Sample)"
- echo -n "strike $(colorize 9 29 Sample) "
- echo -n "fraktur $(colorize 20 23 Sample) "
- echo "double-underline $(colorize 21 24 Sample)"
- echo -n "frame $(colorize 51 54 Sample) "
- echo -n "encircle $(colorize 52 54 Sample) "
- echo "overline $(colorize 53 55 Sample)"
- echo ""
- echo " black red green yellow blue magenta cyan white"
- for BG in 40:black 41:red 42:green 43:yellow 44:blue 45:magenta 46:cyan 47:white; do
- PADDED="bg-${BG:3} "
- PADDED="${PADDED:0:13}"
- echo -n "$PADDED"
- for FG in 30 31 32 33 34 35 36 37; do
- echo -n "$CSI${BG:0:2};${FG}m"
- echo -n "$FNB_LOWER"
- echo -n "$CSI$(( $FG + 60 ))m"
- echo -n "$FNB_UPPER"
- echo -n "${CSI}0m "
- done
- echo ""
- echo -n " +intense "
- for FG in 30 31 32 33 34 35 36 37; do
- echo -n "$CSI$(( ${BG:0:2} + 60 ));${FG}m"
- echo -n "$FNB_LOWER"
- echo -n "$CSI$(( $FG + 60 ))m"
- echo -n "$FNB_UPPER"
- echo -n "${CSI}0m "
- done
- echo ""
- done
- echo ""
- echo "Legend:"
- echo " Normal color: f = faint, n = normal, b = bold."
- echo " Intense color: F = faint, N = normal, B = bold."
+ local FNB_LOWER FNB_UPPER PADDED
+
+ FNB_LOWER="$(colorize 2 22 f)n$(colorize 1 22 b)"
+ FNB_UPPER="$(colorize 2 22 F)N$(colorize 1 22 B)"
+ echo -n "bold $(colorize 1 22 Sample) "
+ echo -n "faint $(colorize 2 22 Sample) "
+ echo "italic $(colorize 3 23 Sample)"
+ echo -n "underline $(colorize 4 24 Sample) "
+ echo -n "blink $(colorize 5 25 Sample) "
+ echo "inverse $(colorize 7 27 Sample)"
+ echo "invisible $(colorize 8 28 Sample)"
+ echo -n "strike $(colorize 9 29 Sample) "
+ echo -n "fraktur $(colorize 20 23 Sample) "
+ echo "double-underline $(colorize 21 24 Sample)"
+ echo -n "frame $(colorize 51 54 Sample) "
+ echo -n "encircle $(colorize 52 54 Sample) "
+ echo "overline $(colorize 53 55 Sample)"
+ echo ""
+ echo " black red green yellow blue magenta cyan white"
+ for BG in 40:black 41:red 42:green 43:yellow 44:blue 45:magenta 46:cyan 47:white; do
+ PADDED="bg-${BG:3} "
+ PADDED="${PADDED:0:13}"
+ echo -n "$PADDED"
+ for FG in 30 31 32 33 34 35 36 37; do
+ echo -n "$CSI${BG:0:2};${FG}m"
+ echo -n "$FNB_LOWER"
+ echo -n "$CSI$(($FG + 60))m"
+ echo -n "$FNB_UPPER"
+ echo -n "${CSI}0m "
+ done
+ echo ""
+ echo -n " +intense "
+ for FG in 30 31 32 33 34 35 36 37; do
+ echo -n "$CSI$((${BG:0:2} + 60));${FG}m"
+ echo -n "$FNB_LOWER"
+ echo -n "$CSI$(($FG + 60))m"
+ echo -n "$FNB_UPPER"
+ echo -n "${CSI}0m "
+ done
+ echo ""
+ done
+ echo ""
+ echo "Legend:"
+ echo " Normal color: f = faint, n = normal, b = bold."
+ echo " Intense color: F = faint, N = normal, B = bold."
}
colorize() {
- echo -n "$CSI${1}m$3$CSI${2}m"
+ echo -n "$CSI${1}m$3$CSI${2}m"
}
is-ansi-supported() {
- # Idea: CSI c
- # Response = CSI ? 6 [234] ; 2 2 c
- # The "22" means ANSI color
- echo "can't tell yet"
+ # Idea: CSI c
+ # Response = CSI ? 6 [234] ; 2 2 c
+ # The "22" means ANSI color
+ echo "can't tell yet"
}
report() {
- local BUFF C
-
- REPORT=""
- echo -n "$CSI$1"
- read -r -N ${#2} -s -t 1 BUFF
-
- if [ "$BUFF" != "$2" ]; then
- return 1
- fi
-
- read -r -N ${#3} -s -t 1 BUFF
-
- while [ "$BUFF" != "$3" ]; do
- REPORT="$REPORT${BUFF:0:1}"
- read -r -N 1 -s -t 1 C || exit 1
- BUFF="${BUFF:1}$C"
- done
+ local BUFF C
+
+ REPORT=""
+ echo -n "$CSI$1"
+ read -r -N ${#2} -s -t 1 BUFF
+
+ if [ "$BUFF" != "$2" ]; then
+ return 1
+ fi
+
+ read -r -N ${#3} -s -t 1 BUFF
+
+ while [ "$BUFF" != "$3" ]; do
+ REPORT="$REPORT${BUFF:0:1}"
+ read -r -N 1 -s -t 1 C || exit 1
+ BUFF="${BUFF:1}$C"
+ done
}
show-help() {
- cat <<EOF
+ cat <<EOF
Generate ANSI escape codes
Please keep in mind that your terminal must support the code in order for you
@@ -225,436 +225,436 @@
OUTPUT=""
SUFFIX=""
while $CONTINUE; do
- case "$1" in
- --help | -h | -\?)
- show-help
- ;;
-
- # Display Manipulation
- --insert-chars | --insert-chars=* | --ich | --ich=*)
- add-code "$1" @
- ;;
-
- --erase-display | --erase-display=* | --ed | --ed=*)
- add-code "$1" J
- ;;
-
- --erase-line | --erase-line=* | --el | --el=*)
- add-code "$1" K
- ;;
-
- --insert-lines | --insert-lines=* | --il | --il=*)
- add-code "$1" L
- ;;
-
- --delete-lines | --delete-lines=* | --dl | --dl=*)
- add-code "$1" M
- ;;
-
- --delete-chars | --delete-chars=* | --dch | --dch=*)
- add-code "$1" P
- ;;
-
- --scroll-up | --scroll-up=* | --su | --su=*)
- add-code "$1" S
- ;;
-
- --scroll-down | --scroll-down=* | --sd | --sd=*)
- add-code "$1" T
- ;;
-
- --erase-chars | --erase-chars=* | --ech | --ech=*)
- add-code "$1" X
- ;;
-
- --repeat | --repeat=* | --rep | --rep=N)
- add-code "$1" b
- ;;
-
- # Cursor Positioning
- --up | --up=* | --cuu | --cuu=*)
- add-code "$1" A
- ;;
-
- --down | --down=* | --cud | --cud=*)
- add-code "$1" B
- ;;
-
- --forward | --forward=* | --cuf | --cuf=*)
- add-code "$1" C
- ;;
-
- --backward | --backward=*| --cub | --cub=*)
- add-code "$1" D
- ;;
-
- --next-line | --next-line=* | --cnl | --cnl=*)
- add-code "$1" E
- ;;
-
- --prev-line | --prev-line=* | --cpl | --cpl=*)
- add-code "$1" F
- ;;
-
- --column | --column=* | --cha | --cha=*)
- add-code "$1" G
- ;;
-
- --position | --position=* | --cup | --cup=*)
- add-code "$1" H
- ;;
-
- --tab-forward | --tab-forward=* | --cht | --cht=*)
- add-code "$1" I
- ;;
-
- --tab-backward | --tab-backward=* | --cbt | --cbt=*)
- add-code "$1" Z
- ;;
-
- --column-relative | --column-relative=* | --hpr | --hpr=*)
- add-code "$1" 'a'
- ;;
-
- --line | --line=* | --vpa | --vpa=*)
- add-code "$1" 'd'
- ;;
-
- --line-relative | --line-relative=* | --vpr | --vpr=*)
- add-code "$1" 'e'
- ;;
-
- --save-cursor)
- OUTPUT="$OUTPUT${CSI}s"
- SUFFIX="${CSI}u$SUFFIX"
- ;;
-
- --restore-cursor)
- OUTPUT="$OUTPUT${CSI}u"
- ;;
-
- --hide-cursor)
- OUTPUT="$OUTPUT${CSI}?25l"
- SUFFIX="${CSI}?25h"
- ;;
-
- --show-cursor)
- OUTPUT="$OUTPUT${CSI}?25h"
- ;;
-
- # Colors - Attributes
- --bold)
- add-color 1 22
- ;;
-
- --faint)
- add-color 2 22
- ;;
-
- --italic)
- add-color 3 23
- ;;
-
- --underline)
- add-color 4 24
- ;;
-
- --blink)
- add-color 5 25
- ;;
-
- --inverse)
- add-color 7 27
- ;;
-
- --invisible)
- add-color 8 28
- ;;
-
- --strike)
- add-color 9 20
- ;;
-
- --fraktur)
- add-color 20 23
- ;;
-
- --double-underline)
- add-color 21 24
- ;;
-
- --frame)
- add-color 51 54
- ;;
-
- --encircle)
- add-color 52 54
- ;;
-
- --overline)
- add-color 53 55
- ;;
-
- # Colors - Foreground
- --black)
- add-color 30 39
- ;;
-
- --red)
- add-color 31 39
- ;;
-
- --green)
- add-color 32 39
- ;;
-
- --yellow)
- add-color 33 39
- ;;
-
- --blue)
- add-color 34 39
- ;;
-
- --magenta)
- add-color 35 39
- ;;
-
- --cyan)
- add-color 36 39
- ;;
-
- --white)
- add-color 37 39
- ;;
-
- --black-intense)
- add-color 90 39
- ;;
-
- --red-intense)
- add-color 91 39
- ;;
-
- --green-intense)
- add-color 92
(Truncated to 10000 characters out of 25422)
⚠️ YAML / yamllint - 6 errors
.github/workflows/awesomebot.yml
4:1 warning truthy value should be one of [false, true] (truthy)
6:16 error too many spaces inside brackets (brackets)
6:20 error too many spaces inside brackets (brackets)
8:16 error too many spaces inside brackets (brackets)
8:20 error too many spaces inside brackets (brackets)
16:5 error wrong indentation: expected 6 but found 4 (indentation)
See detailed reports in MegaLinter artifacts
Set VALIDATE_ALL_CODEBASE: true in mega-linter.yml to validate all sources, not only the diff
Shellcheck persists in not realizing that `echo "$(command) blah blah"` doesn't need another layer of double quotes. Signed-off-by: Joe Block <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

Add a pre-commit configuration file