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
@@ -0,0 +1,55 @@
|
|
1
|
+
---
|
2
|
+
require:
|
3
|
+
- ndr_dev_support
|
4
|
+
|
5
|
+
inherit_mode:
|
6
|
+
merge:
|
7
|
+
- Exclude
|
8
|
+
|
9
|
+
AllCops:
|
10
|
+
TargetRubyVersion: 3.1
|
11
|
+
|
12
|
+
# Ignore rules related to templated files
|
13
|
+
Layout/EmptyLines:
|
14
|
+
Exclude:
|
15
|
+
- "config/**/*.rb"
|
16
|
+
|
17
|
+
Layout/SpaceInsideArrayLiteralBrackets:
|
18
|
+
Exclude:
|
19
|
+
- "config/**/*.rb"
|
20
|
+
|
21
|
+
Rails/Date:
|
22
|
+
Enabled: false
|
23
|
+
|
24
|
+
Rails/TimeZone:
|
25
|
+
Enabled: false
|
26
|
+
|
27
|
+
Style/Documentation:
|
28
|
+
Exclude:
|
29
|
+
- "app/helpers/application_helper.rb"
|
30
|
+
- "config/**/*.rb"
|
31
|
+
|
32
|
+
Style/GlobalStdStream:
|
33
|
+
Exclude:
|
34
|
+
- "config/environments/production.rb"
|
35
|
+
|
36
|
+
Style/OptionalBooleanParameter:
|
37
|
+
Enabled: false
|
38
|
+
|
39
|
+
Style/RedundantConstantBase:
|
40
|
+
Exclude:
|
41
|
+
- "config/environments/production.rb"
|
42
|
+
|
43
|
+
Style/RedundantFetchBlock:
|
44
|
+
Exclude:
|
45
|
+
- "config/puma.rb"
|
46
|
+
|
47
|
+
Style/StringLiterals:
|
48
|
+
Exclude:
|
49
|
+
- "config.ru"
|
50
|
+
- "config/**/*.rb"
|
51
|
+
- "Rakefile"
|
52
|
+
|
53
|
+
Style/SymbolArray:
|
54
|
+
Exclude:
|
55
|
+
- "config/initializers/filter_parameter_logging.rb"
|
@@ -0,0 +1,88 @@
|
|
1
|
+
---
|
2
|
+
# MegaLinter GitHub Action configuration file
|
3
|
+
# More info at https://megalinter.io
|
4
|
+
name: MegaLinter
|
5
|
+
|
6
|
+
on: # yamllint disable-line rule:truthy
|
7
|
+
# Trigger mega-linter at key points in the PR process
|
8
|
+
pull_request:
|
9
|
+
types:
|
10
|
+
- opened
|
11
|
+
- ready_for_review
|
12
|
+
- review_requested
|
13
|
+
|
14
|
+
permissions:
|
15
|
+
contents: read
|
16
|
+
issues: write
|
17
|
+
pull-requests: write
|
18
|
+
|
19
|
+
env: # Comment env block if you do not want to apply fixes
|
20
|
+
# Apply linter fixes configuration
|
21
|
+
APPLY_FIXES: none # When active, APPLY_FIXES must also be defined as environment variable (in github/workflows/mega-linter.yml or other CI tool)
|
22
|
+
APPLY_FIXES_EVENT: pull_request # Decide which event triggers application of fixes in a commit or a PR (pull_request, push, all)
|
23
|
+
APPLY_FIXES_MODE: commit # If APPLY_FIXES is used, defines if the fixes are directly committed (commit) or posted in a PR (pull_request)
|
24
|
+
|
25
|
+
concurrency:
|
26
|
+
group: ${{ github.ref }}-${{ github.workflow }}
|
27
|
+
cancel-in-progress: true
|
28
|
+
|
29
|
+
jobs:
|
30
|
+
build:
|
31
|
+
name: MegaLinter
|
32
|
+
runs-on: ubuntu-latest
|
33
|
+
steps:
|
34
|
+
# Git Checkout
|
35
|
+
- name: Checkout Code
|
36
|
+
uses: actions/checkout@v4
|
37
|
+
with:
|
38
|
+
token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
|
39
|
+
|
40
|
+
# MegaLinter
|
41
|
+
- name: MegaLinter
|
42
|
+
id: ml
|
43
|
+
# You can override MegaLinter flavor used to have faster performances
|
44
|
+
# More info at https://megalinter.io/flavors/
|
45
|
+
uses: oxsecurity/megalinter@v8
|
46
|
+
env:
|
47
|
+
# All available variables are described in documentation
|
48
|
+
# https://megalinter.io/configuration/
|
49
|
+
VALIDATE_ALL_CODEBASE: true # Set ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} to validate only diff with main branch
|
50
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
51
|
+
# ADD YOUR CUSTOM ENV VARIABLES HERE TO OVERRIDE VALUES OF .mega-linter.yml AT THE ROOT OF YOUR REPOSITORY
|
52
|
+
|
53
|
+
# # Upload MegaLinter artifacts
|
54
|
+
# - name: Archive production artifacts
|
55
|
+
# if: ${{ success() }} || ${{ failure() }}
|
56
|
+
# uses: actions/upload-artifact@v3
|
57
|
+
# with:
|
58
|
+
# name: MegaLinter reports
|
59
|
+
# path: |
|
60
|
+
# megalinter-reports
|
61
|
+
# mega-linter.log
|
62
|
+
|
63
|
+
# # Create pull request if applicable (for now works only on PR from same repository, not from forks)
|
64
|
+
# - name: Create Pull Request with applied fixes
|
65
|
+
# id: cpr
|
66
|
+
# if: steps.ml.outputs.has_updated_sources == 1 && (env.APPLY_FIXES_EVENT == 'all' || env.APPLY_FIXES_EVENT == github.event_name) && env.APPLY_FIXES_MODE == 'pull_request' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository) && !contains(github.event.head_commit.message, 'skip fix')
|
67
|
+
# uses: peter-evans/create-pull-request@v4
|
68
|
+
# with:
|
69
|
+
# token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
|
70
|
+
# commit-message: "[MegaLinter] Apply linters automatic fixes"
|
71
|
+
# title: "[MegaLinter] Apply linters automatic fixes"
|
72
|
+
# labels: bot
|
73
|
+
# - name: Create PR output
|
74
|
+
# if: steps.ml.outputs.has_updated_sources == 1 && (env.APPLY_FIXES_EVENT == 'all' || env.APPLY_FIXES_EVENT == github.event_name) && env.APPLY_FIXES_MODE == 'pull_request' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository) && !contains(github.event.head_commit.message, 'skip fix')
|
75
|
+
# run: |
|
76
|
+
# echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
|
77
|
+
# echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
|
78
|
+
|
79
|
+
# # Push new commit if applicable (for now works only on PR from same repository, not from forks)
|
80
|
+
# - name: Prepare commit
|
81
|
+
# if: steps.ml.outputs.has_updated_sources == 1 && (env.APPLY_FIXES_EVENT == 'all' || env.APPLY_FIXES_EVENT == github.event_name) && env.APPLY_FIXES_MODE == 'commit' && github.ref != 'refs/heads/main' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository) && !contains(github.event.head_commit.message, 'skip fix')
|
82
|
+
# run: sudo chown -Rc $UID .git/
|
83
|
+
# - name: Commit and push applied linter fixes
|
84
|
+
# if: steps.ml.outputs.has_updated_sources == 1 && (env.APPLY_FIXES_EVENT == 'all' || env.APPLY_FIXES_EVENT == github.event_name) && env.APPLY_FIXES_MODE == 'commit' && github.ref != 'refs/heads/main' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository) && !contains(github.event.head_commit.message, 'skip fix')
|
85
|
+
# uses: stefanzweifel/git-auto-commit-action@v4
|
86
|
+
# with:
|
87
|
+
# branch: ${{ github.event.pull_request.head.ref || github.head_ref || github.ref }}
|
88
|
+
# commit_message: "[MegaLinter] Apply linters fixes"
|
@@ -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
|
@@ -0,0 +1 @@
|
|
1
|
+
--config .github/linters/rubocop_defaults.yml
|
@@ -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
|
data/lib/way_of_working/code_linting/hdi/templates/docs/way_of_working/code-linting/linters.md.tt
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
---
|
2
|
+
layout: page
|
3
|
+
nav_order: 1
|
4
|
+
parent: Code Linting
|
5
|
+
---
|
6
|
+
|
7
|
+
# Linters
|
8
|
+
|
9
|
+
The following tables detail the linters that we are currently using:
|
10
|
+
<% @types.each do |type, linters| -%>
|
11
|
+
|
12
|
+
## <%= type %>
|
13
|
+
|
14
|
+
<%
|
15
|
+
max_language_length = linters.map(&:language).map(&:length).max
|
16
|
+
max_constant_name_length = linters.map(&:constant_name).map(&:length).max
|
17
|
+
max_details_length = linters.map(&:details).map(&:length).max
|
18
|
+
-%>
|
19
|
+
| <%= type.singularize.ljust(max_language_length) %> | <%= 'Linter'.ljust(max_constant_name_length) %> | <%= 'Details'.ljust(max_details_length) %> |
|
20
|
+
|<%= ':'.ljust(max_language_length + 2, '-') %>|<%= ':'.ljust(max_constant_name_length + 2, '-') %>|<%= ':'.ljust(max_details_length + 2, '-') %>|
|
21
|
+
<% linters.sort_by(&:sorter).each do |linter| -%>
|
22
|
+
| <%= linter.language.ljust(max_language_length) %> | <%= linter.constant_name.ljust(max_constant_name_length) %> | <%= linter.details.ljust(max_details_length) %> |
|
23
|
+
<% end -%>
|
24
|
+
<% end -%>
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'way_of_working'
|
4
|
+
require_relative 'hdi/paths'
|
5
|
+
require 'zeitwerk'
|
6
|
+
|
7
|
+
# If way_of_working-audit-github is used we can add a rule
|
8
|
+
begin
|
9
|
+
require 'way_of_working/audit/github/rules/registry'
|
10
|
+
require_relative 'hdi/github_audit_rule'
|
11
|
+
rescue LoadError # rubocop:disable Lint/SuppressedException
|
12
|
+
end
|
13
|
+
|
14
|
+
loader = Zeitwerk::Loader.for_gem_extension(WayOfWorking::CodeLinting)
|
15
|
+
loader.ignore("#{__dir__}/hdi/plugin.rb")
|
16
|
+
loader.setup
|
17
|
+
|
18
|
+
module WayOfWorking
|
19
|
+
module CodeLinting
|
20
|
+
module Hdi
|
21
|
+
class Error < StandardError; end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
module SubCommands
|
26
|
+
# This reopens the "way_of_working exec" sub command
|
27
|
+
class Exec
|
28
|
+
register(CodeLinting::Hdi::Generators::Exec, 'code_linting', 'code_linting',
|
29
|
+
<<~LONGDESC)
|
30
|
+
Description:
|
31
|
+
This runs code linting on this project
|
32
|
+
|
33
|
+
Example:
|
34
|
+
way_of_working exec code_linting
|
35
|
+
LONGDESC
|
36
|
+
end
|
37
|
+
|
38
|
+
# This reopens the "way_of_working init" sub command
|
39
|
+
class Init
|
40
|
+
register(CodeLinting::Hdi::Generators::Init, 'code_linting', 'code_linting',
|
41
|
+
<<~LONGDESC)
|
42
|
+
Description:
|
43
|
+
Installs code linting config files into the project
|
44
|
+
|
45
|
+
Example:
|
46
|
+
way_of_working init code_linting
|
47
|
+
|
48
|
+
This will create:
|
49
|
+
.github/workflows/mega-linter.yml
|
50
|
+
.mega-linter.yml
|
51
|
+
LONGDESC
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
metadata
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: way_of_working-code_linting-hdi
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Tim Gentry
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2025-01-27 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: way_of_working
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.0.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.0.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: zeitwerk
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 2.6.18
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 2.6.18
|
41
|
+
description:
|
42
|
+
email:
|
43
|
+
- 52189+timgentry@users.noreply.github.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".alexrc"
|
49
|
+
- ".mega-linter.yml"
|
50
|
+
- ".rubocop"
|
51
|
+
- CHANGELOG.md
|
52
|
+
- LICENSE.txt
|
53
|
+
- README.md
|
54
|
+
- Rakefile
|
55
|
+
- code_safety.yml
|
56
|
+
- docs/way_of_working/code-linting/index.md
|
57
|
+
- docs/way_of_working/code-linting/linters.md
|
58
|
+
- lib/way_of_working/code_linting/hdi.rb
|
59
|
+
- lib/way_of_working/code_linting/hdi/generators/document_linters.rb
|
60
|
+
- lib/way_of_working/code_linting/hdi/generators/exec.rb
|
61
|
+
- lib/way_of_working/code_linting/hdi/generators/init.rb
|
62
|
+
- lib/way_of_working/code_linting/hdi/generators/init_linters.rb
|
63
|
+
- lib/way_of_working/code_linting/hdi/github_audit_rule.rb
|
64
|
+
- lib/way_of_working/code_linting/hdi/paths.rb
|
65
|
+
- lib/way_of_working/code_linting/hdi/plugin.rb
|
66
|
+
- lib/way_of_working/code_linting/hdi/supported_linter.rb
|
67
|
+
- lib/way_of_working/code_linting/hdi/templates/.github/linters/.markdown-link-check.json
|
68
|
+
- lib/way_of_working/code_linting/hdi/templates/.github/linters/rubocop_defaults.yml
|
69
|
+
- lib/way_of_working/code_linting/hdi/templates/.github/workflows/mega-linter.yml
|
70
|
+
- lib/way_of_working/code_linting/hdi/templates/.mega-linter.yml
|
71
|
+
- lib/way_of_working/code_linting/hdi/templates/.rubocop
|
72
|
+
- lib/way_of_working/code_linting/hdi/templates/docs/way_of_working/code-linting/index.md
|
73
|
+
- lib/way_of_working/code_linting/hdi/templates/docs/way_of_working/code-linting/linters.md.tt
|
74
|
+
- lib/way_of_working/code_linting/hdi/version.rb
|
75
|
+
homepage: https://github.com/HealthDataInsight/way_of_working-code_linting-hdi
|
76
|
+
licenses:
|
77
|
+
- MIT
|
78
|
+
metadata:
|
79
|
+
allowed_push_host: https://rubygems.org
|
80
|
+
rubygems_mfa_required: 'true'
|
81
|
+
homepage_uri: https://github.com/HealthDataInsight/way_of_working-code_linting-hdi
|
82
|
+
source_code_uri: https://github.com/HealthDataInsight/way_of_working-code_linting-hdi
|
83
|
+
changelog_uri: https://github.com/HealthDataInsight/way_of_working-code_linting-hdi/blob/main/CHANGELOG.md
|
84
|
+
post_install_message:
|
85
|
+
rdoc_options: []
|
86
|
+
require_paths:
|
87
|
+
- lib
|
88
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: 3.1.0
|
93
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
requirements: []
|
99
|
+
rubygems_version: 3.5.22
|
100
|
+
signing_key:
|
101
|
+
specification_version: 4
|
102
|
+
summary: Way of Working plugin for HDI code linting using MegaLinter and Rubocop
|
103
|
+
test_files: []
|