Skip to content

Commit 056494c

Browse files
committed
megalinter customize config; local run ~7min...
```console $ npx mega-linter-runner -r v8 -f cupcake +----SUMMARY----+--------------------------+---------------+-------+-------+--------+----------+--------------+ | Descriptor | Linter | Mode | Files | Fixed | Errors | Warnings | Elapsed time | +---------------+--------------------------+---------------+-------+-------+--------+----------+--------------+ | ✅ ACTION | actionlint | list_of_files | 4 | | 0 | 0 | 3.25s | | ✅ BASH | bash-exec | file | 1 | | 0 | 0 | 2.77s | | ✅ BASH | shellcheck | list_of_files | 1 | | 0 | 0 | 1.16s | | ✅ BASH | shfmt | list_of_files | 1 | 0 | 0 | 0 | 0.6s | | ⚠️ COPYPASTE | jscpd | project | n/a | | 8 | 0 | 24.82s | | ⚠️ DOCKERFILE | hadolint | list_of_files | 1 | | 4 | 0 | 6.74s | | ⚠️ JAVASCRIPT | eslint | list_of_files | 15 | 0 | 1 | 0 | 11.04s | | ✅ JSON | jsonlint | list_of_files | 7 | | 0 | 0 | 4.76s | | ✅ JSON | npm-package-json-lint | project | n/a | | 0 | 0 | 3.26s | | ✅ JSON | prettier | list_of_files | 7 | 0 | 0 | 0 | 5.08s | | ✅ JSON | v8r | list_of_files | 7 | | 0 | 0 | 47.96s | | ✅ MARKDOWN | markdownlint | list_of_files | 2 | 0 | 0 | 0 | 12.16s | | ✅ MARKDOWN | markdown-table-formatter | list_of_files | 2 | 0 | 0 | 0 | 4.15s | | ⚠️ REPOSITORY | checkov | project | n/a | | 3 | 0 | 112.11s | | ✅ REPOSITORY | gitleaks | project | n/a | | 0 | 0 | 3.09s | | ✅ REPOSITORY | git_diff | project | n/a | | 0 | 0 | 1.22s | | ✅ REPOSITORY | grype | project | n/a | | 0 | 0 | 159.7s | | ⚠️ REPOSITORY | kics | project | n/a | | 24 | 0 | 14.82s | | ✅ REPOSITORY | secretlint | project | n/a | | 0 | 0 | 7.24s | | ✅ REPOSITORY | syft | project | n/a | | 0 | 0 | 7.83s | | ⚠️ REPOSITORY | trivy | project | n/a | | 2 | 0 | 28.16s | | ✅ REPOSITORY | trufflehog | project | n/a | | 0 | 0 | 26.51s | | ⚠️ SPELL | cspell | list_of_files | 40 | | 224 | 0 | 82.25s | | ⚠️ SPELL | lychee | list_of_files | 17 | | 9 | 0 | 10.28s | | ✅ YAML | prettier | list_of_files | 8 | 1 | 0 | 0 | 9.12s | | ✅ YAML | v8r | list_of_files | 8 | | 0 | 0 | 39.07s | | ✅ YAML | yamllint | list_of_files | 8 | | 0 | 0 | 5.39s | +---------------+--------------------------+---------------+-------+-------+--------+----------+--------------+ ```
1 parent 76af81d commit 056494c

File tree

10 files changed

+73
-24
lines changed

10 files changed

+73
-24
lines changed

.cspell.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
{
22
"ignorePaths": [
3+
"**/data/**",
4+
"docker.yml",
5+
"Dockerfile",
6+
".jscpd.json",
37
"**/node_modules/**",
48
"**/vscode-extension/**",
59
"**/.git/**",
@@ -11,6 +15,6 @@
1115
],
1216
"language": "en",
1317
"noConfigSearch": true,
14-
"words": ["megalinter", "oxsecurity"],
18+
"words": ["megalinter", "oxsecurity", "ralf", "vogler", "DOCKERHUB"],
1519
"version": "0.2"
1620
}

.github/renovate.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
{
22
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
33
"enabled": false,
4-
"extends": [
5-
"config:recommended"
6-
]
4+
"extends": ["config:recommended"]
75
}

.github/workflows/docker.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
- "**"
99
- "!*.md"
1010
# - '!.github/**'
11-
pull_request: # runs when opened/reopned or when the head branch is updated
11+
pull_request: # runs when opened/reopened or when the head branch is updated
1212

1313
permissions:
1414
contents: read

.github/workflows/mega-linter.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
# MegaLinter GitHub Action configuration file
22
# More info at https://megalinter.io
3-
# Run this locally via Docker:
4-
# npx mega-linter-runner -r v8 -f cupcake # run as configured in .mega-linter
5-
# npx mega-linter-runner -r v8 -f cupcake -e "'ENABLE=MARKDOWN,YAML'" -e "APPLY_FIXES=none" # only enable certain groups and disable automatic fixes (note that the '' are required for multiple values)
6-
# npx mega-linter-runner -r v8 -f cupcake -e "ENABLE_LINTERS=MARKDOWN_MARKDOWN_LINK_CHECK" # run a specific linter
3+
4+
# See .mega-linter.yml for actual config and examples how to run this locally.
75
---
86
name: MegaLinter
97

@@ -198,3 +196,10 @@ jobs:
198196
commit_message: "[MegaLinter] Apply linters fixes"
199197
commit_user_name: megalinter-bot
200198
commit_user_email: [email protected]
199+
200+
# https://megalinter.io/latest/reporters/SarifReporter/
201+
- name: Upload MegaLinter scan results to GitHub Security tab
202+
if: success() || failure()
203+
uses: github/codeql-action/upload-sarif@v2
204+
with:
205+
sarif_file: "megalinter-reports/megalinter-report.sarif"

.mega-linter.yml

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33
# See all available variables at https://megalinter.io/latest/config-file/ and in
44
# linters documentation
55

6+
# See .github/workflows/mega-linter.yml for GitHub config.
7+
8+
# Run this locally via Docker:
9+
# npx mega-linter-runner -r v8 -f cupcake # run as configured here
10+
# npx mega-linter-runner -r v8 -f cupcake -e "'ENABLE=MARKDOWN,YAML'" -e "APPLY_FIXES=none" # only enable certain groups and disable automatic fixes (note that the '' are required for multiple values)
11+
# npx mega-linter-runner -r v8 -f cupcake -e "ENABLE_LINTERS=MARKDOWN_MARKDOWN_LINK_CHECK" # run a specific linter
12+
# https://github.com/oxsecurity/megalinter#cli-lint-mode most linters will respect .gitignore, but the ones running in 'project' mode will not and may take forever if not configured right
13+
614
# all, none, or list of linter keys
715
APPLY_FIXES: all
816

@@ -26,17 +34,51 @@ SHOW_ELAPSED_TIME: true
2634
# ---
2735
# Custom config:
2836

29-
# PRINT_ALPACA: false
37+
PRINT_ALPACA: false
38+
39+
JAVASCRIPT_DEFAULT_STYLE: prettier # disables JAVASCRIPT_STANDARD in favor of JAVASCRIPT_PRETTIER - disabled below since I prefer my local eslint
40+
41+
# DISABLE: # groups of linters/formatters
42+
# - REPOSITORY # ignore this for now (at least locally) since all project-based and need extra config like .gitignore
3043

3144
# npx mega-linter-runner -r v8 -f cupcake -e "ENABLE_LINTERS=MARKDOWN_MARKDOWN_LINK_CHECK" # run a specific linter locally
32-
DISABLE_LINTERS:
33-
- MARKDOWN_MARKDOWN_LINK_CHECK # took 32s and only reported 0 (e.g. for localhost) or 403 (forbidden) for working links to settings or due to DDoS/bot protections
45+
DISABLE_LINTERS: # times are for running locally with 30GB swap, 65% pressure and several GB in data/ (relevant for project-mode linters that don't respect .gitignore)
46+
- MARKDOWN_MARKDOWN_LINK_CHECK # 30s, only reported 0 (e.g. for localhost) or 403 (forbidden) for working links to settings or due to DDoS/bot protections
47+
- JAVASCRIPT_STANDARD # don't like standard format
48+
- JAVASCRIPT_PRETTIER # prefer my local eslint config
49+
- REPOSITORY_TRIVY_SBOM # 11s, don't need SBOM
50+
51+
DISABLE_ERRORS_LINTERS: # error -> warning
52+
- DOCKERFILE_HADOLINT # mostly wants to pin versions for apt and pip installs and merge consecutive RUN instructions
53+
- COPYPASTE_JSCPD # default threshold is 0% duplicates -> can make this error once sep. scripts are refactored
54+
- SPELL_CSPELL # needs config in .cspell.json, but looks annoying since it also flags apt packages
55+
- SPELL_LYCHEE # dead link checking, 9/332 errors all false positives (Forbidden etc.)
56+
- JAVASCRIPT_ES # this uses old eslint 8.57.1 instead of local 9.26.0 and complains about stuff that newer version has no problem with
57+
- REPOSITORY_CHECKOV # docker healthcheck not needed for CLI
58+
- REPOSITORY_KICS # wants to pin GitHub Actions to commit sha etc.
59+
- REPOSITORY_TRIVY # docker healthcheck not needed for CLI
60+
61+
# Customizations via CLI arguments:
62+
63+
# https://github.com/prantlf/jsonlint#command-line-interface
64+
JSON_JSONLINT_ARGUMENTS: --comments --trailing-commas --no-duplicate-keys
65+
66+
# https://prettier.io/docs/options#trailing-commas
67+
# JSON_PRETTIER_ARGUMENTS: --trailing-comma all --parser jsonc # need to change parser too since the default json parser still strips trailing commas
68+
# -> let prettier remove trailing commas since e.g. npm will fail to JSON.parse package.json otherwise...
69+
70+
# megalinter still expects the old .eslintrc file... https://github.com/oxsecurity/megalinter/issues/3570#issuecomment-2138193684
71+
JAVASCRIPT_ES_CONFIG_FILE: eslint.config.js
72+
JAVASCRIPT_ES_COMMAND_REMOVE_ARGUMENTS: ["--no-eslintrc"] # not a valid option for eslint with flat config
73+
# worked, but behaved differently than local `npm run lint` and complained about while(true) with break - probably due old version 8.57.1 (same with -r beta) instead of my local 9.26.0
3474

35-
# DISABLE_ERRORS_LINTERS: # error -> warning
36-
# - MARKDOWN_MARKDOWN_LINK_CHECK
75+
# https://github.com/oxsecurity/megalinter#cli-lint-mode
76+
REPOSITORY_SECRETLINT_ARGUMENTS: --secretlintignore .gitignore
3777

38-
# DISABLE_LINTERS: JAVASCRIPT_STANDARD
78+
# https://www.checkov.io/2.Basics/CLI%20Command%20Reference.html
79+
REPOSITORY_CHECKOV_ARGUMENTS: --skip-path node_modules --skip-path data
3980

4081
# CI will comment on PRs etc., but for running locally (or downloading the results), we want more than the default megalinter-reports/megalinter.log as an overview:
4182
JSON_REPORTER: true # mega-linter-report.json
4283
MARKDOWN_SUMMARY_REPORTER: true # megalinter-report.md
84+
SARIF_REPORTER: true # mega-linter-report.sarif - results for supported lintes should be shown in GitHub Security tab - https://megalinter.io/latest/reporters/SarifReporter/

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
"source.fixAll.eslint": "explicit"
77
},
88
"eslint.experimental.useFlatConfig": true,
9-
"eslint.codeActionsOnSave.rules": null,
9+
"eslint.codeActionsOnSave.rules": null
1010
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ You can also put options in `data/config.env` which will be loaded by [dotenv](h
114114
The scripts will try to send notifications for successfully claimed games and any errors like needing to log in or encountered captchas (should not happen).
115115

116116
[apprise](https://github.com/caronc/apprise) is used for notifications and offers many services including Pushover, Slack, Telegram, SMS, Email, desktop and custom notifications.
117-
You just need to set `NOTIFY` to the notification services you want to use, e.g. `NOTIFY='mailto://myemail:mypass@gmail.com' 'pbul://o.gn5kj6nfhv736I7jC3cj3QLRiyhgl98b'` - refer to their list of services and [examples](https://github.com/caronc/apprise#command-line-usage).
117+
You just need to set `NOTIFY` to the notification services you want to use, e.g. `NOTIFY='mailto://[email protected]' 'pbul://o.gn5kj6nfhv736I7jC3cj3QLRiyhgl98b'` - refer to their list of services and [examples](https://github.com/caronc/apprise#command-line-usage).
118118

119119
### Automatic login, two-factor authentication
120120
If you set the options for email, password and OTP key, there will be no prompts and logins should happen automatically. This is optional since all stores should stay logged in since cookies are refreshed.

docker-entrypoint.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ rm -f /fgc/data/browser/SingletonLock
1717
mkdir -p /fgc/data/browser
1818
# fix for 'Incorrect response' after solving a captcha correctly - https://github.com/vogler/free-games-claimer/issues/261#issuecomment-1868385830
1919
# echo 'user_pref("privacy.resistFingerprinting", true);' > /fgc/data/browser/user.js
20-
cat << EOT >/fgc/data/browser/user.js
20+
cat <<EOT >/fgc/data/browser/user.js
2121
user_pref("privacy.resistFingerprinting", true);
2222
// user_pref("privacy.resistFingerprinting.letterboxing", true);
2323
// user_pref("browser.contentblocking.category", "strict");
@@ -41,11 +41,11 @@ export DISPLAY=:1 # need to export this, otherwise playwright complains with 'Lo
4141
Xvfb $DISPLAY -ac -screen 0 "${WIDTH}x${HEIGHT}x${DEPTH}" &
4242
echo "Xvfb display server created screen with resolution ${WIDTH}x${HEIGHT}"
4343
if [ -z "$VNC_PASSWORD" ]; then
44-
pw="-nopw"
45-
pwt="no password!"
44+
pw="-nopw"
45+
pwt="no password!"
4646
else
47-
pw="-passwd $VNC_PASSWORD"
48-
pwt="with password"
47+
pw="-passwd $VNC_PASSWORD"
48+
pwt="with password"
4949
fi
5050
x11vnc -display $DISPLAY -forever -shared -rfbport "$VNC_PORT" -bg "$pw" 2>/dev/null 1>&2
5151
echo "VNC is running on port $VNC_PORT ($pwt)"

eslint.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default [
99
// object with just `ignores` applies to all configuration objects
1010
// had `ln -s .gitignore .eslintignore` before, but .eslintignore no longer supported
1111
{
12-
ignores: ['data/**'],
12+
ignores: ['data/**', 'megalinter-reports/**'],
1313
},
1414
js.configs.recommended, // TODO still needed?
1515
{

jsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"checkJs": true,
44
"target": "es2021",
55
"module": "NodeNext",
6-
"moduleResolution": "NodeNext", // https://github.com/typicode/lowdb/issues/554
6+
"moduleResolution": "NodeNext" // https://github.com/typicode/lowdb/issues/554
77
},
88
"exclude": ["node_modules", "**/node_modules"]
99
}

0 commit comments

Comments
 (0)