Skip to content

Commit df4381c

Browse files
address the comments
1 parent 73f0be7 commit df4381c

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

tools/spectral/ipa/__tests__/IPA126TagNamesShouldUseTitleCase.test.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ testRule('xgen-IPA-126-tag-names-should-use-title-case', [
131131
{ name: 'Push-Based Log Export' }, //valid
132132
{ name: 'AWS Clusters DNS' }, // valid
133133
{ name: 'Encryption at Rest using Customer Key Management' },
134+
{ name: '-Test Tag' },
135+
{ name: 'Test Tag-' },
136+
{ name: 'Test Tag -Name' },
134137
],
135138
},
136139
errors: [
@@ -152,6 +155,24 @@ testRule('xgen-IPA-126-tag-names-should-use-title-case', [
152155
path: ['tags', '4'],
153156
severity: DiagnosticSeverity.Warning,
154157
},
158+
{
159+
code: 'xgen-IPA-126-tag-names-should-use-title-case',
160+
message: 'Tag name should use Title Case, found: "-Test Tag".',
161+
path: ['tags', '5'],
162+
severity: DiagnosticSeverity.Warning,
163+
},
164+
{
165+
code: 'xgen-IPA-126-tag-names-should-use-title-case',
166+
message: 'Tag name should use Title Case, found: "Test Tag-".',
167+
path: ['tags', '6'],
168+
severity: DiagnosticSeverity.Warning,
169+
},
170+
{
171+
code: 'xgen-IPA-126-tag-names-should-use-title-case',
172+
message: 'Tag name should use Title Case, found: "Test Tag -Name".',
173+
path: ['tags', '7'],
174+
severity: DiagnosticSeverity.Warning,
175+
},
155176
],
156177
},
157178
]);

tools/spectral/ipa/rulesets/functions/IPA126TagNamesShouldUseTitleCase.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ function isTitleCase(str, ignoreList, grammaticalWords) {
3333
if (wordGroup.includes('-')) {
3434
const hyphenatedParts = wordGroup.split('-');
3535
return hyphenatedParts.every((part) => {
36-
if (part === '') return true; // Skip empty parts
3736
if (ignoreList.includes(part)) return true;
3837
if (grammaticalWords.includes(part)) return true;
3938
// First character should be uppercase, rest lowercase, all alphabetical
@@ -42,7 +41,6 @@ function isTitleCase(str, ignoreList, grammaticalWords) {
4241
}
4342

4443
// For regular words
45-
if (wordGroup === '') return true;
4644
if (ignoreList.includes(wordGroup)) return true;
4745
if (grammaticalWords.includes(wordGroup)) return true;
4846
return /^[A-Z][a-z]*$/.test(wordGroup);

0 commit comments

Comments
 (0)