Skip to content

Commit

Permalink
[megalinter] setup megalinter
Browse files Browse the repository at this point in the history
[megalinter] setup megalinter configs
  • Loading branch information
tsirysndr committed Mar 11, 2024
1 parent c889d62 commit 515863f
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/megalinter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
run: |
deno run -A src/dagger/list_jobs.ts
dagger functions
dagger call lint --src . --path examples
dagger call lint --src examples/playbooks
working-directory: megalinter
publish:
needs: test
Expand Down
16 changes: 16 additions & 0 deletions megalinter/examples/.cspell.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"ignorePaths": [
"**/node_modules/**",
"**/vscode-extension/**",
"**/.git/**",
"**/.pnpm-lock.json",
".vscode",
"megalinter",
"package-lock.json",
"report"
],
"language": "en",
"noConfigSearch": true,
"words": ["megalinter", "oxsecurity"],
"version": "0.2"
}
1 change: 1 addition & 0 deletions megalinter/examples/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
megalinter-reports/
15 changes: 15 additions & 0 deletions megalinter/examples/.jscpd.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"threshold": 0,
"reporters": ["html", "markdown"],
"ignore": [
"**/node_modules/**",
"**/.git/**",
"**/.rbenv/**",
"**/.venv/**",
"**/*cache*/**",
"**/.github/**",
"**/.idea/**",
"**/report/**",
"**/*.svg"
]
}
26 changes: 26 additions & 0 deletions megalinter/examples/.mega-linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Configuration file for MegaLinter
#
# See all available variables at https://megalinter.io/latest/config-file/ and in
# linters documentation

# all, none, or list of linter keys
APPLY_FIXES: all

# If you use ENABLE variable, all other languages/formats/tooling-formats will
# be disabled by default
# ENABLE:

# If you use ENABLE_LINTERS variable, all other linters will be disabled by
# default
# ENABLE_LINTERS:

# DISABLE:
# - COPYPASTE # Uncomment to disable checks of excessive copy-pastes
# - SPELL # Uncomment to disable checks of spelling mistakes

SHOW_ELAPSED_TIME: true

FILEIO_REPORTER: true

# Uncomment if you want MegaLinter to detect errors but not block CI to pass
# DISABLE_ERRORS: true
7 changes: 2 additions & 5 deletions megalinter/src/dagger/jobs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,18 @@ export const exclude = [];
* @function
* @description Lint files.
* @param {string | Directory | undefined} src
* @param {string} path
* @returns {Directory | string}
*/
export async function lint(
src: Directory | string,
path = "."
src: Directory | string
): Promise<Directory | string> {
const context = await getDirectory(src);
const ctr = dag
.pipeline(Job.lint)
.container()
.from("oxsecurity/megalinter:v7")
.withDirectory("/app", context)
.withWorkdir("/app")
.withExec([path]);
.withWorkdir("/app");

await ctr.stdout();
return ctr.directory("/app/megalinter-reports").id();
Expand Down

0 comments on commit 515863f

Please sign in to comment.