Skip to content

Commit

Permalink
Showing 6 changed files with 21 additions and 18 deletions.
9 changes: 6 additions & 3 deletions lib/analyze.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/analyze.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions lib/config-utils.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/config-utils.js.map

Large diffs are not rendered by default.

11 changes: 6 additions & 5 deletions src/analyze.ts
@@ -167,10 +167,11 @@ export async function runQueries(

const queries = config.queries[language];
const packsWithVersion = config.packs[language] || [];
if (
queries === undefined ||
(queries.builtin.length === 0 && queries.custom.length === 0)
) {

const hasBuiltinQueries = queries?.builtin.length > 0;
const hasCustomQueries = queries?.custom.length > 0;
const hasPackWithCustomQueries = packsWithVersion.length > 0;
if (!hasBuiltinQueries && !hasCustomQueries && !hasPackWithCustomQueries) {
throw new Error(
`Unable to analyse ${language} as no queries were selected for this language`
);
@@ -317,7 +318,7 @@ function packWithVersionToQuerySuiteEntry(
): string {
let text = `- qlpack: ${pack.packName}`;
if (pack.version) {
text += `${"\n"} version: ${pack.version}`;
text += `${"\n"} version: ${pack.version.format()}`;
}
return text;
}
7 changes: 3 additions & 4 deletions src/config-utils.ts
@@ -1156,11 +1156,10 @@ export async function initConfig(
// 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 config.languages) {
const hasBuiltinQueries = config.queries[language]?.builtin.length > 0;
const hasCustomQueries = config.queries[language]?.custom.length > 0;
const hasPacks = config.packs[language]?.length > 0;
const hasQueries =
config.queries[language]?.builtin.length > 0 ||
config.queries[language]?.custom.length > 0;
if (!hasPacks && !hasQueries) {
if (!hasPacks && !hasBuiltinQueries && !hasCustomQueries) {
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."

0 comments on commit 9b5753a

Please sign in to comment.