Skip to content

Commit 720eed3

Browse files
authored
Merge pull request github#12523 from github/henrymercer/polish-diagnostics
Polish diagnostic messages
2 parents bc9942e + fe34ec1 commit 720eed3

File tree

26 files changed

+58
-68
lines changed

26 files changed

+58
-68
lines changed

csharp/autobuilder/Semmle.Autobuild.CSharp/CSharpAutobuilder.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ protected override void AutobuildFailureDiagnostic()
104104
markdownMessage:
105105
"CodeQL found multiple potential build scripts for your project and " +
106106
$"attempted to run `{relScriptPath}`, which failed. " +
107-
"This may not be the right build script for your project. " +
107+
"This may not be the right build script for your project.\n\n" +
108108
$"Set up a [manual build command]({buildCommandDocsUrl})."
109109
) :
110110
new(
@@ -113,7 +113,7 @@ protected override void AutobuildFailureDiagnostic()
113113
"Unable to build project using build script",
114114
markdownMessage:
115115
"CodeQL attempted to build your project using a script located at " +
116-
$"`{relScriptPath}`, which failed. " +
116+
$"`{relScriptPath}`, which failed.\n\n" +
117117
$"Set up a [manual build command]({buildCommandDocsUrl})."
118118
);
119119

@@ -135,7 +135,7 @@ protected override void AutobuildFailureDiagnostic()
135135
"no-projects-or-solutions",
136136
"No project or solutions files found",
137137
markdownMessage:
138-
"CodeQL could not find any project or solution files in your repository. " +
138+
"CodeQL could not find any project or solution files in your repository.\n\n" +
139139
$"Set up a [manual build command]({buildCommandDocsUrl})."
140140
));
141141
}

csharp/autobuilder/Semmle.Autobuild.CSharp/CSharpDiagnosticClassifier.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ public Result()
8484
This may lead to subsequent failures. You can check for common causes for missing project files:
8585
8686
- Ensure that the project is built using the {runsOnDocsUrl.ToMarkdownLink("intended operating system")} and that filenames on case-sensitive platforms are correctly specified.
87-
- If your repository uses Git submodules, ensure that those are {checkoutDocsUrl.ToMarkdownLink("checked out")} before the CodeQL action is run.
88-
- If you auto-generate some project files as part of your build process, ensure that these are generated before the CodeQL action is run.
87+
- If your repository uses Git submodules, ensure that those are {checkoutDocsUrl.ToMarkdownLink("checked out")} before the CodeQL Action is run.
88+
- If you auto-generate some project files as part of your build process, ensure that these are generated before the CodeQL Action is run.
8989
"""
9090
);
9191
}

csharp/extractor/Semmle.Util/ToolStatusPage.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ public TspLocation(string? file = null, int? startLine = null, int? startColumn
151151
/// </summary>
152152
public bool Internal { get; }
153153
public TspVisibility Visibility { get; }
154-
public TspLocation Location { get; }
154+
public TspLocation? Location { get; }
155155
/// <summary>
156156
/// Structured metadata about the diagnostic message.
157157
/// </summary>
@@ -173,7 +173,7 @@ public DiagnosticMessage(
173173
this.Attributes = new Dictionary<string, object>();
174174
this.Severity = severity;
175175
this.Visibility = visibility ?? TspVisibility.All;
176-
this.Location = location ?? new TspLocation();
176+
this.Location = location;
177177
this.Internal = intrnl ?? false;
178178
this.MarkdownMessage = markdownMessage;
179179
this.PlaintextMessage = plaintextMessage;

csharp/ql/integration-tests/all-platforms/diag_dotnet_incompatible/diagnostics.expected

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"attributes": {},
33
"helpLinks": [],
44
"internal": false,
5-
"location": {},
65
"markdownMessage": "CodeQL found some projects which cannot be built with .NET Core:\n\n- `test.csproj`",
76
"severity": "warning",
87
"source": {
@@ -20,7 +19,6 @@
2019
"attributes": {},
2120
"helpLinks": [],
2221
"internal": false,
23-
"location": {},
2422
"markdownMessage": "CodeQL was unable to build the following projects using MSBuild:\n\n- `test.csproj`\n\nSet up a [manual build command](https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-the-codeql-workflow-for-compiled-languages).",
2523
"severity": "error",
2624
"source": {

csharp/ql/integration-tests/all-platforms/diag_missing_project_files/diagnostics.expected

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"attributes": {},
33
"helpLinks": [],
44
"internal": false,
5-
"location": {},
65
"markdownMessage": "CodeQL was unable to build the following projects using MSBuild:\n\n- `test.sln`\n\nSet up a [manual build command](https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-the-codeql-workflow-for-compiled-languages).",
76
"severity": "error",
87
"source": {
@@ -20,8 +19,7 @@
2019
"attributes": {},
2120
"helpLinks": [],
2221
"internal": false,
23-
"location": {},
24-
"markdownMessage": "Some project files were not found when CodeQL built your project:\n\n- `Example.csproj`\n- `Example.Test.csproj`\n\nThis may lead to subsequent failures. You can check for common causes for missing project files:\n\n- Ensure that the project is built using the [intended operating system](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idruns-on) and that filenames on case-sensitive platforms are correctly specified.\n- If your repository uses Git submodules, ensure that those are [checked out](https://github.com/actions/checkout#usage) before the CodeQL action is run.\n- If you auto-generate some project files as part of your build process, ensure that these are generated before the CodeQL action is run.",
22+
"markdownMessage": "Some project files were not found when CodeQL built your project:\n\n- `Example.csproj`\n- `Example.Test.csproj`\n\nThis may lead to subsequent failures. You can check for common causes for missing project files:\n\n- Ensure that the project is built using the [intended operating system](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idruns-on) and that filenames on case-sensitive platforms are correctly specified.\n- If your repository uses Git submodules, ensure that those are [checked out](https://github.com/actions/checkout#usage) before the CodeQL Action is run.\n- If you auto-generate some project files as part of your build process, ensure that these are generated before the CodeQL Action is run.",
2523
"severity": "error",
2624
"source": {
2725
"extractorName": "csharp",

csharp/ql/integration-tests/all-platforms/diag_missing_xamarin_sdk/diagnostics.expected

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"attributes": {},
33
"helpLinks": [],
44
"internal": false,
5-
"location": {},
65
"markdownMessage": "CodeQL was unable to build the following projects using .NET Core:\n\n- `test.csproj`\n\nSet up a [manual build command](https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-the-codeql-workflow-for-compiled-languages).",
76
"severity": "error",
87
"source": {
@@ -20,7 +19,6 @@
2019
"attributes": {},
2120
"helpLinks": [],
2221
"internal": false,
23-
"location": {},
2422
"markdownMessage": "CodeQL was unable to build the following projects using MSBuild:\n\n- `test.csproj`\n\nSet up a [manual build command](https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-the-codeql-workflow-for-compiled-languages).",
2523
"severity": "error",
2624
"source": {
@@ -38,7 +36,6 @@
3836
"attributes": {},
3937
"helpLinks": [],
4038
"internal": false,
41-
"location": {},
4239
"markdownMessage": "[Configure your workflow](https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-xamarin-applications) for this SDK before running CodeQL.",
4340
"severity": "error",
4441
"source": {

csharp/ql/integration-tests/posix-only/diag_autobuild_script/diagnostics.expected

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
"attributes": {},
33
"helpLinks": [],
44
"internal": false,
5-
"location": {},
6-
"markdownMessage": "CodeQL attempted to build your project using a script located at `build.sh`, which failed. Set up a [manual build command](https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-the-codeql-workflow-for-compiled-languages).",
5+
"markdownMessage": "CodeQL attempted to build your project using a script located at `build.sh`, which failed.\n\nSet up a [manual build command](https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-the-codeql-workflow-for-compiled-languages).",
76
"severity": "error",
87
"source": {
98
"extractorName": "csharp",
@@ -20,8 +19,7 @@
2019
"attributes": {},
2120
"helpLinks": [],
2221
"internal": false,
23-
"location": {},
24-
"markdownMessage": "CodeQL could not find any project or solution files in your repository. Set up a [manual build command](https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-the-codeql-workflow-for-compiled-languages).",
22+
"markdownMessage": "CodeQL could not find any project or solution files in your repository.\n\nSet up a [manual build command](https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-the-codeql-workflow-for-compiled-languages).",
2523
"severity": "error",
2624
"source": {
2725
"extractorName": "csharp",

csharp/ql/integration-tests/posix-only/diag_multiple_scripts/diagnostics.expected

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
"attributes": {},
33
"helpLinks": [],
44
"internal": false,
5-
"location": {},
6-
"markdownMessage": "CodeQL could not find any project or solution files in your repository. Set up a [manual build command](https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-the-codeql-workflow-for-compiled-languages).",
5+
"markdownMessage": "CodeQL could not find any project or solution files in your repository.\n\nSet up a [manual build command](https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-the-codeql-workflow-for-compiled-languages).",
76
"severity": "error",
87
"source": {
98
"extractorName": "csharp",
@@ -20,8 +19,7 @@
2019
"attributes": {},
2120
"helpLinks": [],
2221
"internal": false,
23-
"location": {},
24-
"markdownMessage": "CodeQL found multiple potential build scripts for your project and attempted to run `build.sh`, which failed. This may not be the right build script for your project. Set up a [manual build command](https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-the-codeql-workflow-for-compiled-languages).",
22+
"markdownMessage": "CodeQL found multiple potential build scripts for your project and attempted to run `build.sh`, which failed. This may not be the right build script for your project.\n\nSet up a [manual build command](https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-the-codeql-workflow-for-compiled-languages).",
2523
"severity": "error",
2624
"source": {
2725
"extractorName": "csharp",

csharp/ql/integration-tests/windows-only/diag_autobuild_script/diagnostics.expected

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
"attributes": {},
33
"helpLinks": [],
44
"internal": false,
5-
"location": {},
6-
"markdownMessage": "CodeQL attempted to build your project using a script located at `build.bat`, which failed. Set up a [manual build command](https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-the-codeql-workflow-for-compiled-languages).",
5+
"markdownMessage": "CodeQL attempted to build your project using a script located at `build.bat`, which failed.\n\nSet up a [manual build command](https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-the-codeql-workflow-for-compiled-languages).",
76
"severity": "error",
87
"source": {
98
"extractorName": "csharp",
@@ -20,8 +19,7 @@
2019
"attributes": {},
2120
"helpLinks": [],
2221
"internal": false,
23-
"location": {},
24-
"markdownMessage": "CodeQL could not find any project or solution files in your repository. Set up a [manual build command](https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-the-codeql-workflow-for-compiled-languages).",
22+
"markdownMessage": "CodeQL could not find any project or solution files in your repository.\n\nSet up a [manual build command](https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-the-codeql-workflow-for-compiled-languages).",
2523
"severity": "error",
2624
"source": {
2725
"extractorName": "csharp",

csharp/ql/integration-tests/windows-only/diag_multiple_scripts/diagnostics.expected

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
"attributes": {},
33
"helpLinks": [],
44
"internal": false,
5-
"location": {},
6-
"markdownMessage": "CodeQL could not find any project or solution files in your repository. Set up a [manual build command](https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-the-codeql-workflow-for-compiled-languages).",
5+
"markdownMessage": "CodeQL could not find any project or solution files in your repository.\n\nSet up a [manual build command](https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-the-codeql-workflow-for-compiled-languages).",
76
"severity": "error",
87
"source": {
98
"extractorName": "csharp",
@@ -20,8 +19,7 @@
2019
"attributes": {},
2120
"helpLinks": [],
2221
"internal": false,
23-
"location": {},
24-
"markdownMessage": "CodeQL found multiple potential build scripts for your project and attempted to run `build.bat`, which failed. This may not be the right build script for your project. Set up a [manual build command](https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-the-codeql-workflow-for-compiled-languages).",
22+
"markdownMessage": "CodeQL found multiple potential build scripts for your project and attempted to run `build.bat`, which failed. This may not be the right build script for your project.\n\nSet up a [manual build command](https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-the-codeql-workflow-for-compiled-languages).",
2523
"severity": "error",
2624
"source": {
2725
"extractorName": "csharp",

0 commit comments

Comments
 (0)