Skip to content

Commit 08b51c3

Browse files
committed
Link to docs for autobuild failures
1 parent 0f32099 commit 08b51c3

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ public CSharpAutobuildOptions(IBuildActions actions) : base(actions)
3131

3232
public class CSharpAutobuilder : Autobuilder<CSharpAutobuildOptions>
3333
{
34+
private const string buildCommandDocsUrl =
35+
"https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-the-codeql-workflow-for-compiled-languages";
36+
3437
private DotNetRule? dotNetRule;
3538

3639
private MsBuildRule? msBuildRule;
@@ -150,15 +153,15 @@ protected override void AutobuildFailureDiagnostic()
150153
"CodeQL found multiple potential build scripts for your project and " +
151154
$"attempted to run `{buildCommandAutoRule.ScriptPath}`, which failed. " +
152155
"This may not be the right build script for your project. " +
153-
"You can specify which build script to use by providing a suitable build command for your project.";
156+
$"Set up a [manual build command]({buildCommandDocsUrl}).";
154157
}
155158
else
156159
{
157160
message = MakeDiagnostic("script-failure", "Unable to build project using build script");
158161
message.MarkdownMessage =
159162
"CodeQL attempted to build your project using a script located at " +
160163
$"`{buildCommandAutoRule.ScriptPath}`, which failed. " +
161-
"You can manually specify a suitable build command for your project.";
164+
$"Set up a [manual build command]({buildCommandDocsUrl}).";
162165
}
163166

164167
message.Severity = DiagnosticMessage.TspSeverity.Error;
@@ -172,7 +175,7 @@ protected override void AutobuildFailureDiagnostic()
172175
var message = MakeDiagnostic("no-projects-or-solutions", "No project or solutions files found");
173176
message.PlaintextMessage =
174177
"CodeQL could not find any project or solution files in your repository. " +
175-
"You can manually specify a suitable build command for your project.";
178+
$"Set up a [manual build command]({buildCommandDocsUrl}).";
176179
message.Severity = DiagnosticMessage.TspSeverity.Error;
177180

178181
AddDiagnostic(message);
@@ -195,8 +198,7 @@ protected override void AutobuildFailureDiagnostic()
195198
message.MarkdownMessage =
196199
"CodeQL was unable to build the following projects using .NET Core:\n" +
197200
string.Join('\n', dotNetRule.FailedProjectsOrSolutions.Select(p => $"- `{p.FullPath}`")) +
198-
"\nYou can manually specify a suitable build command for your project to exclude these projects " +
199-
"or to ensure that they can be built successfully.";
201+
$"\nSet up a [manual build command]({buildCommandDocsUrl}).";
200202
message.Severity = DiagnosticMessage.TspSeverity.Error;
201203

202204
AddDiagnostic(message);
@@ -209,8 +211,7 @@ protected override void AutobuildFailureDiagnostic()
209211
message.MarkdownMessage =
210212
"CodeQL was unable to build the following projects using MSBuild:\n" +
211213
string.Join('\n', msBuildRule.FailedProjectsOrSolutions.Select(p => $"- `{p.FullPath}`")) +
212-
"\nYou can manually specify a suitable build command for your project to exclude these projects " +
213-
"or to ensure that they can be built successfully.";;
214+
$"\nSet up a [manual build command]({buildCommandDocsUrl}).";
214215
message.Severity = DiagnosticMessage.TspSeverity.Error;
215216

216217
AddDiagnostic(message);

0 commit comments

Comments
 (0)