Skip to content

Commit c521eaa

Browse files
tadeleshtadelesh
andauthored
Change Go rule for tspconfig.yaml (#36368)
* Change Go rule for tspconfig.yaml * rename * fix format * remove rules --------- Co-authored-by: tadelesh <[email protected]>
1 parent a8e0cfa commit c521eaa

File tree

2 files changed

+9
-37
lines changed

2 files changed

+9
-37
lines changed

eng/tools/typespec-validation/src/rules/sdk-tspconfig-validation.ts

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -387,15 +387,6 @@ export class TspConfigGoMgmtModuleEqualStringSubRule extends TspconfigEmitterOpt
387387
}
388388
}
389389

390-
export class TspConfigGoMgmtFixConstStutteringTrueSubRule extends TspconfigEmitterOptionsSubRuleBase {
391-
constructor() {
392-
super("@azure-tools/typespec-go", "fix-const-stuttering", true);
393-
}
394-
protected skip(_: any, folder: string) {
395-
return skipForDataPlane(folder);
396-
}
397-
}
398-
399390
export class TspConfigGoMgmtGenerateSamplesTrueSubRule extends TspconfigEmitterOptionsSubRuleBase {
400391
constructor() {
401392
super("@azure-tools/typespec-go", "generate-samples", true);
@@ -414,13 +405,17 @@ export class TspConfigGoMgmtHeadAsBooleanTrueSubRule extends TspconfigEmitterOpt
414405
}
415406
}
416407

417-
// ----- Go az sub rules -----
418-
export class TspConfigGoAzGenerateFakesTrueSubRule extends TspconfigEmitterOptionsSubRuleBase {
408+
export class TspConfigGoMgmtGenerateFakesTrueSubRule extends TspconfigEmitterOptionsSubRuleBase {
419409
constructor() {
420410
super("@azure-tools/typespec-go", "generate-fakes", true);
421411
}
412+
protected skip(_: any, folder: string) {
413+
return skipForDataPlane(folder);
414+
}
422415
}
423416

417+
// ----- Go az sub rules -----
418+
424419
export class TspConfigGoAzInjectSpansTrueSubRule extends TspconfigEmitterOptionsSubRuleBase {
425420
constructor() {
426421
super("@azure-tools/typespec-go", "inject-spans", true);
@@ -539,9 +534,8 @@ export const defaultRules = [
539534
new TspConfigGoMgmtServiceDirMatchPatternSubRule(),
540535
new TspConfigGoMgmtPackageDirectorySubRule(),
541536
new TspConfigGoMgmtModuleEqualStringSubRule(),
542-
new TspConfigGoMgmtFixConstStutteringTrueSubRule(),
543537
new TspConfigGoMgmtGenerateSamplesTrueSubRule(),
544-
new TspConfigGoAzGenerateFakesTrueSubRule(),
538+
new TspConfigGoMgmtGenerateFakesTrueSubRule(),
545539
new TspConfigGoMgmtHeadAsBooleanTrueSubRule(),
546540
new TspConfigGoAzInjectSpansTrueSubRule(),
547541
new TspConfigGoDpServiceDirMatchPatternSubRule(),

eng/tools/typespec-validation/test/sdk-tspconfig-validation.test.ts

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,11 @@ import {
1111
TspConfigCsharpAzNamespaceEqualStringSubRule,
1212
TspConfigCsharpAzPackageDirectorySubRule,
1313
TspConfigCsharpMgmtPackageDirectorySubRule,
14-
TspConfigGoAzGenerateFakesTrueSubRule,
1514
TspConfigGoAzInjectSpansTrueSubRule,
1615
TspConfigGoDpModuleMatchPatternSubRule,
1716
TspConfigGoDpPackageDirectoryMatchPatternSubRule,
1817
TspConfigGoDpServiceDirMatchPatternSubRule,
19-
TspConfigGoMgmtFixConstStutteringTrueSubRule,
18+
TspConfigGoMgmtGenerateFakesTrueSubRule,
2019
TspConfigGoMgmtGenerateSamplesTrueSubRule,
2120
TspConfigGoMgmtHeadAsBooleanTrueSubRule,
2221
TspConfigGoMgmtModuleEqualStringSubRule,
@@ -287,15 +286,6 @@ const goManagementModuleTestCases = createEmitterOptionTestCases(
287286
[new TspConfigGoMgmtModuleEqualStringSubRule()],
288287
);
289288

290-
const goManagementFixConstStutteringTestCases = createEmitterOptionTestCases(
291-
"@azure-tools/typespec-go",
292-
managementTspconfigFolder,
293-
"fix-const-stuttering",
294-
true,
295-
false,
296-
[new TspConfigGoMgmtFixConstStutteringTrueSubRule()],
297-
);
298-
299289
const goManagementGenerateExamplesTestCases = createEmitterOptionTestCases(
300290
"@azure-tools/typespec-go",
301291
managementTspconfigFolder,
@@ -311,16 +301,7 @@ const goManagementGenerateFakesTestCases = createEmitterOptionTestCases(
311301
"generate-fakes",
312302
true,
313303
false,
314-
[new TspConfigGoAzGenerateFakesTrueSubRule()],
315-
);
316-
317-
const goDpGenerateFakesTestCases = createEmitterOptionTestCases(
318-
"@azure-tools/typespec-go",
319-
"",
320-
"generate-fakes",
321-
true,
322-
false,
323-
[new TspConfigGoAzGenerateFakesTrueSubRule()],
304+
[new TspConfigGoMgmtGenerateFakesTrueSubRule()],
324305
);
325306

326307
const goManagementHeadAsBooleanTestCases = createEmitterOptionTestCases(
@@ -619,7 +600,6 @@ options:
619600
subRules: [
620601
new TspConfigGoMgmtPackageDirectorySubRule(),
621602
new TspConfigGoMgmtModuleEqualStringSubRule(),
622-
new TspConfigGoMgmtFixConstStutteringTrueSubRule(),
623603
],
624604
tspconfigContent: `
625605
options:
@@ -661,12 +641,10 @@ describe("tspconfig", function () {
661641
...goManagementServiceDirTestCases,
662642
...goManagementPackageDirTestCases,
663643
...goManagementModuleTestCases,
664-
...goManagementFixConstStutteringTestCases,
665644
...goManagementGenerateExamplesTestCases,
666645
...goManagementGenerateFakesTestCases,
667646
...goManagementHeadAsBooleanTestCases,
668647
...goManagementInjectSpansTestCases,
669-
...goDpGenerateFakesTestCases,
670648
...goDpInjectSpansTestCases,
671649
...goDpModuleTestCases,
672650
...goDpPackageDirTestCases,

0 commit comments

Comments
 (0)