Skip to content

Commit 807256b

Browse files
Kaniska244Copilot
andauthored
Add linters in images repository (#1786)
* Add linters in images repository * Update .github/workflows/code-linter.yml Co-authored-by: Copilot <[email protected]> * Update .github/linters/.hadolint.yaml Co-authored-by: Copilot <[email protected]> * Remove unused variable * Updating the GitHub Token to the expected PAT in images repo * Setting pull request summary flag to diable summary on the PR * Setting MULTI_STATUS as false * Changed the workflow and job name. --------- Co-authored-by: Copilot <[email protected]>
1 parent f30a167 commit 807256b

5 files changed

Lines changed: 106 additions & 1 deletion

File tree

.github/linters/.hadolint.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
##########################
3+
## Hadolint config file ##
4+
##########################
5+
failure-threshold: "error"
6+
ignored:
7+
- DL4001 # Ignore wget and curl in same file
8+
- DL4006 # ignore pipefail as we don't want to add layers
9+
- DL3018 # Allow unpinned OS package versions (see DL3008 note for APT)
10+
- DL3013 # Allow unpinned pip package versions; versions are managed outside the Dockerfile
11+
- DL3003 # Ignore workdir so we don't add layers
12+
- SC2016 # ignore as its interpreted later
13+
- DL3044 # Ignore using env in env
14+
- DL3008 # Ignore pinned versions check for APT
15+
- SC3020 # Ignore POSIX check of the shorthand redirection(&>)
16+
- SC2283 # Remove spaces around = to assign and this is not needed

.github/linters/.shellcheckrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
shell=bash
2+
disable=SC1101,SC1102
3+
severity=error

.github/linters/eslint.config.mjs

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import { defineConfig } from "eslint/config";
2+
import { FlatCompat } from "@eslint/eslintrc";
3+
import js from "@eslint/js";
4+
import globals from "globals";
5+
import jsoncParser from "jsonc-eslint-parser";
6+
7+
const compat = new FlatCompat();
8+
9+
export default defineConfig([
10+
js.configs.recommended,
11+
12+
{
13+
files: ["**/*.js", "**/*.cjs"],
14+
languageOptions: {
15+
ecmaVersion: 2021,
16+
sourceType: "script",
17+
globals: {
18+
...globals.node,
19+
},
20+
},
21+
rules: {
22+
"no-undef": "error",
23+
},
24+
},
25+
26+
{
27+
files: ["build/src/prep.js"],
28+
languageOptions: {
29+
globals: { scriptLibraryPathInRepo: "readonly" },
30+
},
31+
},
32+
33+
{
34+
files: ["build/src/push.js"],
35+
rules: {
36+
"no-useless-escape": "off",
37+
},
38+
},
39+
40+
{
41+
files: ["build/src/utils/async.js"],
42+
rules: {
43+
"no-redeclare": ["error", { builtinGlobals: false }],
44+
},
45+
},
46+
47+
...compat.extends("plugin:jsonc/recommended-with-jsonc"),
48+
{
49+
files: ["**/*.json"],
50+
languageOptions: {
51+
parser: jsoncParser,
52+
parserOptions: { jsonSyntax: "JSONC" },
53+
},
54+
},
55+
]);

.github/workflows/code-linter.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: JSON, shell, javascript and Dockerfile linter
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
code-linter-steps:
11+
name: JSON, shell, javascript and Dockerfile linter
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
19+
- uses: super-linter/super-linter/slim@v8
20+
env:
21+
MULTI_STATUS : false
22+
ENABLE_GITHUB_PULL_REQUEST_SUMMARY_COMMENT: false
23+
BASH_SEVERITY: error
24+
VALIDATE_ALL_CODEBASE: true
25+
DEFAULT_BRANCH: main
26+
FILTER_REGEX_INCLUDE: '(^|.*/)(src/.*|build/.*\.js|Dockerfile)$'
27+
FILTER_REGEX_EXCLUDE: '(^|.*/)src/.*/test-project(/.*)?$'
28+
VALIDATE_DOCKERFILE_HADOLINT: true
29+
VALIDATE_JAVASCRIPT_ES: true
30+
VALIDATE_JSON: true
31+
VALIDATE_BASH: true
32+

build/src/prep.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ const path = require('path');
77
const asyncUtils = require('./utils/async');
88
const configUtils = require('./utils/config');
99
const handlebars = require('handlebars');
10-
const mkdirp = require('mkdirp');
1110
const scriptSHA = {};
1211

1312
const assetsPath = path.join(__dirname, '..', 'assets');

0 commit comments

Comments
 (0)