Skip to content

Commit

Permalink
fix: 'section' -> 'section-heading'
Browse files Browse the repository at this point in the history
  • Loading branch information
sverweij committed May 11, 2024
1 parent b89fc04 commit c225876
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion dist/codeowners/generate.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/virtual-code-owners/parse.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/virtual-code-owners/read.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/codeowners/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function generateLine(
(pCSTLine.inlineComment ? ` #${pCSTLine.inlineComment}` : "")
);
}
if (pCSTLine.type === "section") {
if (pCSTLine.type === "section-heading") {
return (
(pCSTLine.optional ? "^" : "") +
"[" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
raw: "^[optional-section-with-default] @koos-koets",
sectionName: "optional-section-with-default",
spaces: " ",
type: "section",
type: "section-heading",
users:
[
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
raw: "[required-section] @default-user @default-group",
sectionName: "required-section",
spaces: " ",
type: "section",
type: "section-heading",
users:
[
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
raw: "[required-section][42] @default-user @default-group",
sectionName: "required-section",
spaces: " ",
type: "section",
type: "section-heading",
users:
[
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
},
{ "type": "empty", "line": 11, "raw": "" },
{
"type": "section",
"type": "section-heading",
"line": 12,
"optional": false,
"sectionName": "generic stuff",
Expand Down Expand Up @@ -235,7 +235,7 @@
},
{ "type": "empty", "line": 23, "raw": "" },
{
"type": "section",
"type": "section-heading",
"line": 24,
"optional": true,
"sectionName": "non critical stuff",
Expand Down
6 changes: 3 additions & 3 deletions src/virtual-code-owners/cst.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export type IVirtualCodeOwnersCST = IVirtualCodeOwnerLine[];
export type IVirtualCodeOwnerLine = IBoringCSTLine | IInterestingCSTLine;
export type IInterestingCSTLine = IRuleCSTLine | ISectionCSTLine;
export type IInterestingCSTLine = IRuleCSTLine | ISectionHeadingCSTLine;
export interface IBoringCSTLine {
type:
| "comment"
Expand All @@ -20,8 +20,8 @@ export interface IRuleCSTLine {
inlineComment: string;
raw: string;
}
export interface ISectionCSTLine {
type: "section";
export interface ISectionHeadingCSTLine {
type: "section-heading";
line: number;
optional: boolean;
sectionName: string;
Expand Down
6 changes: 3 additions & 3 deletions src/virtual-code-owners/parse.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { EOL } from "node:os";
import type { ITeamMap } from "../team-map/team-map.js";
import type {
ISectionCSTLine,
ISectionHeadingCSTLine,
IUser,
IVirtualCodeOwnerLine,
IVirtualCodeOwnersCST,
Expand Down Expand Up @@ -81,8 +81,8 @@ function parseSection(
raw: pUntreatedLine,
};
}
const lReturnValue: ISectionCSTLine = {
type: "section",
const lReturnValue: ISectionHeadingCSTLine = {
type: "section-heading",
line: pLineNo,
optional: lSection.groups.optionalIndicator === "^",
sectionName: lSection.groups.sectionName as string,
Expand Down
2 changes: 1 addition & 1 deletion src/virtual-code-owners/read.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function reportAnomalies(pFileName: string, pAnomalies: IAnomaly[]): string {
return pAnomalies
.map((pAnomaly) => {
if (pAnomaly.type === "invalid-line") {
return `${pFileName}:${pAnomaly.line}:1 invalid line - neither a rule, section head, comment nor empty: "${pAnomaly.raw}"`;
return `${pFileName}:${pAnomaly.line}:1 invalid line - neither a rule, section heading, comment nor empty: "${pAnomaly.raw}"`;
} else {
return (
`${pFileName}:${pAnomaly.line}:1 invalid user or team name "${pAnomaly.raw}" (#${pAnomaly.userNumberWithinLine} on this line). ` +
Expand Down

0 comments on commit c225876

Please sign in to comment.