way_of_working-code_linting-hdi 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.mega-linter.yml +61 -109
- data/CHANGELOG.md +16 -1
- data/README.md +2 -4
- data/code_safety.yml +54 -42
- data/docs/way_of_working/code-linting/index.md +50 -17
- data/docs/way_of_working/code-linting/linters.md +95 -92
- data/lib/way_of_working/code_linting/hdi/generators/concerns/github_metadata.rb +42 -0
- data/lib/way_of_working/code_linting/hdi/generators/document_linters.rb +4 -2
- data/lib/way_of_working/code_linting/hdi/generators/init_linters.rb +108 -4
- data/lib/way_of_working/code_linting/hdi/templates/.eslintrc.js +20 -0
- data/lib/way_of_working/code_linting/hdi/templates/.github/linters/.markdown-link-check.json +11 -11
- data/lib/way_of_working/code_linting/hdi/templates/.github/workflows/mega-linter.yml +107 -33
- data/lib/way_of_working/code_linting/hdi/templates/.mega-linter.yml +61 -109
- data/lib/way_of_working/code_linting/hdi/templates/docs/way_of_working/code-linting/index.md.tt +72 -0
- data/lib/way_of_working/code_linting/hdi/version.rb +1 -1
- data/lib/way_of_working/code_linting/hdi.rb +1 -0
- metadata +19 -3
- data/lib/way_of_working/code_linting/hdi/templates/docs/way_of_working/code-linting/index.md +0 -39
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a2ac32bc142da97f31d1f82eaf8ff6c096b791c3637b20c28cf3b569cdcfc255
|
4
|
+
data.tar.gz: ee921d9e21413fd2ad5135d8dfbb5f0ec5266e18c85e3921354f7a9c98a56c68
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3dc141e6ce6b4c5fd7bbfcf0e5f9436ca789aa1020a1c173d56b994d0ec68ee7f54b3872a3cbd8e510368f2355d30bdbbe348eb5f8dddf5f33fb169928b3e5f
|
7
|
+
data.tar.gz: 84aed381dde77584a9f63e352c948fac64d587729c09575fded054726c5d4a69fd4c3fc6cd91bbcf5223947d054d83a0327267dfe7d0db1b3489a3b04119574c
|
data/.mega-linter.yml
CHANGED
@@ -3,127 +3,65 @@
|
|
3
3
|
# See all available variables at https://megalinter.io/configuration/
|
4
4
|
# and in linters documentation
|
5
5
|
|
6
|
-
APPLY_FIXES: none
|
7
|
-
ENABLE_LINTERS:
|
8
|
-
|
9
|
-
-
|
10
|
-
-
|
11
|
-
-
|
6
|
+
APPLY_FIXES: none # all, none, or list of linter keys
|
7
|
+
ENABLE_LINTERS: # All other linters will be disabled by default
|
8
|
+
- ACTION_ACTIONLINT
|
9
|
+
- API_SPECTRAL
|
10
|
+
- ARM_ARM_TTK
|
11
|
+
- BASH_EXEC
|
12
|
+
- BASH_SHELLCHECK
|
13
|
+
- BASH_SHFMT
|
14
|
+
- BICEP_BICEP_LINTER
|
12
15
|
- C_CLANG_FORMAT
|
16
|
+
- C_CPPCHECK
|
13
17
|
- C_CPPLINT
|
14
|
-
|
15
|
-
|
16
|
-
- COFFEE_COFFEELINT # in Super-Linter
|
18
|
+
- CLOUDFORMATION_CFN_LINT
|
19
|
+
- COPYPASTE_JSCPD
|
17
20
|
- CPP_CLANG_FORMAT
|
18
|
-
-
|
19
|
-
-
|
20
|
-
-
|
21
|
-
-
|
22
|
-
-
|
23
|
-
-
|
24
|
-
-
|
25
|
-
|
26
|
-
-
|
27
|
-
-
|
28
|
-
-
|
29
|
-
|
30
|
-
-
|
31
|
-
-
|
32
|
-
-
|
33
|
-
- KOTLIN_KTLINT # in Super-Linter
|
34
|
-
# - LUA_LUACHECK # in Super-Linter
|
35
|
-
# - LUA_SELENE
|
36
|
-
# - LUA_STYLUA
|
37
|
-
- MAKEFILE_CHECKMAKE
|
38
|
-
# - PERL_PERLCRITIC # in Super-Linter
|
39
|
-
# - PHP_BUILTIN
|
40
|
-
# - PHP_PHPCS # in Super-Linter
|
41
|
-
# - PHP_PHPCSFIXER
|
42
|
-
# - PHP_PHPLINT # in Super-Linter
|
43
|
-
# - PHP_PHPSTAN # in Super-Linter
|
44
|
-
# - PHP_PSALM # in Super-Linter
|
45
|
-
# - POWERSHELL_POWERSHELL
|
46
|
-
# - POWERSHELL_POWERSHELL_FORMATTER
|
47
|
-
- PYTHON_BANDIT
|
48
|
-
- PYTHON_BLACK # in Super-Linter
|
49
|
-
- PYTHON_FLAKE8 # in Super-Linter
|
50
|
-
- PYTHON_ISORT # in Super-Linter
|
51
|
-
- PYTHON_MYPY
|
52
|
-
- PYTHON_PYLINT # in Super-Linter
|
53
|
-
- PYTHON_PYRIGHT
|
54
|
-
- PYTHON_RUFF
|
55
|
-
- R_LINTR # in Super-Linter
|
56
|
-
# - RAKU_RAKU # in Super-Linter
|
57
|
-
# - RUBY_RUBOCOP # in Super-Linter
|
58
|
-
- RUST_CLIPPY # in Super-Linter
|
59
|
-
# - SALESFORCE_LIGHTNING_FLOW_SCANNER
|
60
|
-
# - SALESFORCE_SFDX_SCANNER_APEX
|
61
|
-
# - SALESFORCE_SFDX_SCANNER_AURA
|
62
|
-
# - SALESFORCE_SFDX_SCANNER_LWC
|
63
|
-
- SCALA_SCALAFIX
|
64
|
-
- SQL_SQLFLUFF # in Super-Linter
|
65
|
-
- SQL_TSQLLINT
|
66
|
-
- SWIFT_SWIFTLINT
|
67
|
-
- TSX_ESLINT
|
68
|
-
- TYPESCRIPT_ES # in Super-Linter
|
69
|
-
# - TYPESCRIPT_PRETTIER
|
70
|
-
- TYPESCRIPT_STANDARD # in Super-Linter
|
71
|
-
# - VBDOTNET_DOTNET_FORMAT
|
72
|
-
|
73
|
-
### Formats
|
74
|
-
- CSS_STYLELINT # in Super-Linter
|
75
|
-
- ENV_DOTENV_LINTER # in Super-Linter
|
76
|
-
# - GRAPHQL_GRAPHQL_SCHEMA_LINTER
|
77
|
-
# - HTML_DJLINT # Refuses to see config file
|
78
|
-
- HTML_HTMLHINT # in Super-Linter
|
79
|
-
- JSON_ESLINT_PLUGIN_JSONC # in Super-Linter
|
21
|
+
- CPP_CPPCHECK
|
22
|
+
- CPP_CPPLINT
|
23
|
+
- CREDENTIALS_SECRETLINT
|
24
|
+
- CSS_SCSSLINT
|
25
|
+
- CSS_STYLELINT
|
26
|
+
- DOCKERFILE_DOCKERFILELINT
|
27
|
+
- DOCKERFILE_HADOLINT
|
28
|
+
- ENV_DOTENV_LINTER
|
29
|
+
- GHERKIN_GHERKIN_LINT
|
30
|
+
- GIT_GIT_DIFF
|
31
|
+
- GRAPHQL_GRAPHQL_SCHEMA_LINTER
|
32
|
+
- HTML_DJLINT
|
33
|
+
- HTML_HTMLHINT
|
34
|
+
- JAVASCRIPT_ES
|
35
|
+
- JSON_ESLINT_PLUGIN_JSONC
|
80
36
|
- JSON_JSONLINT
|
81
37
|
- JSON_NPM_PACKAGE_JSON_LINT
|
82
|
-
|
38
|
+
- JSON_PRETTIER
|
83
39
|
- JSON_V8R
|
84
|
-
|
85
|
-
-
|
40
|
+
- KOTLIN_DETEKT
|
41
|
+
- KOTLIN_KTLINT
|
42
|
+
- MAKEFILE_CHECKMAKE
|
86
43
|
- MARKDOWN_MARKDOWN_LINK_CHECK
|
87
44
|
- MARKDOWN_MARKDOWN_TABLE_FORMATTER
|
45
|
+
- MARKDOWN_MARKDOWNLINT
|
88
46
|
- MARKDOWN_REMARK_LINT
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
-
|
94
|
-
|
95
|
-
-
|
96
|
-
-
|
97
|
-
|
98
|
-
|
99
|
-
-
|
100
|
-
-
|
101
|
-
- API_SPECTRAL
|
102
|
-
- ARM_ARM_TTK # in Super-Linter
|
103
|
-
# - BICEP_BICEP_LINTER
|
104
|
-
- CLOUDFORMATION_CFN_LINT # in Super-Linter
|
105
|
-
- DOCKERFILE_HADOLINT # in Super-Linter
|
106
|
-
- EDITORCONFIG_EDITORCONFIG_CHECKER # in Super-Linter
|
107
|
-
# - GHERKIN_GHERKIN_LINT # in Super-Linter
|
108
|
-
- KUBERNETES_HELM
|
109
|
-
- KUBERNETES_KUBECONFORM
|
110
|
-
- KUBERNETES_KUBESCAPE
|
111
|
-
- PUPPET_PUPPET_LINT
|
112
|
-
# - SNAKEMAKE_LINT # in Super-Linter
|
113
|
-
# - SNAKEMAKE_SNAKEFMT # in Super-Linter
|
114
|
-
# - TEKTON_TEKTON_LINT # in Super-Linter
|
115
|
-
- TERRAFORM_TERRAFORM_FMT # in Super-Linter
|
116
|
-
- TERRAFORM_TERRAGRUNT # in Super-Linter
|
117
|
-
- TERRAFORM_TERRASCAN # in Super-Linter
|
118
|
-
- TERRAFORM_TFLINT # in Super-Linter
|
119
|
-
|
120
|
-
### Code quality checkers
|
121
|
-
- COPYPASTE_JSCPD # in Super-Linter
|
47
|
+
- OPENAPI_SPECTRAL
|
48
|
+
- PROTOBUF_PROTOLINT
|
49
|
+
- PYTHON_BANDIT
|
50
|
+
- PYTHON_BLACK
|
51
|
+
- PYTHON_FLAKE8
|
52
|
+
- PYTHON_ISORT
|
53
|
+
- PYTHON_MYPY
|
54
|
+
- PYTHON_PYLINT
|
55
|
+
- PYTHON_PYRIGHT
|
56
|
+
- PYTHON_RUFF
|
57
|
+
- PYTHON_RUFF_FORMAT
|
58
|
+
- R_LINTR
|
122
59
|
- REPOSITORY_CHECKOV
|
123
60
|
- REPOSITORY_DEVSKIM
|
124
61
|
- REPOSITORY_DUSTILOCK
|
125
62
|
- REPOSITORY_GIT_DIFF
|
126
|
-
- REPOSITORY_GITLEAKS
|
63
|
+
- REPOSITORY_GITLEAKS
|
64
|
+
- REPOSITORY_GOODCHECK
|
127
65
|
- REPOSITORY_GRYPE
|
128
66
|
- REPOSITORY_KICS
|
129
67
|
- REPOSITORY_LS_LINT
|
@@ -133,10 +71,24 @@ ENABLE_LINTERS: # All other linters will be disabled by default
|
|
133
71
|
- REPOSITORY_TRIVY
|
134
72
|
- REPOSITORY_TRIVY_SBOM
|
135
73
|
- REPOSITORY_TRUFFLEHOG
|
136
|
-
# - SPELL_CSPELL
|
137
74
|
- SPELL_LYCHEE
|
75
|
+
- SPELL_MISSPELL
|
138
76
|
- SPELL_PROSELINT
|
139
77
|
- SPELL_VALE
|
78
|
+
- SQL_SQL_LINT
|
79
|
+
- SQL_SQLFLUFF
|
80
|
+
- SQL_TSQLLINT
|
81
|
+
- SWIFT_SWIFTLINT
|
82
|
+
- TERRAFORM_CHECKOV
|
83
|
+
- TERRAFORM_KICS
|
84
|
+
- TERRAFORM_TERRAFORM_FMT
|
85
|
+
- TERRAFORM_TERRAGRUNT
|
86
|
+
- TERRAFORM_TERRASCAN
|
87
|
+
- TERRAFORM_TFLINT
|
88
|
+
- XML_XMLLINT
|
89
|
+
- YAML_PRETTIER
|
90
|
+
- YAML_V8R
|
91
|
+
- YAML_YAMLLINT
|
140
92
|
|
141
93
|
SHOW_ELAPSED_TIME: false
|
142
94
|
FILEIO_REPORTER: false
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
<!-- markdownlint-disable-file MD024 -->
|
1
2
|
# Changelog
|
2
3
|
|
3
4
|
All notable changes to this project will be documented in this file.
|
@@ -7,6 +8,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
7
8
|
|
8
9
|
## [Unreleased]
|
9
10
|
|
11
|
+
## [1.1.0] - 2025-10-15
|
12
|
+
|
13
|
+
### Added
|
14
|
+
|
15
|
+
- Switched from Standard to ESLint (with Standard rules) to enable us to add Cypress and Jasmine globals
|
16
|
+
- Added CODEOWNERS protection of the linting standards files
|
17
|
+
|
18
|
+
### Changed
|
19
|
+
|
20
|
+
- Switched to MegaLinter v9
|
21
|
+
- Updated the linting GitHub workflow in line with upstream changes
|
22
|
+
- Rewritten the documentation to be easier to read for both humans and LLMs.
|
23
|
+
|
10
24
|
## [1.0.0] - 2025-01-27
|
11
25
|
|
12
26
|
### Added
|
@@ -16,5 +30,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
16
30
|
- Added MegaLinter for linting common file formats with generator command and rake task
|
17
31
|
- Added a GitHub audit rule to check that linting is used and configured correctly
|
18
32
|
|
19
|
-
[unreleased]: https://github.com/HealthDataInsight/way_of_working-code_linting-hdi/compare/v1.
|
33
|
+
[unreleased]: https://github.com/HealthDataInsight/way_of_working-code_linting-hdi/compare/v1.1.0...HEAD
|
34
|
+
[1.1.0]: https://github.com/HealthDataInsight/way_of_working-code_linting-hdi/compare/v1.0.0...v1.1.0
|
20
35
|
[1.0.0]: https://github.com/HealthDataInsight/way_of_working-code_linting-hdi/releases/tag/v1.0.0
|
data/README.md
CHANGED
@@ -11,18 +11,16 @@ Code linters like MegaLinter benefit developers and teams because they help impr
|
|
11
11
|
|
12
12
|
## Installation
|
13
13
|
|
14
|
-
TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
|
15
|
-
|
16
14
|
Install the gem and add to the application's Gemfile by executing:
|
17
15
|
|
18
16
|
```bash
|
19
|
-
bundle add
|
17
|
+
bundle add way_of_working-code_linting-hdi
|
20
18
|
```
|
21
19
|
|
22
20
|
If bundler is not being used to manage dependencies, install the gem by executing:
|
23
21
|
|
24
22
|
```bash
|
25
|
-
gem install
|
23
|
+
gem install way_of_working-code_linting-hdi
|
26
24
|
```
|
27
25
|
|
28
26
|
## Usage
|
data/code_safety.yml
CHANGED
@@ -4,34 +4,38 @@ file safety:
|
|
4
4
|
comments:
|
5
5
|
reviewed_by: shilpigoeldev
|
6
6
|
safe_revision: b89ef4afd67d02b6f6ff323bb9accde2dcf2686d
|
7
|
+
".github/CODEOWNERS":
|
8
|
+
comments:
|
9
|
+
reviewed_by: timgentry
|
10
|
+
safe_revision: 82687366222b885cbc41449f5bbd30fe9440cd4c
|
7
11
|
".github/linters/.markdown-link-check.json":
|
8
12
|
comments:
|
9
|
-
reviewed_by:
|
10
|
-
safe_revision:
|
13
|
+
reviewed_by: timgentry
|
14
|
+
safe_revision: 2af6973c231a711ae512dc2d3bd3280b11382d6c
|
11
15
|
".github/linters/rubocop_defaults.yml":
|
12
16
|
comments:
|
13
17
|
reviewed_by: shilpigoeldev
|
14
18
|
safe_revision: b89ef4afd67d02b6f6ff323bb9accde2dcf2686d
|
15
19
|
".github/workflows/inclusive-language.yml":
|
16
20
|
comments:
|
17
|
-
reviewed_by:
|
18
|
-
safe_revision:
|
21
|
+
reviewed_by: timgentry
|
22
|
+
safe_revision: 2af6973c231a711ae512dc2d3bd3280b11382d6c
|
19
23
|
".github/workflows/main.yml":
|
20
24
|
comments:
|
21
|
-
reviewed_by:
|
22
|
-
safe_revision:
|
25
|
+
reviewed_by: timgentry
|
26
|
+
safe_revision: 2af6973c231a711ae512dc2d3bd3280b11382d6c
|
23
27
|
".github/workflows/mega-linter.yml":
|
24
28
|
comments:
|
25
|
-
reviewed_by:
|
26
|
-
safe_revision:
|
29
|
+
reviewed_by: timgentry
|
30
|
+
safe_revision: 82687366222b885cbc41449f5bbd30fe9440cd4c
|
27
31
|
".gitignore":
|
28
32
|
comments:
|
29
|
-
reviewed_by:
|
30
|
-
safe_revision:
|
33
|
+
reviewed_by: timgentry
|
34
|
+
safe_revision: 82687366222b885cbc41449f5bbd30fe9440cd4c
|
31
35
|
".mega-linter.yml":
|
32
36
|
comments:
|
33
|
-
reviewed_by:
|
34
|
-
safe_revision:
|
37
|
+
reviewed_by: timgentry
|
38
|
+
safe_revision: 82687366222b885cbc41449f5bbd30fe9440cd4c
|
35
39
|
".rubocop":
|
36
40
|
comments:
|
37
41
|
reviewed_by: shilpigoeldev
|
@@ -39,23 +43,23 @@ file safety:
|
|
39
43
|
CHANGELOG.md:
|
40
44
|
comments:
|
41
45
|
reviewed_by: shilpigoeldev
|
42
|
-
safe_revision:
|
46
|
+
safe_revision: a7cb816f5ea6c60b8050a8f15eb906dff0e7be72
|
43
47
|
Gemfile:
|
44
48
|
comments:
|
45
|
-
reviewed_by:
|
46
|
-
safe_revision:
|
49
|
+
reviewed_by: timgentry
|
50
|
+
safe_revision: 82687366222b885cbc41449f5bbd30fe9440cd4c
|
47
51
|
Gemfile.lock:
|
48
52
|
comments:
|
49
53
|
reviewed_by: shilpigoeldev
|
50
|
-
safe_revision:
|
54
|
+
safe_revision: a7cb816f5ea6c60b8050a8f15eb906dff0e7be72
|
51
55
|
LICENSE.txt:
|
52
56
|
comments:
|
53
57
|
reviewed_by: shilpigoeldev
|
54
58
|
safe_revision: b89ef4afd67d02b6f6ff323bb9accde2dcf2686d
|
55
59
|
README.md:
|
56
60
|
comments:
|
57
|
-
reviewed_by:
|
58
|
-
safe_revision:
|
61
|
+
reviewed_by: timgentry
|
62
|
+
safe_revision: 2af6973c231a711ae512dc2d3bd3280b11382d6c
|
59
63
|
Rakefile:
|
60
64
|
comments:
|
61
65
|
reviewed_by: shilpigoeldev
|
@@ -70,20 +74,24 @@ file safety:
|
|
70
74
|
safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
|
71
75
|
docs/way_of_working/code-linting/index.md:
|
72
76
|
comments:
|
73
|
-
reviewed_by:
|
74
|
-
safe_revision:
|
77
|
+
reviewed_by: timgentry
|
78
|
+
safe_revision: 82687366222b885cbc41449f5bbd30fe9440cd4c
|
75
79
|
docs/way_of_working/code-linting/linters.md:
|
76
80
|
comments:
|
77
|
-
reviewed_by:
|
78
|
-
safe_revision:
|
81
|
+
reviewed_by: timgentry
|
82
|
+
safe_revision: 82687366222b885cbc41449f5bbd30fe9440cd4c
|
79
83
|
lib/way_of_working/code_linting/hdi.rb:
|
84
|
+
comments:
|
85
|
+
reviewed_by: timgentry
|
86
|
+
safe_revision: 82687366222b885cbc41449f5bbd30fe9440cd4c
|
87
|
+
lib/way_of_working/code_linting/hdi/generators/concerns/github_metadata.rb:
|
80
88
|
comments:
|
81
89
|
reviewed_by: shilpigoeldev
|
82
|
-
safe_revision:
|
90
|
+
safe_revision: 82687366222b885cbc41449f5bbd30fe9440cd4c
|
83
91
|
lib/way_of_working/code_linting/hdi/generators/document_linters.rb:
|
84
92
|
comments:
|
85
|
-
reviewed_by:
|
86
|
-
safe_revision:
|
93
|
+
reviewed_by: timgentry
|
94
|
+
safe_revision: 82687366222b885cbc41449f5bbd30fe9440cd4c
|
87
95
|
lib/way_of_working/code_linting/hdi/generators/exec.rb:
|
88
96
|
comments:
|
89
97
|
reviewed_by: shilpigoeldev
|
@@ -95,7 +103,7 @@ file safety:
|
|
95
103
|
lib/way_of_working/code_linting/hdi/generators/init_linters.rb:
|
96
104
|
comments:
|
97
105
|
reviewed_by: shilpigoeldev
|
98
|
-
safe_revision:
|
106
|
+
safe_revision: 8452b01ebb948e84ea0c8389da0187571ca48dbb
|
99
107
|
lib/way_of_working/code_linting/hdi/github_audit_rule.rb:
|
100
108
|
comments:
|
101
109
|
reviewed_by: shilpigoeldev
|
@@ -112,30 +120,34 @@ file safety:
|
|
112
120
|
comments:
|
113
121
|
reviewed_by: shilpigoeldev
|
114
122
|
safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
|
123
|
+
lib/way_of_working/code_linting/hdi/templates/.eslintrc.js:
|
124
|
+
comments:
|
125
|
+
reviewed_by: timgentry
|
126
|
+
safe_revision: 8452b01ebb948e84ea0c8389da0187571ca48dbb
|
115
127
|
lib/way_of_working/code_linting/hdi/templates/.github/linters/.markdown-link-check.json:
|
116
128
|
comments:
|
117
|
-
reviewed_by:
|
118
|
-
safe_revision:
|
129
|
+
reviewed_by: timgentry
|
130
|
+
safe_revision: 2af6973c231a711ae512dc2d3bd3280b11382d6c
|
119
131
|
lib/way_of_working/code_linting/hdi/templates/.github/linters/rubocop_defaults.yml:
|
120
132
|
comments:
|
121
133
|
reviewed_by: shilpigoeldev
|
122
134
|
safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
|
123
135
|
lib/way_of_working/code_linting/hdi/templates/.github/workflows/mega-linter.yml:
|
124
136
|
comments:
|
125
|
-
reviewed_by:
|
126
|
-
safe_revision:
|
137
|
+
reviewed_by: timgentry
|
138
|
+
safe_revision: 82687366222b885cbc41449f5bbd30fe9440cd4c
|
127
139
|
lib/way_of_working/code_linting/hdi/templates/.mega-linter.yml:
|
128
140
|
comments:
|
129
|
-
reviewed_by:
|
130
|
-
safe_revision:
|
141
|
+
reviewed_by: timgentry
|
142
|
+
safe_revision: 82687366222b885cbc41449f5bbd30fe9440cd4c
|
131
143
|
lib/way_of_working/code_linting/hdi/templates/.rubocop:
|
132
144
|
comments:
|
133
145
|
reviewed_by: shilpigoeldev
|
134
146
|
safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
|
135
|
-
lib/way_of_working/code_linting/hdi/templates/docs/way_of_working/code-linting/index.md:
|
147
|
+
lib/way_of_working/code_linting/hdi/templates/docs/way_of_working/code-linting/index.md.tt:
|
136
148
|
comments:
|
137
|
-
reviewed_by:
|
138
|
-
safe_revision:
|
149
|
+
reviewed_by: timgentry
|
150
|
+
safe_revision: 82687366222b885cbc41449f5bbd30fe9440cd4c
|
139
151
|
lib/way_of_working/code_linting/hdi/templates/docs/way_of_working/code-linting/linters.md.tt:
|
140
152
|
comments:
|
141
153
|
reviewed_by: shilpigoeldev
|
@@ -143,7 +155,7 @@ file safety:
|
|
143
155
|
lib/way_of_working/code_linting/hdi/version.rb:
|
144
156
|
comments:
|
145
157
|
reviewed_by: shilpigoeldev
|
146
|
-
safe_revision:
|
158
|
+
safe_revision: a7cb816f5ea6c60b8050a8f15eb906dff0e7be72
|
147
159
|
test/resources/XcodeApp.xcodeproj/project.pbxproj:
|
148
160
|
comments:
|
149
161
|
reviewed_by: shilpigoeldev
|
@@ -154,16 +166,16 @@ file safety:
|
|
154
166
|
safe_revision: b89ef4afd67d02b6f6ff323bb9accde2dcf2686d
|
155
167
|
test/way_of_working/audit_github_stub_classes.rb:
|
156
168
|
comments:
|
157
|
-
reviewed_by:
|
158
|
-
safe_revision:
|
169
|
+
reviewed_by: timgentry
|
170
|
+
safe_revision: 82687366222b885cbc41449f5bbd30fe9440cd4c
|
159
171
|
test/way_of_working/code_linting/hdi/generators/document_linters_test.rb:
|
160
172
|
comments:
|
161
173
|
reviewed_by: shilpigoeldev
|
162
174
|
safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
|
163
175
|
test/way_of_working/code_linting/hdi/generators/exec_test.rb:
|
164
176
|
comments:
|
165
|
-
reviewed_by:
|
166
|
-
safe_revision:
|
177
|
+
reviewed_by: timgentry
|
178
|
+
safe_revision: 2af6973c231a711ae512dc2d3bd3280b11382d6c
|
167
179
|
test/way_of_working/code_linting/hdi/generators/init_linters_test.rb:
|
168
180
|
comments:
|
169
181
|
reviewed_by: shilpigoeldev
|
@@ -182,5 +194,5 @@ file safety:
|
|
182
194
|
safe_revision: b89ef4afd67d02b6f6ff323bb9accde2dcf2686d
|
183
195
|
way_of_working-code_linting-hdi.gemspec:
|
184
196
|
comments:
|
185
|
-
reviewed_by:
|
186
|
-
safe_revision:
|
197
|
+
reviewed_by: timgentry
|
198
|
+
safe_revision: 82687366222b885cbc41449f5bbd30fe9440cd4c
|
@@ -5,35 +5,68 @@ layout: page
|
|
5
5
|
|
6
6
|
# Code Linting
|
7
7
|
|
8
|
-
|
8
|
+
## Overview
|
9
9
|
|
10
|
-
|
10
|
+
We use [MegaLinter](https://megalinter.io/) for most of our linting, but we use [RuboCop](https://rubocop.org) separately for Ruby to support Minitest and Rails cops.
|
11
11
|
|
12
|
-
|
13
|
-
|
12
|
+
Linters help by:
|
13
|
+
- Catching syntax errors, undefined variables, and unused code early
|
14
|
+
- Ensuring consistent code style across teams and projects
|
15
|
+
- Providing automated quality improvements and best practices
|
16
|
+
- Saving time in code review and debugging
|
14
17
|
|
15
|
-
|
18
|
+
## Setup
|
16
19
|
|
17
|
-
|
18
|
-
We have chosen not to use the version of [RuboCop](https://rubocop.org) packaged in MegaLinter because it can't support our use of Minitest and Rails "cops". But by using our CLI command to run linting, as documented below, both RuboCop and MegaLinter will be executed against your code.
|
20
|
+
Add linting to your project:
|
19
21
|
|
20
|
-
|
22
|
+
```bash
|
23
|
+
way_of_working init code_linting
|
24
|
+
```
|
21
25
|
|
22
|
-
|
26
|
+
This copies organisational coding standards and GitHub Actions workflows to your project.
|
23
27
|
|
24
|
-
{: .
|
25
|
-
|
28
|
+
{: .note }
|
29
|
+
For Xcode projects, a SwiftLint build phase is automatically added to the project config.
|
26
30
|
|
27
31
|
## Usage
|
28
32
|
|
29
|
-
|
33
|
+
Run linting locally:
|
34
|
+
|
35
|
+
```bash
|
36
|
+
way_of_working exec code_linting
|
37
|
+
```
|
38
|
+
|
39
|
+
executes both MegaLinter and RuboCop against your code.
|
40
|
+
|
41
|
+
## Configuration
|
42
|
+
|
43
|
+
Language-specific configs are in the project root or `.github/linters/`. See [linters.md](linters.md) for the complete list.
|
30
44
|
|
31
|
-
|
45
|
+
To customise for your project, talk to a member of [code-standards-team](https://github.com/orgs/HealthDataInsight/teams/code-standards-team) and modify the config files as needed, keeping changes minimal and well documented.
|
46
|
+
Pull Request changing linting configs require review by a member of code-standards-team.
|
32
47
|
|
33
|
-
|
48
|
+
## Handling Exceptions
|
34
49
|
|
35
|
-
|
50
|
+
On the rare occasions when linters flag false positives, turn off rules with comments giving your justification:
|
51
|
+
|
52
|
+
```python
|
53
|
+
# pylint: disable=line-too-long - URL cannot be broken
|
54
|
+
LONG_URL = "https://example.com/very/long/path/..."
|
55
|
+
```
|
56
|
+
|
57
|
+
## Documentation
|
58
|
+
|
59
|
+
Generate project documentation:
|
60
|
+
|
61
|
+
```bash
|
62
|
+
way_of_working exec document
|
63
|
+
```
|
64
|
+
|
65
|
+
{: .important }
|
66
|
+
If you disagree with any linter or coding style, please fork the Way of Working code linting [repository](https://github.com/HealthDataInsight/way_of_working-code_linting-hdi) and create a pull request with your proposed changes. The current standards are a starting point intended to evolve with team consensus.
|
36
67
|
|
37
|
-
|
68
|
+
## Resources
|
38
69
|
|
39
|
-
|
70
|
+
- [MegaLinter documentation](https://megalinter.io/)
|
71
|
+
- [RuboCop documentation](https://rubocop.org)
|
72
|
+
- [Active linters list](linters.md)
|