Skip to content

Commit 5a9cc0c

Browse files
committed
npx mega-linter-runner --install # all defaults
1 parent 0b27cf0 commit 5a9cc0c

File tree

5 files changed

+252
-0
lines changed

5 files changed

+252
-0
lines changed

.cspell.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"ignorePaths": [
3+
"**/node_modules/**",
4+
"**/vscode-extension/**",
5+
"**/.git/**",
6+
"**/.pnpm-lock.json",
7+
".vscode",
8+
"megalinter",
9+
"package-lock.json",
10+
"report"
11+
],
12+
"language": "en",
13+
"noConfigSearch": true,
14+
"words": ["megalinter", "oxsecurity"],
15+
"version": "0.2"
16+
}

.github/workflows/mega-linter.yml

Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
# MegaLinter GitHub Action configuration file
2+
# More info at https://megalinter.io
3+
---
4+
name: MegaLinter
5+
6+
# Trigger mega-linter at every push. Action will also be visible from
7+
# Pull Requests to main
8+
on:
9+
# Comment this line to trigger action only on pull-requests
10+
# (not recommended if you don't pay for GH Actions)
11+
push:
12+
13+
pull_request:
14+
branches:
15+
- main
16+
- master
17+
18+
# Comment env block if you do not want to apply fixes
19+
env:
20+
# Apply linter fixes configuration
21+
#
22+
# When active, APPLY_FIXES must also be defined as environment variable
23+
# (in github/workflows/mega-linter.yml or other CI tool)
24+
APPLY_FIXES: all
25+
26+
# Decide which event triggers application of fixes in a commit or a PR
27+
# (pull_request, push, all)
28+
APPLY_FIXES_EVENT: pull_request
29+
30+
# If APPLY_FIXES is used, defines if the fixes are directly committed (commit)
31+
# or posted in a PR (pull_request)
32+
APPLY_FIXES_MODE: commit
33+
34+
concurrency:
35+
group: ${{ github.ref }}-${{ github.workflow }}
36+
cancel-in-progress: true
37+
38+
jobs:
39+
megalinter:
40+
name: MegaLinter
41+
runs-on: ubuntu-latest
42+
43+
# Give the default GITHUB_TOKEN write permission to commit and push, comment
44+
# issues, and post new Pull Requests; remove the ones you do not need
45+
permissions:
46+
contents: write
47+
issues: write
48+
pull-requests: write
49+
50+
steps:
51+
# Git Checkout
52+
- name: Checkout Code
53+
uses: actions/checkout@v4
54+
with:
55+
token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
56+
57+
# If you use VALIDATE_ALL_CODEBASE = true, you can remove this line to
58+
# improve performance
59+
fetch-depth: 0
60+
61+
# MegaLinter
62+
- name: MegaLinter
63+
64+
# You can override MegaLinter flavor used to have faster performances
65+
# More info at https://megalinter.io/latest/flavors/
66+
uses: oxsecurity/megalinter@v8
67+
68+
id: ml
69+
70+
# All available variables are described in documentation
71+
# https://megalinter.io/latest/config-file/
72+
env:
73+
# Validates all source when push on main, else just the git diff with
74+
# main. Override with true if you always want to lint all sources
75+
#
76+
# To validate the entire codebase, set to:
77+
# VALIDATE_ALL_CODEBASE: true
78+
#
79+
# To validate only diff with main, set to:
80+
# VALIDATE_ALL_CODEBASE: >-
81+
# ${{
82+
# github.event_name == 'push' &&
83+
# github.ref == 'refs/heads/main'
84+
# }}
85+
VALIDATE_ALL_CODEBASE: true
86+
87+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
88+
89+
# Uncomment to use ApiReporter (Grafana)
90+
# API_REPORTER: true
91+
# API_REPORTER_URL: ${{ secrets.API_REPORTER_URL }}
92+
# API_REPORTER_BASIC_AUTH_USERNAME: ${{ secrets.API_REPORTER_BASIC_AUTH_USERNAME }}
93+
# API_REPORTER_BASIC_AUTH_PASSWORD: ${{ secrets.API_REPORTER_BASIC_AUTH_PASSWORD }}
94+
# API_REPORTER_METRICS_URL: ${{ secrets.API_REPORTER_METRICS_URL }}
95+
# API_REPORTER_METRICS_BASIC_AUTH_USERNAME: ${{ secrets.API_REPORTER_METRICS_BASIC_AUTH_USERNAME }}
96+
# API_REPORTER_METRICS_BASIC_AUTH_PASSWORD: ${{ secrets.API_REPORTER_METRICS_BASIC_AUTH_PASSWORD }}
97+
# API_REPORTER_DEBUG: false
98+
99+
# ADD YOUR CUSTOM ENV VARIABLES HERE TO OVERRIDE VALUES OF
100+
# .mega-linter.yml AT THE ROOT OF YOUR REPOSITORY
101+
102+
# Upload MegaLinter artifacts
103+
- name: Archive production artifacts
104+
uses: actions/upload-artifact@v4
105+
if: success() || failure()
106+
with:
107+
name: MegaLinter reports
108+
include-hidden-files: "true"
109+
path: |
110+
megalinter-reports
111+
mega-linter.log
112+
113+
# Create pull request if applicable
114+
# (for now works only on PR from same repository, not from forks)
115+
- name: Create Pull Request with applied fixes
116+
uses: peter-evans/create-pull-request@v6
117+
id: cpr
118+
if: >-
119+
steps.ml.outputs.has_updated_sources == 1 &&
120+
(
121+
env.APPLY_FIXES_EVENT == 'all' ||
122+
env.APPLY_FIXES_EVENT == github.event_name
123+
) &&
124+
env.APPLY_FIXES_MODE == 'pull_request' &&
125+
(
126+
github.event_name == 'push' ||
127+
github.event.pull_request.head.repo.full_name == github.repository
128+
) &&
129+
!contains(github.event.head_commit.message, 'skip fix')
130+
with:
131+
token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
132+
commit-message: "[MegaLinter] Apply linters automatic fixes"
133+
title: "[MegaLinter] Apply linters automatic fixes"
134+
labels: bot
135+
136+
- name: Create PR output
137+
if: >-
138+
steps.ml.outputs.has_updated_sources == 1 &&
139+
(
140+
env.APPLY_FIXES_EVENT == 'all' ||
141+
env.APPLY_FIXES_EVENT == github.event_name
142+
) &&
143+
env.APPLY_FIXES_MODE == 'pull_request' &&
144+
(
145+
github.event_name == 'push' ||
146+
github.event.pull_request.head.repo.full_name == github.repository
147+
) &&
148+
!contains(github.event.head_commit.message, 'skip fix')
149+
run: |
150+
echo "PR Number - ${{ steps.cpr.outputs.pull-request-number }}"
151+
echo "PR URL - ${{ steps.cpr.outputs.pull-request-url }}"
152+
153+
# Push new commit if applicable
154+
# (for now works only on PR from same repository, not from forks)
155+
- name: Prepare commit
156+
if: >-
157+
steps.ml.outputs.has_updated_sources == 1 &&
158+
(
159+
env.APPLY_FIXES_EVENT == 'all' ||
160+
env.APPLY_FIXES_EVENT == github.event_name
161+
) &&
162+
env.APPLY_FIXES_MODE == 'commit' &&
163+
github.ref != 'refs/heads/main' &&
164+
(
165+
github.event_name == 'push' ||
166+
github.event.pull_request.head.repo.full_name == github.repository
167+
) &&
168+
!contains(github.event.head_commit.message, 'skip fix')
169+
run: sudo chown -Rc $UID .git/
170+
171+
- name: Commit and push applied linter fixes
172+
uses: stefanzweifel/git-auto-commit-action@v5
173+
if: >-
174+
steps.ml.outputs.has_updated_sources == 1 &&
175+
(
176+
env.APPLY_FIXES_EVENT == 'all' ||
177+
env.APPLY_FIXES_EVENT == github.event_name
178+
) &&
179+
env.APPLY_FIXES_MODE == 'commit' &&
180+
github.ref != 'refs/heads/main' &&
181+
(
182+
github.event_name == 'push' ||
183+
github.event.pull_request.head.repo.full_name == github.repository
184+
) &&
185+
!contains(github.event.head_commit.message, 'skip fix')
186+
with:
187+
branch: >-
188+
${{
189+
github.event.pull_request.head.ref ||
190+
github.head_ref ||
191+
github.ref
192+
}}
193+
commit_message: "[MegaLinter] Apply linters fixes"
194+
commit_user_name: megalinter-bot
195+
commit_user_email: [email protected]

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
node_modules/
22
data/
33
*.env
4+
5+
megalinter-reports/

.jscpd.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"threshold": 0,
3+
"reporters": ["html", "markdown"],
4+
"ignore": [
5+
"**/node_modules/**",
6+
"**/.git/**",
7+
"**/.rbenv/**",
8+
"**/.venv/**",
9+
"**/*cache*/**",
10+
"**/.github/**",
11+
"**/.idea/**",
12+
"**/report/**",
13+
"**/*.svg"
14+
]
15+
}

.mega-linter.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Configuration file for MegaLinter
2+
#
3+
# See all available variables at https://megalinter.io/latest/config-file/ and in
4+
# linters documentation
5+
6+
# all, none, or list of linter keys
7+
APPLY_FIXES: all
8+
9+
# If you use ENABLE variable, all other languages/formats/tooling-formats will
10+
# be disabled by default
11+
# ENABLE:
12+
13+
# If you use ENABLE_LINTERS variable, all other linters will be disabled by
14+
# default
15+
# ENABLE_LINTERS:
16+
17+
# DISABLE:
18+
# - COPYPASTE # Uncomment to disable checks of excessive copy-pastes
19+
# - SPELL # Uncomment to disable checks of spelling mistakes
20+
21+
SHOW_ELAPSED_TIME: true
22+
23+
# Uncomment if you want MegaLinter to detect errors but not block CI to pass
24+
# DISABLE_ERRORS: true

0 commit comments

Comments
 (0)