Skip to content

Document severity #61

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ public class DocumentationDiagnostic
public string Name { get; set; }

/// <summary>
/// Gets or sets a value indicating whether the diagnostic is implemented.
/// Gets or sets the default diagnostic severity.
/// </summary>
/// <value>
/// <see langword="true"/> if the diagnostic is implemented; otherwise <see langword="false"/>.
/// The default diagnostic severity.
/// </value>
public bool HasImplementation { get; set; }
public string Severity { get; set; }

/// <summary>
/// Gets or sets a value indicating whether the diagnostic is enabled. This can indicate if the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,6 @@ public async Task<ImmutableList<DocumentationDiagnostic>> GetDiagnosticsAsync()
continue;
}

bool hasImplementation = HasImplementation(syntaxRoot);

IEnumerable<DiagnosticDescriptor> descriptorInfos = GetDescriptor(classSymbol);

foreach (var descriptorInfo in descriptorInfos)
Expand All @@ -140,7 +138,7 @@ public async Task<ImmutableList<DocumentationDiagnostic>> GetDiagnosticsAsync()
{
Id = descriptorInfo.Id,
Category = descriptorInfo.Category,
HasImplementation = hasImplementation,
Severity = descriptorInfo.DefaultSeverity.ToString(),
Status = status,
Name = shortName,
Title = descriptorInfo.Title.ToString(),
Expand All @@ -156,23 +154,6 @@ public async Task<ImmutableList<DocumentationDiagnostic>> GetDiagnosticsAsync()
return diagnostics.ToImmutable();
}

private static bool HasImplementation(SyntaxNode syntaxRoot)
{
bool hasImplementation = true;
foreach (var trivia in syntaxRoot.DescendantTrivia())
{
if (trivia.IsKind(SyntaxKind.SingleLineCommentTrivia))
{
if (trivia.ToFullString().Contains("TODO: Implement analysis"))
{
hasImplementation = false;
}
}
}

return hasImplementation;
}

private async Task InitializeAsync()
{
_solution = await _workspace.OpenSolutionAsync(SlnPath).ConfigureAwait(false);
Expand Down
13 changes: 6 additions & 7 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ <h2>This page is reporting the current status of <a href="https://github.com/Dot
Title
</td>
<td>
Has Implementation
Severity
</td>
<td>
Status
Expand All @@ -91,15 +91,11 @@ <h2>This page is reporting the current status of <a href="https://github.com/Dot
</div>

<script id="diagnostic-color" type="text/x-jsrender">
{{if HasImplementation}}
{{if Status !== "DisabledNoTests"}}
success
{{else}}
warning
{{/if}}
{{else }}
danger
{{/if}}
</script>

<script id="diagnostic" type="text/x-jsrender">
Expand All @@ -114,7 +110,7 @@ <h2>This page is reporting the current status of <a href="https://github.com/Dot
{{>Title}}
</td>
<td>
{{>HasImplementation}}
{{>Severity}}
</td>
<td>
{{>Status}}
Expand Down Expand Up @@ -173,7 +169,10 @@ <h3>Commit information</h3>
</script>

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