Skip to content

Commit 621b78b

Browse files
authored
Merge pull request #61 from sharwell/document-severity
Document severity
2 parents c40a992 + 916d154 commit 621b78b

File tree

3 files changed

+10
-30
lines changed

3 files changed

+10
-30
lines changed

DocumentationAnalyzers/DocumentationAnalyzers.Status.Generator/DocumentationDiagnostic.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ public class DocumentationDiagnostic
2828
public string Name { get; set; }
2929

3030
/// <summary>
31-
/// Gets or sets a value indicating whether the diagnostic is implemented.
31+
/// Gets or sets the default diagnostic severity.
3232
/// </summary>
3333
/// <value>
34-
/// <see langword="true"/> if the diagnostic is implemented; otherwise <see langword="false"/>.
34+
/// The default diagnostic severity.
3535
/// </value>
36-
public bool HasImplementation { get; set; }
36+
public string Severity { get; set; }
3737

3838
/// <summary>
3939
/// Gets or sets a value indicating whether the diagnostic is enabled. This can indicate if the

DocumentationAnalyzers/DocumentationAnalyzers.Status.Generator/SolutionReader.cs

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,6 @@ public async Task<ImmutableList<DocumentationDiagnostic>> GetDiagnosticsAsync()
123123
continue;
124124
}
125125

126-
bool hasImplementation = HasImplementation(syntaxRoot);
127-
128126
IEnumerable<DiagnosticDescriptor> descriptorInfos = GetDescriptor(classSymbol);
129127

130128
foreach (var descriptorInfo in descriptorInfos)
@@ -140,7 +138,7 @@ public async Task<ImmutableList<DocumentationDiagnostic>> GetDiagnosticsAsync()
140138
{
141139
Id = descriptorInfo.Id,
142140
Category = descriptorInfo.Category,
143-
HasImplementation = hasImplementation,
141+
Severity = descriptorInfo.DefaultSeverity.ToString(),
144142
Status = status,
145143
Name = shortName,
146144
Title = descriptorInfo.Title.ToString(),
@@ -156,23 +154,6 @@ public async Task<ImmutableList<DocumentationDiagnostic>> GetDiagnosticsAsync()
156154
return diagnostics.ToImmutable();
157155
}
158156

159-
private static bool HasImplementation(SyntaxNode syntaxRoot)
160-
{
161-
bool hasImplementation = true;
162-
foreach (var trivia in syntaxRoot.DescendantTrivia())
163-
{
164-
if (trivia.IsKind(SyntaxKind.SingleLineCommentTrivia))
165-
{
166-
if (trivia.ToFullString().Contains("TODO: Implement analysis"))
167-
{
168-
hasImplementation = false;
169-
}
170-
}
171-
}
172-
173-
return hasImplementation;
174-
}
175-
176157
private async Task InitializeAsync()
177158
{
178159
_solution = await _workspace.OpenSolutionAsync(SlnPath).ConfigureAwait(false);

docs/index.html

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ <h2>This page is reporting the current status of <a href="https://github.com/Dot
7070
Title
7171
</td>
7272
<td>
73-
Has Implementation
73+
Severity
7474
</td>
7575
<td>
7676
Status
@@ -91,15 +91,11 @@ <h2>This page is reporting the current status of <a href="https://github.com/Dot
9191
</div>
9292

9393
<script id="diagnostic-color" type="text/x-jsrender">
94-
{{if HasImplementation}}
9594
{{if Status !== "DisabledNoTests"}}
9695
success
9796
{{else}}
9897
warning
9998
{{/if}}
100-
{{else }}
101-
danger
102-
{{/if}}
10399
</script>
104100

105101
<script id="diagnostic" type="text/x-jsrender">
@@ -114,7 +110,7 @@ <h2>This page is reporting the current status of <a href="https://github.com/Dot
114110
{{>Title}}
115111
</td>
116112
<td>
117-
{{>HasImplementation}}
113+
{{>Severity}}
118114
</td>
119115
<td>
120116
{{>Status}}
@@ -173,7 +169,10 @@ <h3>Commit information</h3>
173169
</script>
174170

175171
<script type="text/javascript">
176-
$.getJSON("https://ci.appveyor.com/api/projects/sharwell/Documentationanalyzers/artifacts/DocumentationAnalyzers.Status.json?branch=master&pr=false&stream=true&job=Configuration:%20Release", function (data) {
172+
var urlParams = new URLSearchParams(window.location.search);
173+
var branch = urlParams.get('branch') || 'master';
174+
var pr = urlParams.get('pr') === 'true' ? 'true' : 'false';
175+
$.getJSON(`https://ci.appveyor.com/api/projects/sharwell/Documentationanalyzers/artifacts/DocumentationAnalyzers.Status.json?branch=${branch}&pr=${pr}&stream=true&job=Configuration:%20Release`, function (data) {
177176
$("#renderedDiagnostics").html($.templates($("#diagnostics").html()).render(data));
178177
$("#renderedCommitInfo").html($.templates($("#commitInfo").html()).render(data.git));
179178
});

0 commit comments

Comments
 (0)