Skip to content

Commit 08b1e38

Browse files
committed
feat: Change none -> suggestions in "temporary suppressions" part
1 parent fac267d commit 08b1e38

File tree

2 files changed

+17
-22
lines changed

2 files changed

+17
-22
lines changed

src/Atc.CodingRules.Updater.CLI/ProjectHelper.cs

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -284,15 +284,15 @@ private static async Task<bool> BuildAndCollectErrorsAgainAndUpdateFile(
284284
" ");
285285

286286
hasFoundNewErrors = buildResultNextRun.Count > 0;
287-
foreach (var item in buildResultNextRun)
287+
foreach (var (key, value) in buildResultNextRun)
288288
{
289-
if (buildResult.ContainsKey(item.Key))
289+
if (buildResult.ContainsKey(key))
290290
{
291-
buildResult[item.Key] = buildResult[item.Key] + item.Value;
291+
buildResult[key] += value;
292292
}
293293
else
294294
{
295-
buildResult.Add(item.Key, item.Value);
295+
buildResult.Add(key, value);
296296
}
297297
}
298298
}
@@ -495,8 +495,8 @@ private static void HandleSuppressionLinesForKnownAnalyzerRules(
495495
{
496496
var tabs = CalculateTabIndentationForSuppressionLine(rule.Code.Length);
497497
var suppressionLine = string.IsNullOrEmpty(rule.Category)
498-
? $"dotnet_diagnostic.{code}.severity = none{tabs}# {count.Pluralize("occurrence")}{rule.TitleAndLink}"
499-
: $"dotnet_diagnostic.{code}.severity = none{tabs}# {count.Pluralize("occurrence")} - Category: '{rule.Category}'{rule.TitleAndLink}";
498+
? $"dotnet_diagnostic.{code}.severity = suggestion{tabs}# {count.Pluralize("occurrence")}{rule.TitleAndLink}"
499+
: $"dotnet_diagnostic.{code}.severity = suggestion{tabs}# {count.Pluralize("occurrence")} - Category: '{rule.Category}'{rule.TitleAndLink}";
500500
suppressionLines.Add(Tuple.Create(analyzerProvider.Name, suppressionLine));
501501
handledCodes.Add(code);
502502
}
@@ -517,7 +517,7 @@ private static void HandleSuppressionLinesForUnknownAnalyzerRules(
517517
}
518518

519519
var tabs = CalculateTabIndentationForSuppressionLine(code.Length);
520-
var suppressionLine = $"dotnet_diagnostic.{code}.severity = none{tabs}# {count.Pluralize("occurrence")}";
520+
var suppressionLine = $"dotnet_diagnostic.{code}.severity = suggestion{tabs}# {count.Pluralize("occurrence")}";
521521
suppressionLines.Add(Tuple.Create("Unknown", suppressionLine));
522522
}
523523
}
@@ -527,21 +527,14 @@ private static string CalculateTabIndentationForSuppressionLine(
527527
{
528528
var tabs = codeLength switch
529529
{
530-
2 => "\t\t\t\t\t",
531-
3 => "\t\t\t\t",
532-
4 => "\t\t\t\t",
533-
5 => "\t\t\t\t",
534-
6 => "\t\t\t",
535-
7 => "\t\t\t",
536-
8 => "\t\t\t",
537-
9 => "\t\t\t",
538-
10 => "\t\t\t",
539-
11 => "\t\t",
540-
12 => "\t\t",
541-
13 => "\t\t",
542-
14 => "\t\t",
543-
15 => "\t",
544-
_ => "\t\t\t"
530+
1 => "\t\t\t",
531+
2 => "\t\t\t",
532+
3 => "\t\t\t",
533+
4 => "\t\t",
534+
5 => "\t\t",
535+
6 => "\t\t",
536+
7 => "\t\t",
537+
_ => "\t"
545538
};
546539

547540
return tabs;

src/Atc.CodingRules.Updater/EditorConfigHelper.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,8 @@ public static Task UpdateRootFileAddCustomAtcAutogeneratedRuleSuppressions(
154154
var rawFileData = FileHelper.ReadAllText(rootEditorConfigFile);
155155
var lines = rawFileData.Split(FileHelper.LineBreaks, StringSplitOptions.None).ToList();
156156

157+
lines.Add(string.Empty);
158+
lines.Add(string.Empty);
157159
lines.Add(SectionDivider);
158160
lines.Add(AutogeneratedCustomSectionHeaderPrefix);
159161
lines.Add($"# generated @ {DateTime.Now:F}");

0 commit comments

Comments
 (0)