From 515863f8ba3ff97a3f2f513de8d007e6a1e019ff Mon Sep 17 00:00:00 2001 From: Tsiry Sandratraina Date: Mon, 11 Mar 2024 12:16:34 +0000 Subject: [PATCH] [megalinter] setup megalinter [megalinter] setup megalinter configs --- .github/workflows/megalinter.yml | 2 +- megalinter/examples/.cspell.json | 16 ++++++++++++++++ megalinter/examples/.gitignore | 1 + megalinter/examples/.jscpd.json | 15 +++++++++++++++ megalinter/examples/.mega-linter.yml | 26 ++++++++++++++++++++++++++ megalinter/src/dagger/jobs.ts | 7 ++----- 6 files changed, 61 insertions(+), 6 deletions(-) create mode 100644 megalinter/examples/.cspell.json create mode 100644 megalinter/examples/.gitignore create mode 100644 megalinter/examples/.jscpd.json create mode 100644 megalinter/examples/.mega-linter.yml diff --git a/.github/workflows/megalinter.yml b/.github/workflows/megalinter.yml index ebdc151..0e37dd2 100644 --- a/.github/workflows/megalinter.yml +++ b/.github/workflows/megalinter.yml @@ -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 diff --git a/megalinter/examples/.cspell.json b/megalinter/examples/.cspell.json new file mode 100644 index 0000000..b798d29 --- /dev/null +++ b/megalinter/examples/.cspell.json @@ -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" +} diff --git a/megalinter/examples/.gitignore b/megalinter/examples/.gitignore new file mode 100644 index 0000000..549fbd5 --- /dev/null +++ b/megalinter/examples/.gitignore @@ -0,0 +1 @@ +megalinter-reports/ diff --git a/megalinter/examples/.jscpd.json b/megalinter/examples/.jscpd.json new file mode 100644 index 0000000..2cee5f5 --- /dev/null +++ b/megalinter/examples/.jscpd.json @@ -0,0 +1,15 @@ +{ + "threshold": 0, + "reporters": ["html", "markdown"], + "ignore": [ + "**/node_modules/**", + "**/.git/**", + "**/.rbenv/**", + "**/.venv/**", + "**/*cache*/**", + "**/.github/**", + "**/.idea/**", + "**/report/**", + "**/*.svg" + ] +} diff --git a/megalinter/examples/.mega-linter.yml b/megalinter/examples/.mega-linter.yml new file mode 100644 index 0000000..43d61f0 --- /dev/null +++ b/megalinter/examples/.mega-linter.yml @@ -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 diff --git a/megalinter/src/dagger/jobs.ts b/megalinter/src/dagger/jobs.ts index 7e11b37..f2fa9cf 100644 --- a/megalinter/src/dagger/jobs.ts +++ b/megalinter/src/dagger/jobs.ts @@ -17,12 +17,10 @@ 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 { const context = await getDirectory(src); const ctr = dag @@ -30,8 +28,7 @@ export async function 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();