way_of_working 2.0.1 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +41 -1
- data/CLAUDE.md +48 -0
- data/CODE_OF_CONDUCT.md +55 -104
- data/CONTRIBUTING.md +62 -0
- data/README.md +240 -23
- data/exe/way_of_working +6 -1
- data/lib/way_of_working/audit/github/auditor.rb +47 -0
- data/lib/way_of_working/audit/github/generators/exec.rb +214 -0
- data/lib/way_of_working/audit/github/rules/base.rb +116 -0
- data/lib/way_of_working/audit/github/rules/registry.rb +44 -0
- data/lib/way_of_working/audit/github/rules/unknown.rb +19 -0
- data/lib/way_of_working/audit/github.rb +25 -0
- data/lib/way_of_working/changelog/keepachangelog/generators/init.rb +118 -0
- data/lib/way_of_working/changelog/keepachangelog/github_audit_rule.rb +32 -0
- data/lib/way_of_working/changelog/keepachangelog/templates/docs/way_of_working/changelog.md +73 -0
- data/lib/way_of_working/changelog/keepachangelog.rb +31 -0
- data/lib/way_of_working/cli.rb +13 -0
- data/lib/way_of_working/code_of_conduct/contributor_covenant/generators/init.rb +69 -0
- data/lib/way_of_working/code_of_conduct/contributor_covenant/github_audit_rule.rb +33 -0
- data/lib/way_of_working/code_of_conduct/contributor_covenant/templates/CODE_OF_CONDUCT.md.tt +83 -0
- data/lib/way_of_working/code_of_conduct/contributor_covenant/templates/docs/way_of_working/code-of-conduct.md +79 -0
- data/lib/way_of_working/code_of_conduct/contributor_covenant.rb +32 -0
- data/lib/way_of_working/completion.rb +60 -0
- data/lib/way_of_working/config.rb +45 -0
- data/lib/way_of_working/decision_record/madr/generators/init.rb +41 -0
- data/lib/way_of_working/decision_record/madr/generators/new.rb +69 -0
- data/lib/way_of_working/decision_record/madr/github_audit_rule.rb +37 -0
- data/lib/way_of_working/decision_record/madr/templates/.github/ISSUE_TEMPLATE/decision-record.md +26 -0
- data/lib/way_of_working/decision_record/madr/templates/docs/decisions/0000-use-markdown-any-decision-records.md +30 -0
- data/lib/way_of_working/decision_record/madr/templates/docs/decisions/README.md +7 -0
- data/lib/way_of_working/decision_record/madr/templates/docs/decisions/adr-template.md.tt +82 -0
- data/lib/way_of_working/decision_record/madr/templates/docs/decisions/index.md +48 -0
- data/lib/way_of_working/decision_record/madr/templates/docs/way_of_working/decision-records.md +195 -0
- data/lib/way_of_working/decision_record/madr.rb +49 -0
- data/lib/way_of_working/git/repo_reader.rb +2 -2
- data/lib/way_of_working/inclusive_language/alex/generators/exec.rb +51 -0
- data/lib/way_of_working/inclusive_language/alex/generators/init.rb +59 -0
- data/lib/way_of_working/inclusive_language/alex/github_audit_rule.rb +42 -0
- data/lib/way_of_working/inclusive_language/alex/templates/.alexignore +2 -0
- data/lib/way_of_working/inclusive_language/alex/templates/.alexrc +3 -0
- data/lib/way_of_working/inclusive_language/alex/templates/.github/workflows/inclusive-language.yml +16 -0
- data/lib/way_of_working/inclusive_language/alex/templates/docs/way_of_working/inclusive-language.md +28 -0
- data/lib/way_of_working/inclusive_language/alex.rb +46 -0
- data/lib/way_of_working/pull_request_template/hdi/generators/init.rb +26 -0
- data/lib/way_of_working/pull_request_template/hdi/github_audit_rule.rb +32 -0
- data/lib/way_of_working/pull_request_template/hdi/templates/.github/pull_request_template.md +51 -0
- data/lib/way_of_working/pull_request_template/hdi/templates/docs/way_of_working/pull-request-template-and-guidelines.md +50 -0
- data/lib/way_of_working/pull_request_template/hdi.rb +31 -0
- data/lib/way_of_working/readme_badge/generators/init.rb +11 -1
- data/lib/way_of_working/readme_badge/paths.rb +5 -2
- data/lib/way_of_working/readme_badge.rb +2 -6
- data/lib/way_of_working/sub_commands/base.rb +12 -0
- data/lib/way_of_working/sub_commands/config.rb +25 -0
- data/lib/way_of_working/sub_commands/init.rb +1 -1
- data/lib/way_of_working/version.rb +1 -1
- data/lib/way_of_working/versioning/semver/generators/init.rb +20 -0
- data/lib/way_of_working/versioning/semver/github_audit_rule.rb +38 -0
- data/lib/way_of_working/versioning/semver/templates/docs/way_of_working/versioning.md +71 -0
- data/lib/way_of_working/versioning/semver.rb +31 -0
- data/lib/way_of_working.rb +22 -0
- data/way_of_working.gemspec +5 -1
- metadata +108 -9
data/lib/way_of_working/decision_record/madr/templates/docs/way_of_working/decision-records.md
ADDED
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: page
|
|
3
|
+
title: Decision Records (Guidance)
|
|
4
|
+
status: REQUIRED
|
|
5
|
+
enforcement: manual
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Purpose
|
|
9
|
+
|
|
10
|
+
We use [Markdown Any Decision Records (MADR)][madr] v3.0.0 to capture project decisions that:
|
|
11
|
+
|
|
12
|
+
- aren't covered in the [Way of Working][wow]
|
|
13
|
+
- need project-specific implementation details
|
|
14
|
+
- diverge from Way of Working guidance
|
|
15
|
+
|
|
16
|
+
{: .note }
|
|
17
|
+
Proposing and reviewing decisions requires familiarity with [GitHub pull requests][gh-pr].
|
|
18
|
+
|
|
19
|
+
## Scope
|
|
20
|
+
|
|
21
|
+
Applies to decisions about:
|
|
22
|
+
|
|
23
|
+
- **Architecture**: System design, technology stack, frameworks
|
|
24
|
+
- **Process**: Development workflows, deployment, testing
|
|
25
|
+
- **Code standards**: Patterns, conventions, library usage
|
|
26
|
+
- **Dependencies**: Adding/removing major libraries or services
|
|
27
|
+
- **Data**: Schema changes, migration strategies
|
|
28
|
+
|
|
29
|
+
**Create ADR when:**
|
|
30
|
+
|
|
31
|
+
- Impact spans multiple components or teams
|
|
32
|
+
- Long-term consequences or significant cost/risk
|
|
33
|
+
- Multiple viable alternatives exist
|
|
34
|
+
|
|
35
|
+
**Don't create ADR for:**
|
|
36
|
+
|
|
37
|
+
- Already covered by Way of Working
|
|
38
|
+
- Tactical implementation details (use code comments)
|
|
39
|
+
- Temporary workarounds or clear-cut choices
|
|
40
|
+
|
|
41
|
+
## Requirements
|
|
42
|
+
|
|
43
|
+
**File naming:** `NNNN-title-with-dashes.md`
|
|
44
|
+
|
|
45
|
+
- `NNNN` = consecutive four-digit number (0001, 0002, etc.)
|
|
46
|
+
- Lowercase title with dashes
|
|
47
|
+
- Located in `docs/decisions/`
|
|
48
|
+
|
|
49
|
+
**Required content:**
|
|
50
|
+
|
|
51
|
+
1. Status (proposed, accepted, rejected, deprecated, superseded)
|
|
52
|
+
2. Context and problem statement
|
|
53
|
+
3. Considered options (minimum 2)
|
|
54
|
+
4. Decision outcome with justification
|
|
55
|
+
5. Positive and negative consequences
|
|
56
|
+
|
|
57
|
+
**Status lifecycle:**
|
|
58
|
+
|
|
59
|
+
- **proposed** - Under discussion
|
|
60
|
+
- **accepted** - Approved for implementation
|
|
61
|
+
- **rejected** - Decided against
|
|
62
|
+
- **deprecated** - No longer relevant
|
|
63
|
+
- **superseded** - Replaced by newer ADR (link required)
|
|
64
|
+
|
|
65
|
+
## Setup
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
way_of_working init decision_record
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Usage
|
|
72
|
+
|
|
73
|
+
### Create a new decision record
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
way_of_working new decision_record "Use Markdown Any Decision Records"
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**Propose decision:**
|
|
80
|
+
|
|
81
|
+
1. Create ADR with status "proposed"
|
|
82
|
+
2. Open PR, tag stakeholders
|
|
83
|
+
3. Discuss in PR comments
|
|
84
|
+
4. Update to "accepted" once consensus reached
|
|
85
|
+
5. Merge PR
|
|
86
|
+
|
|
87
|
+
**Supersede existing ADR:**
|
|
88
|
+
|
|
89
|
+
1. Create new ADR
|
|
90
|
+
2. Update old ADR status to "superseded by [0XXX-new-title.md](0XXX-new-title.md)"
|
|
91
|
+
3. Explain what changed in new ADR
|
|
92
|
+
|
|
93
|
+
## Enforcement
|
|
94
|
+
|
|
95
|
+
**PR Review:**
|
|
96
|
+
|
|
97
|
+
- All ADRs submitted via PR
|
|
98
|
+
- Maintainer approval required
|
|
99
|
+
- Verify MADR template structure, file naming, location
|
|
100
|
+
- Check minimum 2 options with justification
|
|
101
|
+
|
|
102
|
+
**Quality checklist:**
|
|
103
|
+
|
|
104
|
+
- ✅ Multiple alternatives with pros/cons
|
|
105
|
+
- ✅ Clear context and constraints
|
|
106
|
+
- ✅ Explicit trade-offs
|
|
107
|
+
- ❌ Only one option presented
|
|
108
|
+
- ❌ Missing justification or context
|
|
109
|
+
|
|
110
|
+
**Maintenance:**
|
|
111
|
+
|
|
112
|
+
- Quarterly review for relevance
|
|
113
|
+
- Update deprecated/superseded status as needed
|
|
114
|
+
|
|
115
|
+
## Examples
|
|
116
|
+
|
|
117
|
+
**Database choice:**
|
|
118
|
+
|
|
119
|
+
```markdown
|
|
120
|
+
# Use PostgreSQL for Primary Database
|
|
121
|
+
|
|
122
|
+
**Status:** accepted
|
|
123
|
+
**Date:** 2025-10-15
|
|
124
|
+
|
|
125
|
+
## Context and Problem Statement
|
|
126
|
+
|
|
127
|
+
Need relational database for user data with complex relationships.
|
|
128
|
+
Constraints: ACID compliance, 100K users/1M records, prefer open-source.
|
|
129
|
+
|
|
130
|
+
## Considered Options
|
|
131
|
+
|
|
132
|
+
1. PostgreSQL (self-hosted)
|
|
133
|
+
2. MySQL
|
|
134
|
+
3. RDS PostgreSQL
|
|
135
|
+
|
|
136
|
+
## Decision Outcome
|
|
137
|
+
|
|
138
|
+
**Chosen:** PostgreSQL (self-hosted)
|
|
139
|
+
|
|
140
|
+
**Pros:** Open-source, advanced features (JSON, full-text search), ACID, team experience
|
|
141
|
+
**Cons:** DevOps overhead, manual backup, manual scaling
|
|
142
|
+
|
|
143
|
+
**Why:** Meets requirements within budget. Cloud-managed exceeds budget by 40%.
|
|
144
|
+
Team expertise mitigates complexity.
|
|
145
|
+
|
|
146
|
+
**Alternatives rejected:**
|
|
147
|
+
- MySQL: No advantage over PostgreSQL
|
|
148
|
+
- RDS: Cost $200-500/month exceeds budget
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
**Superseded ADR:**
|
|
152
|
+
|
|
153
|
+
```markdown
|
|
154
|
+
# Use Jest for Frontend Testing
|
|
155
|
+
|
|
156
|
+
**Status:** superseded by [0015-use-vitest.md](0015-use-vitest.md)
|
|
157
|
+
**Date:** 2025-01-10 (original), 2025-09-15 (superseded)
|
|
158
|
+
|
|
159
|
+
**Why superseded:** Vitest now standard for Vite projects,
|
|
160
|
+
better integration and performance.
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
**Rejected decision:**
|
|
164
|
+
|
|
165
|
+
```markdown
|
|
166
|
+
# Use GraphQL for API Layer
|
|
167
|
+
|
|
168
|
+
**Status:** rejected
|
|
169
|
+
**Date:** 2025-03-20
|
|
170
|
+
|
|
171
|
+
## Decision Outcome
|
|
172
|
+
|
|
173
|
+
**Chosen:** Continue with REST API
|
|
174
|
+
|
|
175
|
+
**Why rejected:**
|
|
176
|
+
- Current REST meets all requirements
|
|
177
|
+
- Team lacks GraphQL expertise (4-6 week learning curve)
|
|
178
|
+
- Migration cost: 8 engineer-weeks
|
|
179
|
+
- No client needs GraphQL features
|
|
180
|
+
|
|
181
|
+
**Reconsider when:** Multiple clients need flexible fetching
|
|
182
|
+
or over-fetching impacts performance.
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## Resources
|
|
186
|
+
|
|
187
|
+
- [MADR Documentation][madr]
|
|
188
|
+
- [GDS Architecture Decisions][gds-way]
|
|
189
|
+
- [Way of Working CLI][wow-cli]
|
|
190
|
+
|
|
191
|
+
[madr]: https://adr.github.io/madr/
|
|
192
|
+
[wow]: https://github.com/HealthDataInsight/way_of_working
|
|
193
|
+
[gds-way]: https://gds-way.digital.cabinet-office.gov.uk/standards/architecture-decisions.html
|
|
194
|
+
[gh-pr]: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests
|
|
195
|
+
[wow-cli]: ../cli.md
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'madr/generators/init'
|
|
4
|
+
require_relative 'madr/generators/new'
|
|
5
|
+
|
|
6
|
+
# Register the GitHub audit rule (the registry is bundled with this gem)
|
|
7
|
+
require_relative 'madr/github_audit_rule'
|
|
8
|
+
|
|
9
|
+
module WayOfWorking
|
|
10
|
+
module DecisionRecord
|
|
11
|
+
module Madr
|
|
12
|
+
class Error < StandardError; end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
module SubCommands
|
|
17
|
+
# This reopens the "way_of_working init" sub command
|
|
18
|
+
class Init
|
|
19
|
+
register(DecisionRecord::Madr::Generators::Init, 'decision_record', 'decision_record',
|
|
20
|
+
<<~LONGDESC)
|
|
21
|
+
Description:
|
|
22
|
+
This generator adds Markdown Any Decision Records (MADR) to your project
|
|
23
|
+
|
|
24
|
+
Example:
|
|
25
|
+
way_of_working init decision_record
|
|
26
|
+
|
|
27
|
+
This will create:
|
|
28
|
+
docs/decisions/README.md
|
|
29
|
+
docs/decisions/adr-template.md
|
|
30
|
+
docs/decisions/0000-use-markdown-any-decision-records.md
|
|
31
|
+
LONGDESC
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# This reopens the "way_of_working new" sub command
|
|
35
|
+
class New
|
|
36
|
+
register(DecisionRecord::Madr::Generators::New, 'decision_record', 'decision_record [NAME]',
|
|
37
|
+
<<~LONGDESC)
|
|
38
|
+
Description:
|
|
39
|
+
This generator adds a new decision record to your project
|
|
40
|
+
|
|
41
|
+
Example:
|
|
42
|
+
way_of_working new decision_record "Title of the decision"
|
|
43
|
+
|
|
44
|
+
This will create:
|
|
45
|
+
docs/decisions/NNNN-title-of-the-decision.md
|
|
46
|
+
LONGDESC
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -58,10 +58,10 @@ module WayOfWorking
|
|
|
58
58
|
|
|
59
59
|
def likely_upstream_remote
|
|
60
60
|
remotes = @base.remotes
|
|
61
|
-
return remotes.first if remotes.
|
|
61
|
+
return remotes.first if remotes.one?
|
|
62
62
|
|
|
63
63
|
remotes = remotes.reject { |remote| remote.name == 'origin' }
|
|
64
|
-
return remotes.first if remotes.
|
|
64
|
+
return remotes.first if remotes.one?
|
|
65
65
|
|
|
66
66
|
remotes.last
|
|
67
67
|
end
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'thor'
|
|
4
|
+
require 'rainbow'
|
|
5
|
+
|
|
6
|
+
module WayOfWorking
|
|
7
|
+
module InclusiveLanguage
|
|
8
|
+
module Alex
|
|
9
|
+
module Generators
|
|
10
|
+
# This generator runs the inclusive language tests
|
|
11
|
+
class Exec < Thor::Group
|
|
12
|
+
argument :path, type: :string, required: false, desc: 'Optional path of the file to test'
|
|
13
|
+
|
|
14
|
+
desc 'This runs the inclusive language tests on this project'
|
|
15
|
+
|
|
16
|
+
def run_first
|
|
17
|
+
@start_time = Time.now
|
|
18
|
+
|
|
19
|
+
say(Rainbow("Limiting tests to #{path}\n").yellow) if path
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def prep_and_run_alex
|
|
23
|
+
command = ['npx', 'alex', '--why']
|
|
24
|
+
# Configure alex to only test a specific file or folder, if defined
|
|
25
|
+
command << path if path
|
|
26
|
+
|
|
27
|
+
say(Rainbow("\nRunning alex...").yellow)
|
|
28
|
+
|
|
29
|
+
@alex_ok = run_alex(command)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def run_last
|
|
33
|
+
say(Rainbow("\nTotal time taken: #{(Time.now - @start_time).to_i} seconds").yellow)
|
|
34
|
+
|
|
35
|
+
if @alex_ok
|
|
36
|
+
say(Rainbow("\nInclusive language tests succeeded!").green)
|
|
37
|
+
else
|
|
38
|
+
abort(Rainbow("\nInclusive language tests failed!").red)
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
private
|
|
43
|
+
|
|
44
|
+
def run_alex(arguments)
|
|
45
|
+
system(*arguments)
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'thor'
|
|
4
|
+
require 'way_of_working/git/repo_reader'
|
|
5
|
+
|
|
6
|
+
module WayOfWorking
|
|
7
|
+
module InclusiveLanguage
|
|
8
|
+
module Alex
|
|
9
|
+
module Generators
|
|
10
|
+
# This generator adds the alexrc file
|
|
11
|
+
class Init < Thor::Group
|
|
12
|
+
BADGE_HOLDER_END_TAG = "<!-- Way of Working: Badge Holder End -->\n"
|
|
13
|
+
|
|
14
|
+
include Thor::Actions
|
|
15
|
+
|
|
16
|
+
source_root WayOfWorking.root.join('lib', 'way_of_working', 'inclusive_language', 'alex', 'templates')
|
|
17
|
+
|
|
18
|
+
def copy_inclusive_language_github_workflow_action
|
|
19
|
+
copy_file '.github/workflows/inclusive-language.yml'
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def copy_alexignore_file
|
|
23
|
+
copy_file '.alexignore'
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def copy_alexrc_file
|
|
27
|
+
copy_file '.alexrc'
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def copy_way_of_working_documentation
|
|
31
|
+
copy_file 'docs/way_of_working/inclusive-language.md'
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Adds the workflow status badge to the README badge panel created by `init readme_badge`
|
|
35
|
+
def add_badge_to_readme
|
|
36
|
+
readme = File.join(destination_root, 'README.md')
|
|
37
|
+
return unless File.exist?(readme) && File.read(readme).include?(BADGE_HOLDER_END_TAG)
|
|
38
|
+
return unless github_url
|
|
39
|
+
|
|
40
|
+
actions_url = "#{github_url}/actions/workflows/inclusive-language.yml"
|
|
41
|
+
insert_into_file 'README.md', "[](#{actions_url})\n",
|
|
42
|
+
before: BADGE_HOLDER_END_TAG
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
private
|
|
46
|
+
|
|
47
|
+
# Returns e.g. https://github.com/org/repo, or nil if there is no GitHub remote
|
|
48
|
+
def github_url
|
|
49
|
+
remote_url = ::WayOfWorking::Git::RepoReader.new(::Git.open(destination_root)).likely_upstream_remote_url
|
|
50
|
+
repo = remote_url&.match(%r{github\.com[:/]([^/]+/[^/]+?)/?\z})&.[](1)
|
|
51
|
+
"https://github.com/#{repo}" if repo
|
|
52
|
+
rescue ArgumentError
|
|
53
|
+
nil
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'way_of_working/audit/github/rules/base'
|
|
4
|
+
|
|
5
|
+
module WayOfWorking
|
|
6
|
+
module InclusiveLanguage
|
|
7
|
+
# The namespace for plugin
|
|
8
|
+
module Alex
|
|
9
|
+
# This rule checks the repo has the Inclusive Language files verbatim and the README badge.
|
|
10
|
+
class GithubAuditRule < ::WayOfWorking::Audit::Github::Rules::Base
|
|
11
|
+
SOURCE_FILES = %w[
|
|
12
|
+
.github/workflows/inclusive-language.yml
|
|
13
|
+
.alexignore
|
|
14
|
+
.alexrc
|
|
15
|
+
docs/way_of_working/inclusive-language.md
|
|
16
|
+
].freeze
|
|
17
|
+
|
|
18
|
+
source_root WayOfWorking.root.join('lib', 'way_of_working', 'inclusive_language', 'alex', 'templates')
|
|
19
|
+
|
|
20
|
+
def validate
|
|
21
|
+
SOURCE_FILES.each do |path|
|
|
22
|
+
@errors << "#{path} is missing or does not match the template" unless repo_file_contains_source_file?(path)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
@errors << 'Default branch is named "master"' if @repo.default_branch == 'master'
|
|
26
|
+
|
|
27
|
+
@errors << 'No Inclusive Language README Badge' unless inclusive_language_badge?
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
private
|
|
31
|
+
|
|
32
|
+
def inclusive_language_badge?
|
|
33
|
+
readme_content.include?("[]")
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
::WayOfWorking::Audit::Github::Rules::Registry.register(
|
|
38
|
+
GithubAuditRule, 'Inclusive Language GitHub Action and README badge'
|
|
39
|
+
)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
data/lib/way_of_working/inclusive_language/alex/templates/.github/workflows/inclusive-language.yml
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "Inclusive Language"
|
|
3
|
+
"on": push
|
|
4
|
+
|
|
5
|
+
permissions: read-all
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
test_inclusivity:
|
|
9
|
+
name: Inclusive Language Tests
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v6
|
|
13
|
+
- name: Set up Node via mise
|
|
14
|
+
uses: jdx/mise-action@v2
|
|
15
|
+
- name: Run alex
|
|
16
|
+
run: npx alex --why
|
data/lib/way_of_working/inclusive_language/alex/templates/docs/way_of_working/inclusive-language.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: page
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Inclusive Language
|
|
6
|
+
|
|
7
|
+
We have adopted [alex](https://alexjs.com) for automated testing of inclusive language.
|
|
8
|
+
|
|
9
|
+
Using insensitive and inconsiderate language can cause harm to others, create barriers to communication, and damage relationships. It can make people feel excluded, disrespected, and devalued and may perpetuate negative stereotypes and biases. When we use insensitive or offensive language, we undermine our ability to connect with others and build trust.
|
|
10
|
+
|
|
11
|
+
Therefore, it is essential to be mindful of the impact of our words and to choose language that is respectful, inclusive, and considerate of others. Doing so can create a more welcoming and inclusive environment for everyone, fostering greater understanding, empathy, and cooperation.
|
|
12
|
+
|
|
13
|
+
To quote from the alex README:
|
|
14
|
+
|
|
15
|
+
> No automated tool can replace studying inclusive communication and listening to the lived experiences of others. **An error from alex can be an invitation to learn more**.
|
|
16
|
+
|
|
17
|
+
{: .important }
|
|
18
|
+
Please take the opportunity to read some of the [further reading](https://github.com/get-alex/alex#further-reading) they reference and click on the links against individual warnings when they appear.
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
To add alex to your project, run the following at the command line:
|
|
23
|
+
|
|
24
|
+
way_of_working init inclusive_language
|
|
25
|
+
|
|
26
|
+
to run alex in your project, run:
|
|
27
|
+
|
|
28
|
+
way_of_working exec inclusive_language
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'alex/generators/exec'
|
|
4
|
+
require_relative 'alex/generators/init'
|
|
5
|
+
|
|
6
|
+
# Register the GitHub audit rule (the registry is bundled with this gem)
|
|
7
|
+
require_relative 'alex/github_audit_rule'
|
|
8
|
+
|
|
9
|
+
module WayOfWorking
|
|
10
|
+
module InclusiveLanguage
|
|
11
|
+
module Alex
|
|
12
|
+
class Error < StandardError; end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
module SubCommands
|
|
17
|
+
# This reopens the "way_of_working exec" (i.e. run) sub command
|
|
18
|
+
class Exec
|
|
19
|
+
register(InclusiveLanguage::Alex::Generators::Exec, 'inclusive_language', 'inclusive_language',
|
|
20
|
+
<<~LONGDESC)
|
|
21
|
+
Description:
|
|
22
|
+
This runs inclusive language tests on this project
|
|
23
|
+
|
|
24
|
+
Example:
|
|
25
|
+
way_of_working exec inclusive_language
|
|
26
|
+
LONGDESC
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# This reopens the "way_of_working init" sub command
|
|
30
|
+
class Init
|
|
31
|
+
register(InclusiveLanguage::Alex::Generators::Init, 'inclusive_language', 'inclusive_language',
|
|
32
|
+
<<~LONGDESC)
|
|
33
|
+
Description:
|
|
34
|
+
Installs alex config file into the project
|
|
35
|
+
|
|
36
|
+
Example:
|
|
37
|
+
way_of_working init inclusive_language
|
|
38
|
+
|
|
39
|
+
This will create:
|
|
40
|
+
.alexrc
|
|
41
|
+
|
|
42
|
+
and add the workflow badge to the README badge panel, if present
|
|
43
|
+
LONGDESC
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
@@ -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.root.join('lib', 'way_of_working', 'pull_request_template', 'hdi', 'templates')
|
|
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,51 @@
|
|
|
1
|
+
# Pull Request Details
|
|
2
|
+
|
|
3
|
+
## What?
|
|
4
|
+
|
|
5
|
+
{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.
|
|
6
|
+
|
|
7
|
+
e.g. I've added support for authentication to implement feature X of service Y. It
|
|
8
|
+
includes model, table, controller and test. For more background, see ticket #JIRA-123.}
|
|
9
|
+
|
|
10
|
+
## Why?
|
|
11
|
+
|
|
12
|
+
{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.
|
|
13
|
+
|
|
14
|
+
e.g. These changes complete the user login and account creation experience. See #JIRA-123 for more information.}
|
|
15
|
+
|
|
16
|
+
## How?
|
|
17
|
+
|
|
18
|
+
{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.
|
|
19
|
+
|
|
20
|
+
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.}
|
|
21
|
+
|
|
22
|
+
## Testing?
|
|
23
|
+
|
|
24
|
+
{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.}
|
|
25
|
+
|
|
26
|
+
## AI Contribution
|
|
27
|
+
|
|
28
|
+
{Disclose any AI tools (e.g. GitHub Copilot, ChatGPT, Claude) used in this Pull Request, describing what they contributed. This helps reviewers understand the level of AI involvement and apply appropriate scrutiny.
|
|
29
|
+
|
|
30
|
+
e.g. Claude 9.9 wrote the documentation and tests, or a team of GPT-9o agents wrote everything.}
|
|
31
|
+
|
|
32
|
+
## Screenshots (optional)
|
|
33
|
+
|
|
34
|
+
{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.
|
|
35
|
+
|
|
36
|
+
Here’s how to do it in GitHub:
|
|
37
|
+
```
|
|
38
|
+
<details>
|
|
39
|
+
<summary>Terraform Plan</summary>
|
|
40
|
+
|
|
41
|
+
### After running plan:
|
|
42
|
+
</details>
|
|
43
|
+
```
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
## Anything Else?
|
|
47
|
+
|
|
48
|
+
{Consider discussing potential architectural modifications and technical debt while highlighting any challenges or optimisations you have identified.
|
|
49
|
+
|
|
50
|
+
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.
|
|
51
|
+
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,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: page
|
|
3
|
+
status: REQUIRED
|
|
4
|
+
enforcement: manual
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Pull Request Template and Guidelines
|
|
8
|
+
|
|
9
|
+
## Purpose
|
|
10
|
+
|
|
11
|
+
Standardise PR submissions to ensure consistent context, improve review efficiency, and maintain searchable project history.
|
|
12
|
+
|
|
13
|
+
## Scope
|
|
14
|
+
|
|
15
|
+
Applies to all pull requests across team projects.
|
|
16
|
+
|
|
17
|
+
## Requirements
|
|
18
|
+
|
|
19
|
+
- PR template must be present in repository
|
|
20
|
+
- All PRs must include:
|
|
21
|
+
- Summary of changes
|
|
22
|
+
- Rationale (why)
|
|
23
|
+
- Associated issue/ticket numbers
|
|
24
|
+
- Follow [Code of Conduct](code-of-conduct.md) and GitHub's [How to write the perfect pull request][perfect-pr] guidelines
|
|
25
|
+
|
|
26
|
+
{: .important }
|
|
27
|
+
A Pull Request doesn't begin and end with the template. The tone of the request and any subsequent feedback is also very important. Read GitHub's PR communication guidelines in [How to write the perfect pull request][perfect-pr].
|
|
28
|
+
|
|
29
|
+
## Setup
|
|
30
|
+
|
|
31
|
+
Initialise PR template:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
way_of_working init pull_request_template
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Usage
|
|
38
|
+
|
|
39
|
+
Use the template when creating PRs. Provide all requested information professionally.
|
|
40
|
+
|
|
41
|
+
## Enforcement
|
|
42
|
+
|
|
43
|
+
Manual review during PR submission and code review process.
|
|
44
|
+
|
|
45
|
+
## Resources
|
|
46
|
+
|
|
47
|
+
- [How to write the perfect pull request][perfect-pr]
|
|
48
|
+
- [Code of Conduct](code-of-conduct.md)
|
|
49
|
+
|
|
50
|
+
[perfect-pr]: https://github.blog/2015-01-21-how-to-write-the-perfect-pull-request/
|