way_of_working-code_linting-hdi 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.alexrc +3 -0
- data/.mega-linter.yml +145 -0
- data/.rubocop +1 -0
- data/CHANGELOG.md +20 -0
- data/LICENSE.txt +21 -0
- data/README.md +58 -0
- data/Rakefile +16 -0
- data/code_safety.yml +186 -0
- data/docs/way_of_working/code-linting/index.md +39 -0
- data/docs/way_of_working/code-linting/linters.md +153 -0
- data/lib/way_of_working/code_linting/hdi/generators/document_linters.rb +81 -0
- data/lib/way_of_working/code_linting/hdi/generators/exec.rb +79 -0
- data/lib/way_of_working/code_linting/hdi/generators/init.rb +23 -0
- data/lib/way_of_working/code_linting/hdi/generators/init_linters.rb +103 -0
- data/lib/way_of_working/code_linting/hdi/github_audit_rule.rb +60 -0
- data/lib/way_of_working/code_linting/hdi/paths.rb +20 -0
- data/lib/way_of_working/code_linting/hdi/plugin.rb +1 -0
- data/lib/way_of_working/code_linting/hdi/supported_linter.rb +91 -0
- data/lib/way_of_working/code_linting/hdi/templates/.github/linters/.markdown-link-check.json +13 -0
- data/lib/way_of_working/code_linting/hdi/templates/.github/linters/rubocop_defaults.yml +55 -0
- data/lib/way_of_working/code_linting/hdi/templates/.github/workflows/mega-linter.yml +88 -0
- data/lib/way_of_working/code_linting/hdi/templates/.mega-linter.yml +145 -0
- data/lib/way_of_working/code_linting/hdi/templates/.rubocop +1 -0
- data/lib/way_of_working/code_linting/hdi/templates/docs/way_of_working/code-linting/index.md +39 -0
- data/lib/way_of_working/code_linting/hdi/templates/docs/way_of_working/code-linting/linters.md.tt +24 -0
- data/lib/way_of_working/code_linting/hdi/version.rb +9 -0
- data/lib/way_of_working/code_linting/hdi.rb +54 -0
- metadata +103 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 63283e1c6860b1a7b4d02fce81b3ed85baaaca417ab068f2e52a92431e228729
|
4
|
+
data.tar.gz: 41c58a76977acbf970fccd0e812c3edda789e3987d72b0e4e74903aa8f98a8ad
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f004091c09472b59b64833cffb2398c5f9c6f560043442a5bfeb85e05fa7043f1f478d8ac2dcb19235cf47211e05b40c8b952e031dcf7b7c726651ae238949fd
|
7
|
+
data.tar.gz: 6a15f2783ac0080362bdf2026d13968115ef39b58a6f88f13785c3be556c0d49876557d27041dbfe297194d9d064d786e4cb8a4f7df8b8360311f63412c7a4a3
|
data/.alexrc
ADDED
data/.mega-linter.yml
ADDED
@@ -0,0 +1,145 @@
|
|
1
|
+
---
|
2
|
+
# Configuration file for MegaLinter
|
3
|
+
# See all available variables at https://megalinter.io/configuration/
|
4
|
+
# and in linters documentation
|
5
|
+
|
6
|
+
APPLY_FIXES: none # all, none, or list of linter keys
|
7
|
+
ENABLE_LINTERS: # All other linters will be disabled by default
|
8
|
+
### Languages
|
9
|
+
- BASH_EXEC # in Super-Linter
|
10
|
+
- BASH_SHELLCHECK # in Super-Linter
|
11
|
+
- BASH_SHFMT # in Super-Linter
|
12
|
+
- C_CLANG_FORMAT
|
13
|
+
- C_CPPLINT
|
14
|
+
# - CLOJURE_CLJ_KONDO # in Super-Linter
|
15
|
+
# - CLOJURE_CLJSTYLE
|
16
|
+
- COFFEE_COFFEELINT # in Super-Linter
|
17
|
+
- CPP_CLANG_FORMAT
|
18
|
+
- CPP_CPPLINT # in Super-Linter
|
19
|
+
- CSHARP_CSHARPIER
|
20
|
+
- CSHARP_DOTNET_FORMAT # in Super-Linter
|
21
|
+
- CSHARP_ROSLYNATOR
|
22
|
+
- DART_DARTANALYZER # in Super-Linter
|
23
|
+
- GO_GOLANGCI_LINT # in Super-Linter
|
24
|
+
- GO_REVIVE
|
25
|
+
# - GROOVY_NPM_GROOVY_LINT # in Super-Linter
|
26
|
+
- JAVA_CHECKSTYLE # in Super-Linter
|
27
|
+
- JAVA_PMD
|
28
|
+
- JAVASCRIPT_ES # in Super-Linter
|
29
|
+
# - JAVASCRIPT_PRETTIER
|
30
|
+
- JAVASCRIPT_STANDARD # in Super-Linter
|
31
|
+
- JSX_ESLINT
|
32
|
+
- KOTLIN_DETEKT
|
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
|
80
|
+
- JSON_JSONLINT
|
81
|
+
- JSON_NPM_PACKAGE_JSON_LINT
|
82
|
+
# - JSON_PRETTIER
|
83
|
+
- JSON_V8R
|
84
|
+
# - LATEX_CHKTEX # in Super-Linter
|
85
|
+
- MARKDOWN_MARKDOWNLINT # in Super-Linter
|
86
|
+
- MARKDOWN_MARKDOWN_LINK_CHECK
|
87
|
+
- MARKDOWN_MARKDOWN_TABLE_FORMATTER
|
88
|
+
- MARKDOWN_REMARK_LINT
|
89
|
+
# - PROTOBUF_PROTOLINT # in Super-Linter
|
90
|
+
# - RST_RSTCHECK
|
91
|
+
# - RST_RSTFMT
|
92
|
+
# - RST_RST_LINT
|
93
|
+
- XML_XMLLINT # in Super-Linter
|
94
|
+
# - YAML_PRETTIER
|
95
|
+
- YAML_V8R
|
96
|
+
- YAML_YAMLLINT # in Super-Linter
|
97
|
+
|
98
|
+
### Tooling
|
99
|
+
- ACTION_ACTIONLINT # in Super-Linter
|
100
|
+
- ANSIBLE_ANSIBLE_LINT # in Super-Linter
|
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
|
122
|
+
- REPOSITORY_CHECKOV
|
123
|
+
- REPOSITORY_DEVSKIM
|
124
|
+
- REPOSITORY_DUSTILOCK
|
125
|
+
- REPOSITORY_GIT_DIFF
|
126
|
+
- REPOSITORY_GITLEAKS # in Super-Linter
|
127
|
+
- REPOSITORY_GRYPE
|
128
|
+
- REPOSITORY_KICS
|
129
|
+
- REPOSITORY_LS_LINT
|
130
|
+
- REPOSITORY_SECRETLINT
|
131
|
+
- REPOSITORY_SEMGREP
|
132
|
+
- REPOSITORY_SYFT
|
133
|
+
- REPOSITORY_TRIVY
|
134
|
+
- REPOSITORY_TRIVY_SBOM
|
135
|
+
- REPOSITORY_TRUFFLEHOG
|
136
|
+
# - SPELL_CSPELL
|
137
|
+
- SPELL_LYCHEE
|
138
|
+
- SPELL_PROSELINT
|
139
|
+
- SPELL_VALE
|
140
|
+
|
141
|
+
SHOW_ELAPSED_TIME: false
|
142
|
+
FILEIO_REPORTER: false
|
143
|
+
FAIL_IF_MISSING_LINTER_IN_FLAVOR: true
|
144
|
+
# DISABLE_ERRORS: true # Uncomment if you want MegaLinter to detect
|
145
|
+
# errors but not block CI to pass
|
data/.rubocop
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--config .github/linters/rubocop_defaults.yml
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
|
+
|
8
|
+
## [Unreleased]
|
9
|
+
|
10
|
+
## [1.0.0] - 2025-01-27
|
11
|
+
|
12
|
+
### Added
|
13
|
+
|
14
|
+
- Added a document command to update the list of used and available linters
|
15
|
+
- Added Swiftlint build phase to Xcode projects
|
16
|
+
- Added MegaLinter for linting common file formats with generator command and rake task
|
17
|
+
- Added a GitHub audit rule to check that linting is used and configured correctly
|
18
|
+
|
19
|
+
[unreleased]: https://github.com/HealthDataInsight/way_of_working-code_linting-hdi/compare/v1.0.0...HEAD
|
20
|
+
[1.0.0]: https://github.com/HealthDataInsight/way_of_working-code_linting-hdi/releases/tag/v1.0.0
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2024 Health Data Insight CIC
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
# WayOfWorking::CodeLinting::Hdi
|
2
|
+
|
3
|
+
<!-- Way of Working: Main Badge Holder Start -->
|
4
|
+
![Way of Working Badge](https://img.shields.io/badge/Way_of_Working-v2.0.1-%238169e3?labelColor=black)
|
5
|
+
<!-- Way of Working: Additional Badge Holder Start -->
|
6
|
+
<!-- Way of Working: Badge Holder End -->
|
7
|
+
|
8
|
+
We use [MegaLinter](https://megalinter.io/) for the majority of our code lining, currently with separate Ruby testing with RuboCop.
|
9
|
+
|
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.
|
11
|
+
|
12
|
+
## Installation
|
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
|
+
Install the gem and add to the application's Gemfile by executing:
|
17
|
+
|
18
|
+
```bash
|
19
|
+
bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
|
20
|
+
```
|
21
|
+
|
22
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
23
|
+
|
24
|
+
```bash
|
25
|
+
gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
|
26
|
+
```
|
27
|
+
|
28
|
+
## Usage
|
29
|
+
|
30
|
+
To add [MegaLinter](https://megalinter.io/) to your project, run the following at the command line:
|
31
|
+
|
32
|
+
```bash
|
33
|
+
way_of_working init code_linting
|
34
|
+
```
|
35
|
+
|
36
|
+
to run MegaLinter in your project, run:
|
37
|
+
|
38
|
+
```bash
|
39
|
+
way_of_working exec code_linting
|
40
|
+
```
|
41
|
+
|
42
|
+
## Development
|
43
|
+
|
44
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
45
|
+
|
46
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
47
|
+
|
48
|
+
## Contributing
|
49
|
+
|
50
|
+
Bug reports and pull requests are welcome on GitHub at <https://github.com/HealthDataInsight/way_of_working-code_linting-hdi>. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/HealthDataInsight/way_of_working-code_linting-hdi/blob/main/CODE_OF_CONDUCT.md).
|
51
|
+
|
52
|
+
## License
|
53
|
+
|
54
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
55
|
+
|
56
|
+
## Code of Conduct
|
57
|
+
|
58
|
+
Everyone interacting in the way_of_working-code_linting-hdi project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/HealthDataInsight/way_of_working-code_linting-hdi/blob/main/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'bundler/gem_tasks'
|
4
|
+
require 'rake/testtask'
|
5
|
+
require 'way_of_working/tasks'
|
6
|
+
|
7
|
+
Rake::TestTask.new(:test) do |t|
|
8
|
+
t.libs << 'lib'
|
9
|
+
t.libs << 'test'
|
10
|
+
t.test_files = FileList['test/**/*_test.rb']
|
11
|
+
t.verbose = false
|
12
|
+
t.warning = false
|
13
|
+
end
|
14
|
+
|
15
|
+
desc 'Run tests'
|
16
|
+
task default: :test
|
data/code_safety.yml
ADDED
@@ -0,0 +1,186 @@
|
|
1
|
+
---
|
2
|
+
file safety:
|
3
|
+
".alexrc":
|
4
|
+
comments:
|
5
|
+
reviewed_by: shilpigoeldev
|
6
|
+
safe_revision: b89ef4afd67d02b6f6ff323bb9accde2dcf2686d
|
7
|
+
".github/linters/.markdown-link-check.json":
|
8
|
+
comments:
|
9
|
+
reviewed_by: shilpigoeldev
|
10
|
+
safe_revision: b89ef4afd67d02b6f6ff323bb9accde2dcf2686d
|
11
|
+
".github/linters/rubocop_defaults.yml":
|
12
|
+
comments:
|
13
|
+
reviewed_by: shilpigoeldev
|
14
|
+
safe_revision: b89ef4afd67d02b6f6ff323bb9accde2dcf2686d
|
15
|
+
".github/workflows/inclusive-language.yml":
|
16
|
+
comments:
|
17
|
+
reviewed_by: shilpigoeldev
|
18
|
+
safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
|
19
|
+
".github/workflows/main.yml":
|
20
|
+
comments:
|
21
|
+
reviewed_by: shilpigoeldev
|
22
|
+
safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
|
23
|
+
".github/workflows/mega-linter.yml":
|
24
|
+
comments:
|
25
|
+
reviewed_by: shilpigoeldev
|
26
|
+
safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
|
27
|
+
".gitignore":
|
28
|
+
comments:
|
29
|
+
reviewed_by: shilpigoeldev
|
30
|
+
safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
|
31
|
+
".mega-linter.yml":
|
32
|
+
comments:
|
33
|
+
reviewed_by: shilpigoeldev
|
34
|
+
safe_revision: b89ef4afd67d02b6f6ff323bb9accde2dcf2686d
|
35
|
+
".rubocop":
|
36
|
+
comments:
|
37
|
+
reviewed_by: shilpigoeldev
|
38
|
+
safe_revision: b89ef4afd67d02b6f6ff323bb9accde2dcf2686d
|
39
|
+
CHANGELOG.md:
|
40
|
+
comments:
|
41
|
+
reviewed_by: shilpigoeldev
|
42
|
+
safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
|
43
|
+
Gemfile:
|
44
|
+
comments:
|
45
|
+
reviewed_by: shilpigoeldev
|
46
|
+
safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
|
47
|
+
Gemfile.lock:
|
48
|
+
comments:
|
49
|
+
reviewed_by: shilpigoeldev
|
50
|
+
safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
|
51
|
+
LICENSE.txt:
|
52
|
+
comments:
|
53
|
+
reviewed_by: shilpigoeldev
|
54
|
+
safe_revision: b89ef4afd67d02b6f6ff323bb9accde2dcf2686d
|
55
|
+
README.md:
|
56
|
+
comments:
|
57
|
+
reviewed_by: shilpigoeldev
|
58
|
+
safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
|
59
|
+
Rakefile:
|
60
|
+
comments:
|
61
|
+
reviewed_by: shilpigoeldev
|
62
|
+
safe_revision: b89ef4afd67d02b6f6ff323bb9accde2dcf2686d
|
63
|
+
bin/console:
|
64
|
+
comments:
|
65
|
+
reviewed_by: shilpigoeldev
|
66
|
+
safe_revision: b89ef4afd67d02b6f6ff323bb9accde2dcf2686d
|
67
|
+
bin/setup:
|
68
|
+
comments:
|
69
|
+
reviewed_by: shilpigoeldev
|
70
|
+
safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
|
71
|
+
docs/way_of_working/code-linting/index.md:
|
72
|
+
comments:
|
73
|
+
reviewed_by: shilpigoeldev
|
74
|
+
safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
|
75
|
+
docs/way_of_working/code-linting/linters.md:
|
76
|
+
comments:
|
77
|
+
reviewed_by: shilpigoeldev
|
78
|
+
safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
|
79
|
+
lib/way_of_working/code_linting/hdi.rb:
|
80
|
+
comments:
|
81
|
+
reviewed_by: shilpigoeldev
|
82
|
+
safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
|
83
|
+
lib/way_of_working/code_linting/hdi/generators/document_linters.rb:
|
84
|
+
comments:
|
85
|
+
reviewed_by: shilpigoeldev
|
86
|
+
safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
|
87
|
+
lib/way_of_working/code_linting/hdi/generators/exec.rb:
|
88
|
+
comments:
|
89
|
+
reviewed_by: shilpigoeldev
|
90
|
+
safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
|
91
|
+
lib/way_of_working/code_linting/hdi/generators/init.rb:
|
92
|
+
comments:
|
93
|
+
reviewed_by: shilpigoeldev
|
94
|
+
safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
|
95
|
+
lib/way_of_working/code_linting/hdi/generators/init_linters.rb:
|
96
|
+
comments:
|
97
|
+
reviewed_by: shilpigoeldev
|
98
|
+
safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
|
99
|
+
lib/way_of_working/code_linting/hdi/github_audit_rule.rb:
|
100
|
+
comments:
|
101
|
+
reviewed_by: shilpigoeldev
|
102
|
+
safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
|
103
|
+
lib/way_of_working/code_linting/hdi/paths.rb:
|
104
|
+
comments:
|
105
|
+
reviewed_by: shilpigoeldev
|
106
|
+
safe_revision: b89ef4afd67d02b6f6ff323bb9accde2dcf2686d
|
107
|
+
lib/way_of_working/code_linting/hdi/plugin.rb:
|
108
|
+
comments:
|
109
|
+
reviewed_by: shilpigoeldev
|
110
|
+
safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
|
111
|
+
lib/way_of_working/code_linting/hdi/supported_linter.rb:
|
112
|
+
comments:
|
113
|
+
reviewed_by: shilpigoeldev
|
114
|
+
safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
|
115
|
+
lib/way_of_working/code_linting/hdi/templates/.github/linters/.markdown-link-check.json:
|
116
|
+
comments:
|
117
|
+
reviewed_by: shilpigoeldev
|
118
|
+
safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
|
119
|
+
lib/way_of_working/code_linting/hdi/templates/.github/linters/rubocop_defaults.yml:
|
120
|
+
comments:
|
121
|
+
reviewed_by: shilpigoeldev
|
122
|
+
safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
|
123
|
+
lib/way_of_working/code_linting/hdi/templates/.github/workflows/mega-linter.yml:
|
124
|
+
comments:
|
125
|
+
reviewed_by: shilpigoeldev
|
126
|
+
safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
|
127
|
+
lib/way_of_working/code_linting/hdi/templates/.mega-linter.yml:
|
128
|
+
comments:
|
129
|
+
reviewed_by: shilpigoeldev
|
130
|
+
safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
|
131
|
+
lib/way_of_working/code_linting/hdi/templates/.rubocop:
|
132
|
+
comments:
|
133
|
+
reviewed_by: shilpigoeldev
|
134
|
+
safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
|
135
|
+
lib/way_of_working/code_linting/hdi/templates/docs/way_of_working/code-linting/index.md:
|
136
|
+
comments:
|
137
|
+
reviewed_by: shilpigoeldev
|
138
|
+
safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
|
139
|
+
lib/way_of_working/code_linting/hdi/templates/docs/way_of_working/code-linting/linters.md.tt:
|
140
|
+
comments:
|
141
|
+
reviewed_by: shilpigoeldev
|
142
|
+
safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
|
143
|
+
lib/way_of_working/code_linting/hdi/version.rb:
|
144
|
+
comments:
|
145
|
+
reviewed_by: shilpigoeldev
|
146
|
+
safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
|
147
|
+
test/resources/XcodeApp.xcodeproj/project.pbxproj:
|
148
|
+
comments:
|
149
|
+
reviewed_by: shilpigoeldev
|
150
|
+
safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
|
151
|
+
test/test_helper.rb:
|
152
|
+
comments:
|
153
|
+
reviewed_by: shilpigoeldev
|
154
|
+
safe_revision: b89ef4afd67d02b6f6ff323bb9accde2dcf2686d
|
155
|
+
test/way_of_working/audit_github_stub_classes.rb:
|
156
|
+
comments:
|
157
|
+
reviewed_by: shilpigoeldev
|
158
|
+
safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
|
159
|
+
test/way_of_working/code_linting/hdi/generators/document_linters_test.rb:
|
160
|
+
comments:
|
161
|
+
reviewed_by: shilpigoeldev
|
162
|
+
safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
|
163
|
+
test/way_of_working/code_linting/hdi/generators/exec_test.rb:
|
164
|
+
comments:
|
165
|
+
reviewed_by: shilpigoeldev
|
166
|
+
safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
|
167
|
+
test/way_of_working/code_linting/hdi/generators/init_linters_test.rb:
|
168
|
+
comments:
|
169
|
+
reviewed_by: shilpigoeldev
|
170
|
+
safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
|
171
|
+
test/way_of_working/code_linting/hdi/github_audit_rule_test.rb:
|
172
|
+
comments:
|
173
|
+
reviewed_by: shilpigoeldev
|
174
|
+
safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
|
175
|
+
test/way_of_working/code_linting/hdi/zeitwerk_loader_test.rb:
|
176
|
+
comments:
|
177
|
+
reviewed_by: shilpigoeldev
|
178
|
+
safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
|
179
|
+
test/way_of_working/code_linting/hdi_test.rb:
|
180
|
+
comments:
|
181
|
+
reviewed_by: shilpigoeldev
|
182
|
+
safe_revision: b89ef4afd67d02b6f6ff323bb9accde2dcf2686d
|
183
|
+
way_of_working-code_linting-hdi.gemspec:
|
184
|
+
comments:
|
185
|
+
reviewed_by: shilpigoeldev
|
186
|
+
safe_revision: 0c7aeda9a9a90b16cea0f1921e29b21d4f27e5ac
|
@@ -0,0 +1,39 @@
|
|
1
|
+
---
|
2
|
+
has_children: true
|
3
|
+
layout: page
|
4
|
+
---
|
5
|
+
|
6
|
+
# Code Linting
|
7
|
+
|
8
|
+
We use [MegaLinter](https://megalinter.io/) for the majority of our code lining, currently with separate Ruby testing with RuboCop.
|
9
|
+
|
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.
|
11
|
+
|
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
|
+
|
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.
|
16
|
+
|
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.
|
19
|
+
|
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.
|
21
|
+
|
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.
|
23
|
+
|
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).
|
26
|
+
|
27
|
+
## Usage
|
28
|
+
|
29
|
+
To add [MegaLinter](https://megalinter.io/) and [RuboCop](https://rubocop.org) to your project, run the following at the command line:
|
30
|
+
|
31
|
+
way_of_working init code_linting
|
32
|
+
|
33
|
+
to run MegaLinter in your project, run:
|
34
|
+
|
35
|
+
way_of_working exec code_linting
|
36
|
+
|
37
|
+
to document your use of MegaLinter in your project, run:
|
38
|
+
|
39
|
+
way_of_working exec document
|