way_of_working-pull_request_template-hdi 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: b45e945da2dedac0b926efb4af038c97a8bd1eb8e18973e6b72100cdd43aca3d
4
+ data.tar.gz: a74593e1e7aae26971c560f972c96b52125d3ab54139a4ad4545a3f51a3034f1
5
+ SHA512:
6
+ metadata.gz: 31d83c61120ceabd37eeb52407b32193c3d56eaaf2c6f81bc72fd4ebba2e98b46e79f479c386e52abbaf16a7e6288b87f54942ec3297779b4a31b114cbf8a322
7
+ data.tar.gz: ce6d455f0ff60950d160db9696d09059fbadf994bcdb8a854b5189d20b32e669fd88c06303f0f2a467b178a220ef47dd376a0b6806f24d3250315919849fc927
data/.alexrc ADDED
@@ -0,0 +1,3 @@
1
+ {
2
+ "profanitySureness": 1
3
+ }
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,18 @@
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-24
11
+
12
+ ### Added
13
+
14
+ - Added a Pull Request template and communications guidelines
15
+ - Added a GitHub audit rule to check for the presence of the PR template
16
+
17
+ [unreleased]: https://github.com/HealthDataInsight/way_of_working-pull_request_template-hdi/compare/v1.0.0...HEAD
18
+ [1.0.0]: https://github.com/HealthDataInsight/way_of_working-pull_request_template-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,59 @@
1
+ # WayOfWorking::PullRequestTemplate::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
+ This is a plugin for the [Way of Working](https://github.com/HealthDataInsight/way_of_working) framework. It contains a GitHub Pull Request (PR) template that contains the following section headings:
9
+
10
+ - What?
11
+ - Why?
12
+ - How?
13
+ - Testing?
14
+ - Screenshots (optional)
15
+ - Anything Else?
16
+
17
+ It includes inline guidance and examples on filling in the sections.
18
+
19
+ A Pull Request (PR) template offers multiple benefits to a development team. It standardizes the process of contributing changes, making it easier for both the author and the reviewers to understand the context of the changes. PR templates can ensure that necessary details, such as a summary of the changes, the reason for the changes (the 'why'), and any associated issue or ticket numbers, are consistently provided. This helps in maintaining a clean, organized, and searchable project history.
20
+
21
+ ## Installation
22
+
23
+ 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.
24
+
25
+ Install the gem and add to the application's Gemfile by executing:
26
+
27
+ ```bash
28
+ bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
29
+ ```
30
+
31
+ If bundler is not being used to manage dependencies, install the gem by executing:
32
+
33
+ ```bash
34
+ gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
35
+ ```
36
+
37
+ ## Usage
38
+
39
+ To add the Pull Request template to your project, use the following at the command line:
40
+
41
+ way_of_working init pull_request_template
42
+
43
+ ## Development
44
+
45
+ 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.
46
+
47
+ 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).
48
+
49
+ ## Contributing
50
+
51
+ Bug reports and pull requests are welcome on GitHub at https://github.com/HealthDataInsight/way_of_working-pull_request_template-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-pull_request_template-hdi/blob/main/CODE_OF_CONDUCT.md).
52
+
53
+ ## License
54
+
55
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
56
+
57
+ ## Code of Conduct
58
+
59
+ Everyone interacting in the way_of_working-pull_request_template-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-pull_request_template-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,138 @@
1
+ ---
2
+ file safety:
3
+ ".alexrc":
4
+ comments:
5
+ reviewed_by: timgentry
6
+ safe_revision: b6dfa95b5ff30b730da276f4f5ff4c6f9b62efe9
7
+ ".github/linters/.markdown-link-check.json":
8
+ comments:
9
+ reviewed_by: timgentry
10
+ safe_revision: b6dfa95b5ff30b730da276f4f5ff4c6f9b62efe9
11
+ ".github/linters/rubocop_defaults.yml":
12
+ comments:
13
+ reviewed_by: timgentry
14
+ safe_revision: b6dfa95b5ff30b730da276f4f5ff4c6f9b62efe9
15
+ ".github/pull_request_template.md":
16
+ comments:
17
+ reviewed_by: shilpigoeldev
18
+ safe_revision: 8a1c4e75959cd233ba1b9f134f792a112c642452
19
+ ".github/workflows/inclusive-language.yml":
20
+ comments:
21
+ reviewed_by: shilpigoeldev
22
+ safe_revision: 8a1c4e75959cd233ba1b9f134f792a112c642452
23
+ ".github/workflows/main.yml":
24
+ comments:
25
+ reviewed_by: timgentry
26
+ safe_revision: b6dfa95b5ff30b730da276f4f5ff4c6f9b62efe9
27
+ ".github/workflows/mega-linter.yml":
28
+ comments:
29
+ reviewed_by: shilpigoeldev
30
+ safe_revision: 8a1c4e75959cd233ba1b9f134f792a112c642452
31
+ ".gitignore":
32
+ comments:
33
+ reviewed_by: shilpigoeldev
34
+ safe_revision: 8a1c4e75959cd233ba1b9f134f792a112c642452
35
+ ".mega-linter.yml":
36
+ comments:
37
+ reviewed_by: timgentry
38
+ safe_revision: b6dfa95b5ff30b730da276f4f5ff4c6f9b62efe9
39
+ ".rubocop":
40
+ comments:
41
+ reviewed_by: timgentry
42
+ safe_revision: b6dfa95b5ff30b730da276f4f5ff4c6f9b62efe9
43
+ CHANGELOG.md:
44
+ comments:
45
+ reviewed_by: shilpigoeldev
46
+ safe_revision: 8a1c4e75959cd233ba1b9f134f792a112c642452
47
+ Gemfile:
48
+ comments:
49
+ reviewed_by: shilpigoeldev
50
+ safe_revision: 8a1c4e75959cd233ba1b9f134f792a112c642452
51
+ Gemfile.lock:
52
+ comments:
53
+ reviewed_by: shilpigoeldev
54
+ safe_revision: 8a1c4e75959cd233ba1b9f134f792a112c642452
55
+ LICENSE.txt:
56
+ comments:
57
+ reviewed_by: timgentry
58
+ safe_revision: b6dfa95b5ff30b730da276f4f5ff4c6f9b62efe9
59
+ README.md:
60
+ comments:
61
+ reviewed_by: shilpigoeldev
62
+ safe_revision: 8a1c4e75959cd233ba1b9f134f792a112c642452
63
+ Rakefile:
64
+ comments:
65
+ reviewed_by: timgentry
66
+ safe_revision: b6dfa95b5ff30b730da276f4f5ff4c6f9b62efe9
67
+ bin/console:
68
+ comments:
69
+ reviewed_by: shilpigoeldev
70
+ safe_revision: 8a1c4e75959cd233ba1b9f134f792a112c642452
71
+ bin/setup:
72
+ comments:
73
+ reviewed_by: timgentry
74
+ safe_revision: b6dfa95b5ff30b730da276f4f5ff4c6f9b62efe9
75
+ docs/way_of_working/pull-request-template-and-guidelines.md:
76
+ comments:
77
+ reviewed_by: shilpigoeldev
78
+ safe_revision: 8a1c4e75959cd233ba1b9f134f792a112c642452
79
+ lib/way_of_working/pull_request_template/hdi.rb:
80
+ comments:
81
+ reviewed_by: shilpigoeldev
82
+ safe_revision: 8a1c4e75959cd233ba1b9f134f792a112c642452
83
+ lib/way_of_working/pull_request_template/hdi/generators/init.rb:
84
+ comments:
85
+ reviewed_by: shilpigoeldev
86
+ safe_revision: 8a1c4e75959cd233ba1b9f134f792a112c642452
87
+ lib/way_of_working/pull_request_template/hdi/github_audit_rule.rb:
88
+ comments:
89
+ reviewed_by: shilpigoeldev
90
+ safe_revision: 8a1c4e75959cd233ba1b9f134f792a112c642452
91
+ lib/way_of_working/pull_request_template/hdi/paths.rb:
92
+ comments:
93
+ reviewed_by: shilpigoeldev
94
+ safe_revision: 8a1c4e75959cd233ba1b9f134f792a112c642452
95
+ lib/way_of_working/pull_request_template/hdi/plugin.rb:
96
+ comments:
97
+ reviewed_by: shilpigoeldev
98
+ safe_revision: 8a1c4e75959cd233ba1b9f134f792a112c642452
99
+ lib/way_of_working/pull_request_template/hdi/templates/.github/pull_request_template.md:
100
+ comments:
101
+ reviewed_by: shilpigoeldev
102
+ safe_revision: 8a1c4e75959cd233ba1b9f134f792a112c642452
103
+ lib/way_of_working/pull_request_template/hdi/templates/docs/way_of_working/pull-request-template-and-guidelines.md:
104
+ comments:
105
+ reviewed_by: shilpigoeldev
106
+ safe_revision: 8a1c4e75959cd233ba1b9f134f792a112c642452
107
+ lib/way_of_working/pull_request_template/hdi/version.rb:
108
+ comments:
109
+ reviewed_by: shilpigoeldev
110
+ safe_revision: 8a1c4e75959cd233ba1b9f134f792a112c642452
111
+ test/test_helper.rb:
112
+ comments:
113
+ reviewed_by: shilpigoeldev
114
+ safe_revision: 8a1c4e75959cd233ba1b9f134f792a112c642452
115
+ test/way_of_working/audit_github_stub_classes.rb:
116
+ comments:
117
+ reviewed_by: shilpigoeldev
118
+ safe_revision: 8a1c4e75959cd233ba1b9f134f792a112c642452
119
+ test/way_of_working/pull_request_template/hdi/generators/init_test.rb:
120
+ comments:
121
+ reviewed_by: shilpigoeldev
122
+ safe_revision: 8a1c4e75959cd233ba1b9f134f792a112c642452
123
+ test/way_of_working/pull_request_template/hdi/github_audit_rule_test.rb:
124
+ comments:
125
+ reviewed_by: shilpigoeldev
126
+ safe_revision: 8a1c4e75959cd233ba1b9f134f792a112c642452
127
+ test/way_of_working/pull_request_template/hdi/zeitwerk_loader_test.rb:
128
+ comments:
129
+ reviewed_by: shilpigoeldev
130
+ safe_revision: 8a1c4e75959cd233ba1b9f134f792a112c642452
131
+ test/way_of_working/pull_request_template/hdi_test.rb:
132
+ comments:
133
+ reviewed_by: shilpigoeldev
134
+ safe_revision: 8a1c4e75959cd233ba1b9f134f792a112c642452
135
+ way_of_working-pull_request_template-hdi.gemspec:
136
+ comments:
137
+ reviewed_by: shilpigoeldev
138
+ safe_revision: 8a1c4e75959cd233ba1b9f134f792a112c642452
@@ -0,0 +1,18 @@
1
+ ---
2
+ layout: page
3
+ ---
4
+
5
+ # Pull Request Template and Guidlines
6
+
7
+ A Pull Request (PR) template offers multiple benefits to a development team. It standardizes the process of contributing changes, making it easier for both the author and the reviewers to understand the context of the changes. PR templates can ensure that necessary details, such as a summary of the changes, the reason for the changes (the 'why'), and any associated issue or ticket numbers, are consistently provided. This helps in maintaining a clean, organized, and searchable project history.
8
+
9
+ Moreover, by setting clear expectations about the information that should be included in a PR, templates can streamline the review process, reduce the likelihood of misunderstandings, and ultimately lead to higher-quality code and a more productive team.
10
+
11
+ {: .important }
12
+ A Pull Request doesn't begin and end with the template, the tone of the request and any subsequent feedback is also very important. Alongside the [Code of Conduct](code-of-conduct.md), please read GitHub's PR communication guidlines in [How to write the perfect pull request](https://github.blog/2015-01-21-how-to-write-the-perfect-pull-request/).
13
+
14
+ ## Usage
15
+
16
+ To add the Pull Request template to your project, use the following at the command line:
17
+
18
+ way_of_working init pull_request_template
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'thor'
4
+
5
+ module WayOfWorking
6
+ module PullRequestTemplate
7
+ module Hdi
8
+ module Generators
9
+ # This generator adds the Pull Request template to a project
10
+ class Init < Thor::Group
11
+ include Thor::Actions
12
+
13
+ source_root ::WayOfWorking::PullRequestTemplate::Hdi.source_root
14
+
15
+ def copy_pr_template_action
16
+ copy_file '.github/pull_request_template.md'
17
+ end
18
+
19
+ def copy_way_of_working_documentation
20
+ copy_file 'docs/way_of_working/pull-request-template-and-guidelines.md'
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'way_of_working/audit/github/rules/base'
4
+
5
+ module WayOfWorking
6
+ module PullRequestTemplate
7
+ # The namespace for plugin
8
+ module Hdi
9
+ # This rule checks for the Pull Request template.
10
+ class GithubAuditRule < ::WayOfWorking::Audit::Github::Rules::Base
11
+ def validate
12
+ @errors << 'No Way of Working Pull Request template found' unless pull_request_template?
13
+ end
14
+
15
+ private
16
+
17
+ def pull_request_template?
18
+ response = @client.contents(@repo_name, path: '.github/pull_request_template.md')
19
+ decoded_content = Base64.decode64(response.content)
20
+
21
+ decoded_content.include?('## Screenshots (optional)')
22
+ rescue Octokit::NotFound
23
+ false
24
+ end
25
+ end
26
+
27
+ ::WayOfWorking::Audit::Github::Rules::Registry.register(
28
+ GithubAuditRule, 'Pull Request template'
29
+ )
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'pathname'
4
+
5
+ module WayOfWorking
6
+ module PullRequestTemplate
7
+ # Mixin that provides a couple of pathname convenience methods
8
+ module Hdi
9
+ class << self
10
+ def root
11
+ Pathname.new(File.expand_path('../../../..', __dir__))
12
+ end
13
+
14
+ def source_root
15
+ root.join('lib', 'way_of_working', 'pull_request_template', 'hdi', 'templates')
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1 @@
1
+ require 'way_of_working/pull_request_template/hdi'
@@ -0,0 +1,43 @@
1
+ ## What?
2
+
3
+ {Please write a few concise sentences outlining your changes and their overall impact, avoiding overly technical language. Reference relevant issue tracker tickets, but provide a stand-alone description that doesn’t require more than a few seconds to grasp.
4
+
5
+ e.g. I've added support for authentication to implement feature X of service Y. It
6
+ includes model, table, controller and test. For more background, see ticket #JIRA-123.}
7
+
8
+ ## Why?
9
+
10
+ {Outlining the business or engineering goals this Pull Request accomplishes is often more important than the "what". For instance, adding an environment variable default value may appear uncomplicated to many. However, if it drastically alters the usage of libraries in your application, an active-voiced explanation is needed to capture the true impact of the change.
11
+
12
+ e.g. These changes complete the user login and account creation experience. See #JIRA-123 for more information.}
13
+
14
+ ## How?
15
+
16
+ {While the Pull Request diff illustrates the "how" of your changes, it's crucial to highlight major design decisions like choosing a recursive method over a loop. Explaining your reasoning helps reviewers understand your thought process and enables a more insightful review.
17
+
18
+ e.g. This includes a migration, model and controller for user authentication. I'm using Devise to do the heavy lifting. I ran Devise migrations and those are included here.}
19
+
20
+ ## Testing?
21
+
22
+ {Including tests along with code updates is essential as it prevents merging code without tests or failing tests, which could pose risks if overlooked. It's equally important to describe how you've tested harder-to-test code, like infrastructure code, and to communicate any untested conditions or edge cases and their associated risks to the reviewer.}
23
+
24
+ ## Screenshots (optional)
25
+
26
+ {Screenshots can significantly aid the review process, especially for UI-related changes, by offering before-and-after views. Even for backend code, a snapshot of the outcome, such as a CLI tool output, can be insightful. For infrastructure code, consider including the result of operations like a Terraform plan, preferably in a collapsible section, to avoid cluttering the comment space.
27
+
28
+ Here’s how to do it in GitHub:
29
+ ```
30
+ <details>
31
+ <summary>Terraform Plan</summary>
32
+
33
+ ### After running plan:
34
+ </details>
35
+ ```
36
+ }
37
+
38
+ ## Anything Else?
39
+
40
+ {Consider discussing potential architectural modifications and technical debt while highlighting any challenges or optimisations you have identified.
41
+
42
+ e.g. Let's consider using a 3rd party authentication provider for this, to offload MFA and other considerations as they arise and the privacy landscape evolves. AWS Cognito is a good option, so is Firebase. I'm happy to start researching this path.
43
+ Let's also consider breaking this out into its own service. We can then re-use it or share the accounts with other apps in the future.}
@@ -0,0 +1,18 @@
1
+ ---
2
+ layout: page
3
+ ---
4
+
5
+ # Pull Request Template and Guidlines
6
+
7
+ A Pull Request (PR) template offers multiple benefits to a development team. It standardizes the process of contributing changes, making it easier for both the author and the reviewers to understand the context of the changes. PR templates can ensure that necessary details, such as a summary of the changes, the reason for the changes (the 'why'), and any associated issue or ticket numbers, are consistently provided. This helps in maintaining a clean, organized, and searchable project history.
8
+
9
+ Moreover, by setting clear expectations about the information that should be included in a PR, templates can streamline the review process, reduce the likelihood of misunderstandings, and ultimately lead to higher-quality code and a more productive team.
10
+
11
+ {: .important }
12
+ A Pull Request doesn't begin and end with the template, the tone of the request and any subsequent feedback is also very important. Alongside the [Code of Conduct](code-of-conduct.md), please read GitHub's PR communication guidlines in [How to write the perfect pull request](https://github.blog/2015-01-21-how-to-write-the-perfect-pull-request/).
13
+
14
+ ## Usage
15
+
16
+ To add the Pull Request template to your project, use the following at the command line:
17
+
18
+ way_of_working init pull_request_template
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module WayOfWorking
4
+ module PullRequestTemplate
5
+ module Hdi
6
+ VERSION = '1.0.0'
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,41 @@
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::PullRequestTemplate)
15
+ loader.ignore("#{__dir__}/hdi/plugin.rb")
16
+ loader.setup
17
+
18
+ module WayOfWorking
19
+ module PullRequestTemplate
20
+ module Hdi
21
+ class Error < StandardError; end
22
+ end
23
+ end
24
+
25
+ module SubCommands
26
+ # This reopens the "way_of_working init" sub command
27
+ class Init
28
+ register(PullRequestTemplate::Hdi::Generators::Init, 'pull_request_template', 'pull_request_template',
29
+ <<~LONGDESC)
30
+ Description:
31
+ Installs the Pull Request template into the project
32
+
33
+ Example:
34
+ way_of_working init pull_request_template
35
+
36
+ This will create:
37
+ .github/pull_request_template.md
38
+ LONGDESC
39
+ end
40
+ end
41
+ end
metadata ADDED
@@ -0,0 +1,93 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: way_of_working-pull_request_template-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-24 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'
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'
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/pull-request-template-and-guidelines.md
57
+ - lib/way_of_working/pull_request_template/hdi.rb
58
+ - lib/way_of_working/pull_request_template/hdi/generators/init.rb
59
+ - lib/way_of_working/pull_request_template/hdi/github_audit_rule.rb
60
+ - lib/way_of_working/pull_request_template/hdi/paths.rb
61
+ - lib/way_of_working/pull_request_template/hdi/plugin.rb
62
+ - lib/way_of_working/pull_request_template/hdi/templates/.github/pull_request_template.md
63
+ - lib/way_of_working/pull_request_template/hdi/templates/docs/way_of_working/pull-request-template-and-guidelines.md
64
+ - lib/way_of_working/pull_request_template/hdi/version.rb
65
+ homepage: https://github.com/HealthDataInsight/way_of_working-pull_request_template-hdi
66
+ licenses:
67
+ - MIT
68
+ metadata:
69
+ allowed_push_host: https://rubygems.org
70
+ rubygems_mfa_required: 'true'
71
+ homepage_uri: https://github.com/HealthDataInsight/way_of_working-pull_request_template-hdi
72
+ source_code_uri: https://github.com/HealthDataInsight/way_of_working-pull_request_template-hdi
73
+ changelog_uri: https://github.com/HealthDataInsight/way_of_working-pull_request_template-hdi/blob/main/CHANGELOG.md
74
+ post_install_message:
75
+ rdoc_options: []
76
+ require_paths:
77
+ - lib
78
+ required_ruby_version: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: 3.1.0
83
+ required_rubygems_version: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ requirements: []
89
+ rubygems_version: 3.5.22
90
+ signing_key:
91
+ specification_version: 4
92
+ summary: Way of Working plugin for pull requests using the HDI template
93
+ test_files: []