Skip to content

Commit 9a22527

Browse files
committed
Favor 'scope' & 'sub-scope' vs 'area' & 'sub-area'
The convention of commitlint upstream documentation is to refer to the text that goes before the ':' in the title as the **type(scope)**, but we called it **area(sub-area)** (also allowed to be written with a slash: **area/sub-area**). There was no point to really use a different word for it so, from now on, we will refer to it as scope as well. But we still don't use type, just scope and sub-scope.
1 parent f38e746 commit 9a22527

File tree

4 files changed

+39
-39
lines changed

4 files changed

+39
-39
lines changed

WorkflowGuidelines.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ script, or this technique manually: https://stackoverflow.com/a/3230241/544947
4141
* Git commit messages should follow this style:
4242

4343
```
44-
Area/Sub-area: short title of what is changed (50 chars max)
44+
Scope/sub-scope: short title of what is changed (50 chars max)
4545
4646
Explanation of **why** (and maybe **how** as well, in case there's a part of
4747
the change that is not self-explanatory). Don't hesitate to be very verbose
@@ -58,11 +58,11 @@ has a title at the top which is normally a short sentence (but not ended with a
5858
dot, like most titles), and a body that starts in the 3rd line and which contains
5959
one or many paragraphs (each ending with a dot, as it's text in prose). In
6060
particular, the example above would be for a commit message that fixes the
61-
issue #45. **Area** usually refers to the project name, but without the need
61+
issue #45. **Scope** usually refers to the project name, but without the need
6262
to include the name of the project (e.g. in geewallet, all project names start
6363
with the `GWallet.` prefix, then there's no need to specify it; so use `Backend`
64-
as area instead of `GWallet.Backend`). The **Sub-area** may refer to a folder
65-
or module inside the area, but it's not a strict mapping.
64+
as scope instead of `GWallet.Backend`). The **Sub-scope** may refer to a folder
65+
or module inside what's represented as the scope, but it's not a strict mapping.
6666

6767
When referencing a bug/issue, as you can see above you can add a sentence at the
6868
end of the commit message which starts with `Fixes `, followed by the **full URL**

commitlint.config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ module.exports = {
5353
// * Title should not have dot at the end.
5454
// * Workflow: detect if wip commit in a branch not named "wip/*" or whose name contains "squashed".
5555
// * Detect if commit hash mention in commit msg actually exists in repo.
56-
// * Detect area(sub-area) in the title that doesn't include area part (e.g., writing (bar) instead of foo(bar))
56+
// * Detect scope(sub-scope) in the title that doesn't include scope part (e.g., writing (bar) instead of foo(bar))
5757

5858
{
5959
rules: {

commitlint/plugins.test.ts

+15-15
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ test("header-max-length-with-suggestions10", () => {
613613

614614
test("header-max-length-with-suggestions11", () => {
615615
let commitMsgThatExceedsHeaderMaxLength =
616-
"area: 20 characters more because blah blah very very very very long title";
616+
"scope: 20 characters more because blah blah very very very very long title";
617617
let headerMaxLength11 = runCommitLintOnMsg(
618618
commitMsgThatExceedsHeaderMaxLength
619619
);
@@ -690,20 +690,20 @@ test("subject-lowercase4", () => {
690690
});
691691

692692
test("subject-lowercase5", () => {
693-
let commitMsgWithRareCharInArea1 = "foo.bar: Baz";
694-
let subjectLowerCase5 = runCommitLintOnMsg(commitMsgWithRareCharInArea1);
693+
let commitMsgWithRareCharInScope1 = "foo.bar: Baz";
694+
let subjectLowerCase5 = runCommitLintOnMsg(commitMsgWithRareCharInScope1);
695695
expect(subjectLowerCase5.status).not.toBe(0);
696696
});
697697

698698
test("subject-lowercase6", () => {
699-
let commitMsgWithRareCharInArea2 = "foo-bar: Baz";
700-
let subjectLowerCase6 = runCommitLintOnMsg(commitMsgWithRareCharInArea2);
699+
let commitMsgWithRareCharInScope2 = "foo-bar: Baz";
700+
let subjectLowerCase6 = runCommitLintOnMsg(commitMsgWithRareCharInScope2);
701701
expect(subjectLowerCase6.status).not.toBe(0);
702702
});
703703

704704
test("subject-lowercase7", () => {
705-
let commitMsgWithRareCharInArea3 = "foo,bar: Baz";
706-
let subjectLowerCase7 = runCommitLintOnMsg(commitMsgWithRareCharInArea3);
705+
let commitMsgWithRareCharInScope3 = "foo,bar: Baz";
706+
let subjectLowerCase7 = runCommitLintOnMsg(commitMsgWithRareCharInScope3);
707707
expect(subjectLowerCase7.status).not.toBe(0);
708708
});
709709

@@ -731,26 +731,26 @@ test("subject-lowercase10", () => {
731731
});
732732

733733
test("title-uppercase1", () => {
734-
let commitMsgWithoutArea = "remove logs";
735-
let titleUpperCase1 = runCommitLintOnMsg(commitMsgWithoutArea);
734+
let commitMsgWithoutScope = "remove logs";
735+
let titleUpperCase1 = runCommitLintOnMsg(commitMsgWithoutScope);
736736
expect(titleUpperCase1.status).not.toBe(0);
737737
});
738738

739739
test("title-uppercase2", () => {
740-
let commitMsgWithoutArea = "Remove logs";
741-
let titleUpperCase2 = runCommitLintOnMsg(commitMsgWithoutArea);
740+
let commitMsgWithoutScope = "Remove logs";
741+
let titleUpperCase2 = runCommitLintOnMsg(commitMsgWithoutScope);
742742
expect(titleUpperCase2.status).toBe(0);
743743
});
744744

745745
test("title-uppercase3", () => {
746-
let commitMsgWithoutArea = "testFixtureSetup refactor";
747-
let titleUpperCase3 = runCommitLintOnMsg(commitMsgWithoutArea);
746+
let commitMsgWithoutScope = "testFixtureSetup refactor";
747+
let titleUpperCase3 = runCommitLintOnMsg(commitMsgWithoutScope);
748748
expect(titleUpperCase3.status).toBe(0);
749749
});
750750

751751
test("title-uppercase4", () => {
752-
let commitMsgWithLowerCaseArea = "lowercase: area is lowercase";
753-
let titleUpperCase4 = runCommitLintOnMsg(commitMsgWithLowerCaseArea);
752+
let commitMsgWithLowerCaseScope = "lowercase: scope is lowercase";
753+
let titleUpperCase4 = runCommitLintOnMsg(commitMsgWithLowerCaseScope);
754754
expect(titleUpperCase4.status).toBe(0);
755755
});
756756

commitlint/plugins.ts

+19-19
Original file line numberDiff line numberDiff line change
@@ -128,16 +128,16 @@ export abstract class Plugins {
128128

129129
let colonIndex = headerStr.indexOf(":");
130130

131-
let titleWithoutArea = headerStr;
131+
let titleWithoutScope = headerStr;
132132
if (colonIndex > 0) {
133-
titleWithoutArea = headerStr.substring(colonIndex);
133+
titleWithoutScope = headerStr.substring(colonIndex);
134134
}
135135

136136
let numRecomendations = 0;
137-
let lowerCaseTitleWithoutArea = titleWithoutArea.toLowerCase();
137+
let lowerCaseTitleWithoutScope = titleWithoutScope.toLowerCase();
138138
Object.entries(abbr).forEach(([key, value]) => {
139139
let pattern = new RegExp("\\b(" + key.toString() + ")\\b");
140-
if (pattern.test(lowerCaseTitleWithoutArea)) {
140+
if (pattern.test(lowerCaseTitleWithoutScope)) {
141141
if (numRecomendations === 0) {
142142
message =
143143
message +
@@ -239,15 +239,15 @@ export abstract class Plugins {
239239

240240
let colonIndex = headerStr.indexOf(":");
241241
if (colonIndex >= 0) {
242-
let areaOrScope = headerStr.substring(0, colonIndex);
243-
if (areaOrScope.includes("\\")) {
242+
let scope = headerStr.substring(0, colonIndex);
243+
if (scope.includes("\\")) {
244244
offence = true;
245245
}
246246
}
247247

248248
return [
249249
!offence,
250-
`Please use slash instead of backslash in the area/scope/sub-area section of the title.` +
250+
`Please use slash instead of backslash in the scope/sub-scope section of the title.` +
251251
Helpers.errMessageSuffix,
252252
];
253253
}
@@ -280,7 +280,7 @@ export abstract class Plugins {
280280
!Helpers.isProperNoun(firstWord);
281281
return [
282282
!offence,
283-
`Please start the title with an uppercase letter if you haven't specified any area/scope.` +
283+
`Please start the title with an uppercase letter if you haven't specified any scope.` +
284284
Helpers.errMessageSuffix,
285285
];
286286
}
@@ -318,7 +318,7 @@ export abstract class Plugins {
318318

319319
return [
320320
!offence,
321-
`Please use "area/scope: subject" or "area(scope): subject" style instead of wrapping area/scope under square brackets in your commit message title` +
321+
`Please use "scope/sub-scope: subject" or "scope(scope): subject" style instead of wrapping the scope details under square brackets in your commit message title` +
322322
Helpers.errMessageSuffix,
323323
];
324324
}
@@ -339,7 +339,7 @@ export abstract class Plugins {
339339

340340
return [
341341
!offence,
342-
`Please use lowercase as the first letter for your subject, i.e. the text after your area/scope (note: there is a chance that this rule is yielding a false positive in case the word '${firstWord}' is a name and must be capitalized; in which case please just reword the subject to make this word not be the first, sorry).` +
342+
`Please use lowercase as the first letter for your subject, i.e. the text after your scope (note: there is a chance that this rule is yielding a false positive in case the word '${firstWord}' is a name and must be capitalized; in which case please just reword the subject to make this word not be the first, sorry).` +
343343
Helpers.errMessageSuffix,
344344
];
345345
}
@@ -350,20 +350,20 @@ export abstract class Plugins {
350350
let colonIndex = headerStr.indexOf(":");
351351

352352
if (colonIndex >= 0) {
353-
let areaOrScope = headerStr.substring(0, colonIndex);
354-
let commaIndex = areaOrScope.indexOf(",");
353+
let scope = headerStr.substring(0, colonIndex);
354+
let commaIndex = scope.indexOf(",");
355355
while (commaIndex >= 0) {
356-
if (areaOrScope[commaIndex + 1] === " ") {
356+
if (scope[commaIndex + 1] === " ") {
357357
offence = true;
358358
}
359-
areaOrScope = areaOrScope.substring(commaIndex + 1);
360-
commaIndex = areaOrScope.indexOf(",");
359+
scope = scope.substring(commaIndex + 1);
360+
commaIndex = scope.indexOf(",");
361361
}
362362
}
363363

364364
return [
365365
!offence,
366-
`No need to use space after comma in the area/scope (so that commit title can be shorter).` +
366+
`No need to use space after comma in the scope (so that commit title can be shorter).` +
367367
Helpers.errMessageSuffix,
368368
];
369369
}
@@ -462,8 +462,8 @@ export abstract class Plugins {
462462

463463
let colonIndex = headerStr.indexOf(":");
464464
if (colonIndex >= 0) {
465-
let areaOrScope = headerStr.substring(0, colonIndex);
466-
let parenIndex = areaOrScope.indexOf("(");
465+
let scope = headerStr.substring(0, colonIndex);
466+
let parenIndex = scope.indexOf("(");
467467
if (parenIndex >= 1) {
468468
if (headerStr[parenIndex - 1] === " ") {
469469
offence = true;
@@ -473,7 +473,7 @@ export abstract class Plugins {
473473

474474
return [
475475
!offence,
476-
`No need to use space before parentheses in the area/scope/sub-area section of the title.` +
476+
`No need to use space before parentheses in the scope/sub-scope section of the title.` +
477477
Helpers.errMessageSuffix,
478478
];
479479
}

0 commit comments

Comments
 (0)