way_of_working 2.0.0 → 2.1.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 +30 -1
- data/CONTRIBUTING.md +62 -0
- data/README.md +187 -14
- data/lib/way_of_working/audit/github/auditor.rb +44 -0
- data/lib/way_of_working/audit/github/generators/exec.rb +163 -0
- data/lib/way_of_working/audit/github/rules/base.rb +91 -0
- data/lib/way_of_working/audit/github/rules/registry.rb +36 -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 +35 -0
- data/lib/way_of_working/code_of_conduct/contributor_covenant/generators/init.rb +39 -0
- data/lib/way_of_working/code_of_conduct/contributor_covenant/github_audit_rule.rb +32 -0
- data/lib/way_of_working/code_of_conduct/contributor_covenant/templates/CODE_OF_CONDUCT.md.tt +133 -0
- data/lib/way_of_working/code_of_conduct/contributor_covenant/templates/docs/way_of_working/code-of-conduct.md +78 -0
- data/lib/way_of_working/code_of_conduct/contributor_covenant.rb +36 -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 +50 -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 +53 -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 +34 -0
- data/lib/way_of_working/inclusive_language/alex/github_audit_rule.rb +35 -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 +48 -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 +35 -0
- data/lib/way_of_working/readme_badge/github_audit_rule.rb +1 -3
- data/lib/way_of_working/readme_badge/paths.rb +5 -2
- data/lib/way_of_working/readme_badge.rb +5 -7
- 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 +49 -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 +35 -0
- data/lib/way_of_working.rb +15 -0
- data/way_of_working.gemspec +4 -1
- metadata +89 -4
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'thor'
|
|
4
|
+
|
|
5
|
+
module WayOfWorking
|
|
6
|
+
module InclusiveLanguage
|
|
7
|
+
module Alex
|
|
8
|
+
module Generators
|
|
9
|
+
# This generator adds the alexrc file
|
|
10
|
+
class Init < Thor::Group
|
|
11
|
+
include Thor::Actions
|
|
12
|
+
|
|
13
|
+
source_root WayOfWorking.root.join('lib', 'way_of_working', 'inclusive_language', 'alex', 'templates')
|
|
14
|
+
|
|
15
|
+
def copy_inclusive_language_github_workflow_action
|
|
16
|
+
copy_file '.github/workflows/inclusive-language.yml'
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def copy_alexignore_file
|
|
20
|
+
copy_file '.alexignore'
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def copy_alexrc_file
|
|
24
|
+
copy_file '.alexrc'
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def copy_way_of_working_documentation
|
|
28
|
+
copy_file 'docs/way_of_working/inclusive-language.md'
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
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 for the Inclusive Language workflow action and README badge.
|
|
10
|
+
class GithubAuditRule < ::WayOfWorking::Audit::Github::Rules::Base
|
|
11
|
+
def validate
|
|
12
|
+
response = @client.workflows(@repo_name)
|
|
13
|
+
|
|
14
|
+
unless response.workflows.map(&:name).include?('Inclusive Language')
|
|
15
|
+
@errors << 'No Inclusive Language GitHub Action'
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
@errors << 'Default branch is named "master"' if @repo.default_branch == 'master'
|
|
19
|
+
|
|
20
|
+
@errors << 'No Inclusive Language README Badge' unless inclusive_language_badge?
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
private
|
|
24
|
+
|
|
25
|
+
def inclusive_language_badge?
|
|
26
|
+
readme_content.include?("[]")
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
::WayOfWorking::Audit::Github::Rules::Registry.register(
|
|
31
|
+
GithubAuditRule, 'Inclusive Language GitHub Action and README badge'
|
|
32
|
+
)
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
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 # yamllint disable-line rule:truthy
|
|
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,48 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'alex/generators/exec'
|
|
4
|
+
require_relative 'alex/generators/init'
|
|
5
|
+
|
|
6
|
+
# If way_of_working-audit-github is used we can add a rule
|
|
7
|
+
begin
|
|
8
|
+
require 'way_of_working/audit/github/rules/registry'
|
|
9
|
+
require_relative 'alex/github_audit_rule'
|
|
10
|
+
rescue LoadError # rubocop:disable Lint/SuppressedException
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
module WayOfWorking
|
|
14
|
+
module InclusiveLanguage
|
|
15
|
+
module Alex
|
|
16
|
+
class Error < StandardError; end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
module SubCommands
|
|
21
|
+
# This reopens the "way_of_working exec" (i.e. run) sub command
|
|
22
|
+
class Exec
|
|
23
|
+
register(InclusiveLanguage::Alex::Generators::Exec, 'inclusive_language', 'inclusive_language',
|
|
24
|
+
<<~LONGDESC)
|
|
25
|
+
Description:
|
|
26
|
+
This runs inclusive language tests on this project
|
|
27
|
+
|
|
28
|
+
Example:
|
|
29
|
+
way_of_working exec inclusive_language
|
|
30
|
+
LONGDESC
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# This reopens the "way_of_working init" sub command
|
|
34
|
+
class Init
|
|
35
|
+
register(InclusiveLanguage::Alex::Generators::Init, 'inclusive_language', 'inclusive_language',
|
|
36
|
+
<<~LONGDESC)
|
|
37
|
+
Description:
|
|
38
|
+
Installs alex config file into the project
|
|
39
|
+
|
|
40
|
+
Example:
|
|
41
|
+
way_of_working init inclusive_language
|
|
42
|
+
|
|
43
|
+
This will create:
|
|
44
|
+
.alexrc
|
|
45
|
+
LONGDESC
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
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/
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'hdi/generators/init'
|
|
4
|
+
|
|
5
|
+
# If way_of_working-audit-github is used we can add a rule
|
|
6
|
+
begin
|
|
7
|
+
require 'way_of_working/audit/github/rules/registry'
|
|
8
|
+
require_relative 'hdi/github_audit_rule'
|
|
9
|
+
rescue LoadError # rubocop:disable Lint/SuppressedException
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
module WayOfWorking
|
|
13
|
+
module PullRequestTemplate
|
|
14
|
+
module Hdi
|
|
15
|
+
class Error < StandardError; end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
module SubCommands
|
|
20
|
+
# This reopens the "way_of_working init" sub command
|
|
21
|
+
class Init
|
|
22
|
+
register(PullRequestTemplate::Hdi::Generators::Init, 'pull_request_template', 'pull_request_template',
|
|
23
|
+
<<~LONGDESC)
|
|
24
|
+
Description:
|
|
25
|
+
Installs the Pull Request template into the project
|
|
26
|
+
|
|
27
|
+
Example:
|
|
28
|
+
way_of_working init pull_request_template
|
|
29
|
+
|
|
30
|
+
This will create:
|
|
31
|
+
.github/pull_request_template.md
|
|
32
|
+
LONGDESC
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -7,11 +7,9 @@ module WayOfWorking
|
|
|
7
7
|
module ReadmeBadge
|
|
8
8
|
# This rule checks for a README and Way of Working badge.
|
|
9
9
|
class GithubAuditRule < ::WayOfWorking::Audit::Github::Rules::Base
|
|
10
|
-
def
|
|
10
|
+
def validate
|
|
11
11
|
@errors << 'No README' if readme_content.nil?
|
|
12
12
|
@errors << 'No Way of Working README Badge' unless readme_way_of_working_badge?
|
|
13
|
-
|
|
14
|
-
@errors.empty? ? :passed : :failed
|
|
15
13
|
end
|
|
16
14
|
|
|
17
15
|
private
|
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
require 'pathname'
|
|
4
4
|
|
|
5
5
|
module WayOfWorking
|
|
6
|
-
#
|
|
6
|
+
# Namespace for the internal ReadmeBadge plugin
|
|
7
7
|
module ReadmeBadge
|
|
8
|
-
|
|
8
|
+
# Mixin that provides a couple of pathname convenience methods
|
|
9
|
+
module Paths
|
|
9
10
|
def root
|
|
10
11
|
Pathname.new(File.expand_path('../../..', __dir__))
|
|
11
12
|
end
|
|
@@ -14,5 +15,7 @@ module WayOfWorking
|
|
|
14
15
|
root.join('lib', 'way_of_working', 'readme_badge', 'templates')
|
|
15
16
|
end
|
|
16
17
|
end
|
|
18
|
+
|
|
19
|
+
extend Paths
|
|
17
20
|
end
|
|
18
21
|
end
|
|
@@ -3,13 +3,11 @@
|
|
|
3
3
|
require_relative 'readme_badge/generators/init'
|
|
4
4
|
|
|
5
5
|
# If way_of_working-audit-github is used we can add a rule
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
end
|
|
12
|
-
require_relative 'readme_badge/github_audit_rule' if github_audit_used
|
|
6
|
+
begin
|
|
7
|
+
require 'way_of_working/audit/github/rules/registry'
|
|
8
|
+
require_relative 'readme_badge/github_audit_rule'
|
|
9
|
+
rescue LoadError # rubocop:disable Lint/SuppressedException
|
|
10
|
+
end
|
|
13
11
|
|
|
14
12
|
module WayOfWorking
|
|
15
13
|
module SubCommands
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module WayOfWorking
|
|
4
|
+
module Versioning
|
|
5
|
+
module Semver
|
|
6
|
+
module Generators
|
|
7
|
+
# This generator add the Semver files to the doc/decisions folder
|
|
8
|
+
class Init < Thor::Group
|
|
9
|
+
include Thor::Actions
|
|
10
|
+
|
|
11
|
+
source_root WayOfWorking.root.join('lib', 'way_of_working', 'versioning', 'semver', 'templates')
|
|
12
|
+
|
|
13
|
+
def copy_way_of_working_file
|
|
14
|
+
copy_file 'docs/way_of_working/versioning.md'
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'way_of_working/audit/github/rules/base'
|
|
4
|
+
|
|
5
|
+
module WayOfWorking
|
|
6
|
+
module Versioning
|
|
7
|
+
# The namespace for this plugin
|
|
8
|
+
module Semver
|
|
9
|
+
# This rule checks for the versioning documentation
|
|
10
|
+
class GithubAuditRule < ::WayOfWorking::Audit::Github::Rules::Base
|
|
11
|
+
source_root WayOfWorking.root.join('lib', 'way_of_working', 'versioning', 'semver', 'templates')
|
|
12
|
+
|
|
13
|
+
def validate
|
|
14
|
+
validate_repo_file_contains_source_file(
|
|
15
|
+
'docs/way_of_working/versioning.md'
|
|
16
|
+
)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
private
|
|
20
|
+
|
|
21
|
+
def repo_file_contains_source_file?(path)
|
|
22
|
+
repo_file_contains?(path, File.read(self.class.source_root.join(path)))
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def repo_file_contains?(path, text)
|
|
26
|
+
remote_content = repo_file_contents(path)
|
|
27
|
+
return false if remote_content.nil?
|
|
28
|
+
|
|
29
|
+
remote_content.include?(text)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def validate_repo_file_contains_source_file(*paths)
|
|
33
|
+
paths.each do |path|
|
|
34
|
+
if repo_file_contents(path).nil?
|
|
35
|
+
@errors << "#{path} missing"
|
|
36
|
+
next
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
@errors << "#{path} does not match the source template" unless repo_file_contains_source_file?(path)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
::WayOfWorking::Audit::Github::Rules::Registry.register(
|
|
45
|
+
GithubAuditRule, 'Semantic Versioning'
|
|
46
|
+
)
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: page
|
|
3
|
+
status: REQUIRED
|
|
4
|
+
enforcement: manual
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Versioning
|
|
8
|
+
|
|
9
|
+
## Purpose
|
|
10
|
+
|
|
11
|
+
Define the versioning standard for communicating software changes and managing releases across projects.
|
|
12
|
+
|
|
13
|
+
## Scope
|
|
14
|
+
|
|
15
|
+
Applies to all software projects requiring version identification.
|
|
16
|
+
|
|
17
|
+
## Requirements
|
|
18
|
+
|
|
19
|
+
Use [Semantic Versioning](https://semver.org) (semver) with format `MAJOR.MINOR.PATCH`:
|
|
20
|
+
|
|
21
|
+
1. **MAJOR**: Increment for incompatible API changes
|
|
22
|
+
2. **MINOR**: Increment for backwards-compatible functionality additions
|
|
23
|
+
3. **PATCH**: Increment for backwards-compatible bug fixes
|
|
24
|
+
|
|
25
|
+
Pre-release and build metadata labels available as extensions.
|
|
26
|
+
|
|
27
|
+
## Setup
|
|
28
|
+
|
|
29
|
+
No specific tooling required. Apply version numbers to:
|
|
30
|
+
|
|
31
|
+
- Git tags
|
|
32
|
+
- Package manifests (`package.json`, `Cargo.toml`, etc.)
|
|
33
|
+
- Release notes
|
|
34
|
+
- Documentation
|
|
35
|
+
|
|
36
|
+
## Usage
|
|
37
|
+
|
|
38
|
+
**When to increment:**
|
|
39
|
+
|
|
40
|
+
- Breaking changes → increment MAJOR (e.g., 1.2.3 → 2.0.0)
|
|
41
|
+
- New features (backwards-compatible) → increment MINOR (e.g., 1.2.3 → 1.3.0)
|
|
42
|
+
- Bug fixes (backwards-compatible) → increment PATCH (e.g., 1.2.3 → 1.2.4)
|
|
43
|
+
|
|
44
|
+
**Pre-release versions:** Append hyphen and identifiers (e.g., 1.0.0-alpha, 1.0.0-beta.1)
|
|
45
|
+
|
|
46
|
+
**Build metadata:** Append plus sign and identifiers (e.g., 1.0.0+20240115)
|
|
47
|
+
|
|
48
|
+
## Enforcement
|
|
49
|
+
|
|
50
|
+
Manual enforcement through:
|
|
51
|
+
|
|
52
|
+
- Code review verification
|
|
53
|
+
- Release checklist validation
|
|
54
|
+
- Automated CI checks (where configured)
|
|
55
|
+
|
|
56
|
+
## Examples
|
|
57
|
+
|
|
58
|
+
```text
|
|
59
|
+
0.1.0 → Initial development
|
|
60
|
+
1.0.0 → First stable release
|
|
61
|
+
1.1.0 → Added new feature
|
|
62
|
+
1.1.1 → Fixed bug
|
|
63
|
+
2.0.0 → Breaking API change
|
|
64
|
+
2.0.0-rc.1 → Release candidate
|
|
65
|
+
1.2.3+build.456 → With build metadata
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Resources
|
|
69
|
+
|
|
70
|
+
- [Semantic Versioning Specification](https://semver.org)
|
|
71
|
+
- [Semver Calculator](https://semver.npmjs.com) - Determine version impact
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'semver/generators/init'
|
|
4
|
+
|
|
5
|
+
# If way_of_working-audit-github is used we can add a rule
|
|
6
|
+
begin
|
|
7
|
+
require 'way_of_working/audit/github/rules/registry'
|
|
8
|
+
require_relative 'semver/github_audit_rule'
|
|
9
|
+
rescue LoadError # rubocop:disable Lint/SuppressedException
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
module WayOfWorking
|
|
13
|
+
module Versioning
|
|
14
|
+
module Semver
|
|
15
|
+
class Error < StandardError; end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
module SubCommands
|
|
20
|
+
# This reopens the "way_of_working init" sub command
|
|
21
|
+
class Init
|
|
22
|
+
register(Versioning::Semver::Generators::Init, 'versioning', 'versioning',
|
|
23
|
+
<<~LONGDESC)
|
|
24
|
+
Description:
|
|
25
|
+
This generator adds Semantic Versioning to your project
|
|
26
|
+
|
|
27
|
+
Example:
|
|
28
|
+
way_of_working init versioning
|
|
29
|
+
|
|
30
|
+
This will create:
|
|
31
|
+
docs/way_of_working/versioning.md
|
|
32
|
+
LONGDESC
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
data/lib/way_of_working.rb
CHANGED
|
@@ -8,6 +8,21 @@ require 'zeitwerk'
|
|
|
8
8
|
require 'way_of_working/readme_badge'
|
|
9
9
|
|
|
10
10
|
loader = Zeitwerk::Loader.for_gem
|
|
11
|
+
# tasks.rb is a rake-task entrypoint, not a constant definition — exclude it
|
|
12
|
+
# from Zeitwerk's file-to-constant expectations so downstream apps can
|
|
13
|
+
# `require 'way_of_working/tasks'` from their Rakefile.
|
|
14
|
+
loader.ignore(File.expand_path('way_of_working/tasks.rb', __dir__))
|
|
15
|
+
# github_audit_rule.rb is loaded conditionally (only when the
|
|
16
|
+
# way_of_working-audit-github plugin is present — see readme_badge.rb) and
|
|
17
|
+
# requires a constant from that plugin at the top of the file. Exclude it
|
|
18
|
+
# from Zeitwerk's eager-load walk so its absence doesn't break the loader.
|
|
19
|
+
loader.ignore(File.expand_path('way_of_working/changelog/keepachangelog/github_audit_rule.rb', __dir__))
|
|
20
|
+
loader.ignore(File.expand_path('way_of_working/code_of_conduct/contributor_covenant/github_audit_rule.rb', __dir__))
|
|
21
|
+
loader.ignore(File.expand_path('way_of_working/decision_record/madr/github_audit_rule.rb', __dir__))
|
|
22
|
+
loader.ignore(File.expand_path('way_of_working/inclusive_language/alex/github_audit_rule.rb', __dir__))
|
|
23
|
+
loader.ignore(File.expand_path('way_of_working/pull_request_template/hdi/github_audit_rule.rb', __dir__))
|
|
24
|
+
loader.ignore(File.expand_path('way_of_working/readme_badge/github_audit_rule.rb', __dir__))
|
|
25
|
+
loader.ignore(File.expand_path('way_of_working/versioning/semver/github_audit_rule.rb', __dir__))
|
|
11
26
|
loader.setup
|
|
12
27
|
|
|
13
28
|
# This is the namespace for everything associated with the Way of Working
|
data/way_of_working.gemspec
CHANGED
|
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
|
|
|
12
12
|
# spec.description = "TODO: Write a longer description or delete this line."
|
|
13
13
|
spec.homepage = 'https://healthdatainsight.github.io/way_of_working'
|
|
14
14
|
spec.license = 'MIT'
|
|
15
|
-
spec.required_ruby_version = '>=
|
|
15
|
+
spec.required_ruby_version = '>= 3.1'
|
|
16
16
|
|
|
17
17
|
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
|
18
18
|
spec.metadata['rubygems_mfa_required'] = 'true'
|
|
@@ -38,8 +38,11 @@ Gem::Specification.new do |spec|
|
|
|
38
38
|
# For more information and examples about making a new gem, check out our
|
|
39
39
|
# guide at: https://bundler.io/guides/creating_gem.html
|
|
40
40
|
spec.add_dependency 'activesupport'
|
|
41
|
+
spec.add_dependency 'faraday-multipart', '~> 1.0'
|
|
42
|
+
spec.add_dependency 'faraday-retry', '~> 2.2'
|
|
41
43
|
spec.add_dependency 'git', '~> 1.13'
|
|
42
44
|
spec.add_dependency 'nokogiri'
|
|
45
|
+
spec.add_dependency 'octokit', '~> 9.1'
|
|
43
46
|
spec.add_dependency 'rainbow', '~> 3.1'
|
|
44
47
|
spec.add_dependency 'thor', '~> 1.2'
|
|
45
48
|
spec.add_dependency 'zeitwerk', '~> 2.6.18'
|