-
Notifications
You must be signed in to change notification settings - Fork 357
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
Ensure queries[language] objects are initialized #518
Conversation
src/config-utils.ts
Outdated
@@ -760,6 +760,14 @@ export async function getDefaultConfig( | |||
logger | |||
); | |||
const queries: Queries = {}; | |||
for (const language of languages) { | |||
if (queries[language] === undefined) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't this always be true? The queries
variable has just been defined to be {}
.
So in this case, all the requisite codeql suites exist (i.e. Another thing to consider to make the error message better is there's a chunk of code at the end of // The list of queries should not be empty for any language. If it is then
// it is a user configuration error.
for (const language of languages) {
if (
queries[language] === undefined ||
(queries[language].builtin.length === 0 &&
queries[language].custom.length === 0)
) {
throw new Error(
`Did not detect any queries to run for ${language}. ` +
"Please make sure that the default queries are enabled, or you are specifying queries to run."
);
}
} If you move that to |
@robertbrignull Exactly. We don't have any queries yet that match the default query selectors. |
5612390
to
17cf5fc
Compare
@robertbrignull Thanks for the quick review. I addressed your comments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Should be fine
) { | ||
throw new Error( | ||
`Did not detect any queries to run for ${language}. ` + | ||
"Please make sure that the default queries are enabled, or you are specifying queries to run." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could change this error message to be more accurate for the case of ruby, but also I assume this situation of having empty suites will be temporary so it doesn't matter too much.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, indeed. The important thing is that the Action no long crashes with an undefined property
error.
491900c
to
74c4fa0
Compare
74c4fa0
to
6a14acc
Compare
This PR improves the CodeQL action in case a query suite is used that contains no queries. This is a bit of a corner case and resulted in an error like
no property 'builtin' for 'undefined'
instead of the more friendly messageUnable to analyse ruby as no queries were selected for this language
Merge / deployment checklist