@@ -134,41 +134,36 @@ protected override void AutobuildFailureDiagnostic()
134134 // otherwise, we just report that the one script we found didn't work
135135 if ( this . buildCommandAutoRule . CandidatePaths . Count ( ) > 1 )
136136 {
137- var source = GetDiagnosticSource ( "multiple-build-scripts" , "There are multiple potential build scripts" ) ;
138- message = new DiagnosticMessage ( source )
139- {
140- MarkdownMessage =
141- "CodeQL found multiple potential build scripts for your project and " +
142- $ "attempted to run `{ buildCommandAutoRule . ScriptPath } `, which failed. " +
143- "This may not be the right build script for your project. " +
144- "You can specify which build script to use by providing a suitable build command for your project."
145- } ;
137+ message = MakeDiagnostic ( "multiple-build-scripts" , "There are multiple potential build scripts" ) ;
138+ message . MarkdownMessage =
139+ "CodeQL found multiple potential build scripts for your project and " +
140+ $ "attempted to run `{ buildCommandAutoRule . ScriptPath } `, which failed. " +
141+ "This may not be the right build script for your project. " +
142+ "You can specify which build script to use by providing a suitable build command for your project." ;
146143 }
147144 else
148145 {
149- var source = GetDiagnosticSource ( "script-failure" , "Unable to build project using build script" ) ;
150- message = new DiagnosticMessage ( source )
151- {
152- MarkdownMessage =
153- "CodeQL attempted to build your project using a script located at " +
154- $ "`{ buildCommandAutoRule . ScriptPath } `, which failed. " +
155- "You can manually specify a suitable build command for your project."
156- } ;
146+ message = MakeDiagnostic ( "script-failure" , "Unable to build project using build script" ) ;
147+ message . MarkdownMessage =
148+ "CodeQL attempted to build your project using a script located at " +
149+ $ "`{ buildCommandAutoRule . ScriptPath } `, which failed. " +
150+ "You can manually specify a suitable build command for your project." ;
157151 }
158152
159153 message . Severity = DiagnosticMessage . TspSeverity . Error ;
160154 Diagnostic ( message ) ;
161155 }
156+
162157 // both dotnet and msbuild builds require project or solution files; if we haven't found any
163158 // then neither of those rules would've worked
164159 if ( this . ProjectsOrSolutionsToBuild . Count == 0 )
165160 {
166- var source = GetDiagnosticSource ( "no-projects-or-solutions" , "No project or solutions files found" ) ;
167- var message = new DiagnosticMessage ( source )
168- {
169- PlaintextMessage = "CodeQL could not find any project or solution files in your repository." ,
170- Severity = DiagnosticMessage . TspSeverity . Error
171- } ;
161+ var message = MakeDiagnostic ( "no-projects-or-solutions" , "No project or solutions files found" ) ;
162+ message . PlaintextMessage = "CodeQL could not find any project or solution files in your repository." ;
163+ message . Severity = DiagnosticMessage . TspSeverity . Error ;
164+
165+ Diagnostic ( message ) ;
166+ }
172167
173168 Diagnostic ( message ) ;
174169 }
0 commit comments