way_of_working-code_linting-hdi 1.0.0 → 1.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 63283e1c6860b1a7b4d02fce81b3ed85baaaca417ab068f2e52a92431e228729
4
- data.tar.gz: 41c58a76977acbf970fccd0e812c3edda789e3987d72b0e4e74903aa8f98a8ad
3
+ metadata.gz: b0b5505c490be707c1d82d6aa49db94edfee7b45d6ff9c0e1ddd1342d00ea1e4
4
+ data.tar.gz: 3fb85226ed2f3e3ea8d2131634093a0bd36b705e7a6c5a394937e77a413a82cc
5
5
  SHA512:
6
- metadata.gz: f004091c09472b59b64833cffb2398c5f9c6f560043442a5bfeb85e05fa7043f1f478d8ac2dcb19235cf47211e05b40c8b952e031dcf7b7c726651ae238949fd
7
- data.tar.gz: 6a15f2783ac0080362bdf2026d13968115ef39b58a6f88f13785c3be556c0d49876557d27041dbfe297194d9d064d786e4cb8a4f7df8b8360311f63412c7a4a3
6
+ metadata.gz: b1be504c13400869436332a6ef4a7f4e98ee64c8df5b3eed005beb9fa68caf34fe7bcb533491ce308c7ee65c55a0c94fa6d65273591ba093e064bc7d55162434
7
+ data.tar.gz: 502f0e10e48072c2df0b5c075a4e4dd1bff46c96a5f6d12bce8aec44da4c28362602a3faa73035c94a31951a03c602e3d3b601abae48d8970c0cb2198b21e2ed
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,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
8
 
8
9
  ## [Unreleased]
9
10
 
11
+ ## [1.1.1] - 2025-11-28
12
+
13
+ ### Changed
14
+
15
+ - Updated GitHub rule signatures
16
+ - Removed Zeitwerk ignore to make it happier
17
+
18
+ ## [1.1.0] - 2025-10-15
19
+
20
+ ### Added
21
+
22
+ - Switched from Standard to ESLint (with Standard rules) to enable us to add Cypress and Jasmine globals
23
+ - Added CODEOWNERS protection of the linting standards files
24
+
25
+ ### Changed
26
+
27
+ - Switched to MegaLinter v9
28
+ - Updated the linting GitHub workflow in line with upstream changes
29
+ - Rewritten the documentation to be easier to read for both humans and LLMs.
30
+
10
31
  ## [1.0.0] - 2025-01-27
11
32
 
12
33
  ### Added
@@ -16,5 +37,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
16
37
  - Added MegaLinter for linting common file formats with generator command and rake task
17
38
  - Added a GitHub audit rule to check that linting is used and configured correctly
18
39
 
19
- [unreleased]: https://github.com/HealthDataInsight/way_of_working-code_linting-hdi/compare/v1.0.0...HEAD
40
+ [unreleased]: https://github.com/HealthDataInsight/way_of_working-code_linting-hdi/compare/v1.1.1...HEAD
41
+ [1.1.1]: https://github.com/HealthDataInsight/way_of_working-code_linting-hdi/compare/v1.0.0...v1.1.1
42
+ [1.1.0]: https://github.com/HealthDataInsight/way_of_working-code_linting-hdi/compare/v1.0.0...v1.1.0
20
43
  [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 UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
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 UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
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: shilpigoeldev
10
- safe_revision: b89ef4afd67d02b6f6ff323bb9accde2dcf2686d
13
+ reviewed_by: timgentry
14
+ safe_revision: 9c246b038991ac78d79effd5f960e90a6a3e4547
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: shilpigoeldev
18
- safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
21
+ reviewed_by: timgentry
22
+ safe_revision: 9c246b038991ac78d79effd5f960e90a6a3e4547
19
23
  ".github/workflows/main.yml":
20
24
  comments:
21
- reviewed_by: shilpigoeldev
22
- safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
25
+ reviewed_by: timgentry
26
+ safe_revision: 9c246b038991ac78d79effd5f960e90a6a3e4547
23
27
  ".github/workflows/mega-linter.yml":
24
28
  comments:
25
- reviewed_by: shilpigoeldev
26
- safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
29
+ reviewed_by: timgentry
30
+ safe_revision: 9c246b038991ac78d79effd5f960e90a6a3e4547
27
31
  ".gitignore":
28
32
  comments:
29
- reviewed_by: shilpigoeldev
30
- safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
33
+ reviewed_by: timgentry
34
+ safe_revision: 82687366222b885cbc41449f5bbd30fe9440cd4c
31
35
  ".mega-linter.yml":
32
36
  comments:
33
- reviewed_by: shilpigoeldev
34
- safe_revision: b89ef4afd67d02b6f6ff323bb9accde2dcf2686d
37
+ reviewed_by: timgentry
38
+ safe_revision: 9c246b038991ac78d79effd5f960e90a6a3e4547
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: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
46
+ safe_revision: 021a64c32f5dc6541497d661b683a36bc793c091
43
47
  Gemfile:
44
48
  comments:
45
- reviewed_by: shilpigoeldev
46
- safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
49
+ reviewed_by: timgentry
50
+ safe_revision: 82687366222b885cbc41449f5bbd30fe9440cd4c
47
51
  Gemfile.lock:
48
52
  comments:
49
53
  reviewed_by: shilpigoeldev
50
- safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
54
+ safe_revision: 021a64c32f5dc6541497d661b683a36bc793c091
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: shilpigoeldev
58
- safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
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: shilpigoeldev
74
- safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
77
+ reviewed_by: timgentry
78
+ safe_revision: 9c246b038991ac78d79effd5f960e90a6a3e4547
75
79
  docs/way_of_working/code-linting/linters.md:
76
80
  comments:
77
- reviewed_by: shilpigoeldev
78
- safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
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: 9c246b038991ac78d79effd5f960e90a6a3e4547
87
+ lib/way_of_working/code_linting/hdi/generators/concerns/github_metadata.rb:
80
88
  comments:
81
89
  reviewed_by: shilpigoeldev
82
- safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
90
+ safe_revision: 82687366222b885cbc41449f5bbd30fe9440cd4c
83
91
  lib/way_of_working/code_linting/hdi/generators/document_linters.rb:
84
92
  comments:
85
- reviewed_by: shilpigoeldev
86
- safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
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: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
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
@@ -106,36 +114,40 @@ file safety:
106
114
  safe_revision: b89ef4afd67d02b6f6ff323bb9accde2dcf2686d
107
115
  lib/way_of_working/code_linting/hdi/plugin.rb:
108
116
  comments:
109
- reviewed_by: shilpigoeldev
110
- safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
117
+ reviewed_by: timgentry
118
+ safe_revision: 9c246b038991ac78d79effd5f960e90a6a3e4547
111
119
  lib/way_of_working/code_linting/hdi/supported_linter.rb:
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: shilpigoeldev
118
- safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
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: shilpigoeldev
126
- safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
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: shilpigoeldev
130
- safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
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: shilpigoeldev
138
- safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
149
+ reviewed_by: timgentry
150
+ safe_revision: 9c246b038991ac78d79effd5f960e90a6a3e4547
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: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
158
+ safe_revision: 021a64c32f5dc6541497d661b683a36bc793c091
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: shilpigoeldev
158
- safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
169
+ reviewed_by: timgentry
170
+ safe_revision: 9c246b038991ac78d79effd5f960e90a6a3e4547
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: shilpigoeldev
166
- safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
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: shilpigoeldev
186
- safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
197
+ reviewed_by: timgentry
198
+ safe_revision: 82687366222b885cbc41449f5bbd30fe9440cd4c
@@ -1,39 +1,74 @@
1
1
  ---
2
2
  has_children: true
3
3
  layout: page
4
+ status: REQUIRED
5
+ enforcement: manual
4
6
  ---
5
7
 
6
8
  # Code Linting
7
9
 
8
- We use [MegaLinter](https://megalinter.io/) for the majority of our code lining, currently with separate Ruby testing with RuboCop.
10
+ ## Overview
9
11
 
10
- Code linters like MegaLinter benefit developers and teams because they help improve code quality, reduce errors and inconsistencies, and streamline development. Linters analyze source code for common issues, such as syntax errors, undefined variables, and unused code, and provide suggestions and feedback for improvement.
12
+ 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
13
 
12
- Using a linter like MegaLinter, developers can catch and fix errors early in the development process, saving time and effort in the long run.
13
- The linter also provides consistency in the codebase, helping to prevent errors caused by different team members using different styles or approaches, which can be especially valuable for large projects with many contributors or where you want staff to be able to switch between projects more efficiently.
14
+ Linters help by:
15
+ - Catching syntax errors, undefined variables, and unused code early
16
+ - Ensuring consistent code style across teams and projects
17
+ - Providing automated quality improvements and best practices
18
+ - Saving time in code review and debugging
14
19
 
15
- MegaLinter is a particularly powerful linter because it supports multiple programming languages, making it a one-stop shop for developers working on projects with various languages.
20
+ ## Setup
16
21
 
17
- {: .note }
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.
22
+ Add linting to your project:
19
23
 
20
- When you add the Way of Working linter to your project, it will copy our per-language organisational code styles (where they differ from defaults) into `.github/linters` and will copy the GitHub Actions workflow files into `.github/workflow`, so that linting automatically runs when you commit to GitHub.
24
+ ```bash
25
+ way_of_working init code_linting
26
+ ```
21
27
 
22
- If you add the Way of Working linter to your Xcode project, it will automatically add a Swiftlint build phase to the project config file.
28
+ This copies organisational coding standards and GitHub Actions workflows to your project.
23
29
 
24
- {: .important }
25
- If you disagree with any of the linters or linting styles that they apply, please fork the repository and create a pull request with your desired changes. The current coding standards are only intended as a starting point. A Full list of the linters we are currently using can be found [here](linters.md).
30
+ {: .note }
31
+ For Xcode projects, a SwiftLint build phase is automatically added to the project config.
26
32
 
27
33
  ## Usage
28
34
 
29
- To add [MegaLinter](https://megalinter.io/) and [RuboCop](https://rubocop.org) to your project, run the following at the command line:
35
+ Run linting locally:
36
+
37
+ ```bash
38
+ way_of_working exec code_linting
39
+ ```
40
+
41
+ executes both MegaLinter and RuboCop against your code.
42
+
43
+ ## Configuration
44
+
45
+ Language-specific configs are in the project root or `.github/linters/`. See [linters.md](linters.md) for the complete list.
30
46
 
31
- way_of_working init code_linting
47
+ 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.
48
+ Pull Request changing linting configs require review by a member of code-standards-team.
32
49
 
33
- to run MegaLinter in your project, run:
50
+ ## Handling Exceptions
34
51
 
35
- way_of_working exec code_linting
52
+ On the rare occasions when linters flag false positives, turn off rules with comments giving your justification:
53
+
54
+ ```python
55
+ # pylint: disable=line-too-long - URL cannot be broken
56
+ LONG_URL = "https://example.com/very/long/path/..."
57
+ ```
58
+
59
+ ## Documentation
60
+
61
+ Generate project documentation:
62
+
63
+ ```bash
64
+ way_of_working exec document
65
+ ```
66
+
67
+ {: .important }
68
+ 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
69
 
37
- to document your use of MegaLinter in your project, run:
70
+ ## Resources
38
71
 
39
- way_of_working exec document
72
+ - [MegaLinter documentation](https://megalinter.io/)
73
+ - [RuboCop documentation](https://rubocop.org)
74
+ - [Active linters list](linters.md)