Skip to content

Commit 821a770

Browse files
committed
Read and parse quality-queries input
1 parent ea6f9fe commit 821a770

File tree

9 files changed

+106
-22
lines changed

9 files changed

+106
-22
lines changed

lib/config-utils.js

Lines changed: 8 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/config-utils.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/config-utils.test.js

Lines changed: 33 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/config-utils.test.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/init-action.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/init-action.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/config-utils.test.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ function createTestInitConfigInputs(
4747
{
4848
languagesInput: undefined,
4949
queriesInput: undefined,
50+
qualityQueriesInput: undefined,
5051
packsInput: undefined,
5152
configFile: undefined,
5253
dbLocation: undefined,
@@ -806,6 +807,7 @@ const calculateAugmentationMacro = test.macro({
806807
_title: string,
807808
rawPacksInput: string | undefined,
808809
rawQueriesInput: string | undefined,
810+
rawQualityQueriesInput: string | undefined,
809811
languages: Language[],
810812
expectedAugmentationProperties: configUtils.AugmentationProperties,
811813
) => {
@@ -815,6 +817,7 @@ const calculateAugmentationMacro = test.macro({
815817
createFeatures([]),
816818
rawPacksInput,
817819
rawQueriesInput,
820+
rawQualityQueriesInput,
818821
languages,
819822
mockLogger,
820823
);
@@ -828,10 +831,12 @@ test(
828831
"All empty",
829832
undefined,
830833
undefined,
834+
undefined,
831835
[Language.javascript],
832836
{
833837
queriesInputCombines: false,
834838
queriesInput: undefined,
839+
qualityQueriesInput: undefined,
835840
packsInputCombines: false,
836841
packsInput: undefined,
837842
defaultQueryFilters: [],
@@ -843,10 +848,12 @@ test(
843848
"With queries",
844849
undefined,
845850
" a, b , c, d",
851+
undefined,
846852
[Language.javascript],
847853
{
848854
queriesInputCombines: false,
849855
queriesInput: [{ uses: "a" }, { uses: "b" }, { uses: "c" }, { uses: "d" }],
856+
qualityQueriesInput: undefined,
850857
packsInputCombines: false,
851858
packsInput: undefined,
852859
defaultQueryFilters: [],
@@ -858,10 +865,34 @@ test(
858865
"With queries combining",
859866
undefined,
860867
" + a, b , c, d ",
868+
undefined,
861869
[Language.javascript],
862870
{
863871
queriesInputCombines: true,
864872
queriesInput: [{ uses: "a" }, { uses: "b" }, { uses: "c" }, { uses: "d" }],
873+
qualityQueriesInput: undefined,
874+
packsInputCombines: false,
875+
packsInput: undefined,
876+
defaultQueryFilters: [],
877+
} as configUtils.AugmentationProperties,
878+
);
879+
880+
test(
881+
calculateAugmentationMacro,
882+
"With quality queries",
883+
undefined,
884+
undefined,
885+
" a, b , c, d",
886+
[Language.javascript],
887+
{
888+
queriesInputCombines: false,
889+
queriesInput: undefined,
890+
qualityQueriesInput: [
891+
{ uses: "a" },
892+
{ uses: "b" },
893+
{ uses: "c" },
894+
{ uses: "d" },
895+
],
865896
packsInputCombines: false,
866897
packsInput: undefined,
867898
defaultQueryFilters: [],
@@ -873,10 +904,12 @@ test(
873904
"With packs",
874905
" codeql/a , codeql/b , codeql/c , codeql/d ",
875906
undefined,
907+
undefined,
876908
[Language.javascript],
877909
{
878910
queriesInputCombines: false,
879911
queriesInput: undefined,
912+
qualityQueriesInput: undefined,
880913
packsInputCombines: false,
881914
packsInput: ["codeql/a", "codeql/b", "codeql/c", "codeql/d"],
882915
defaultQueryFilters: [],
@@ -888,10 +921,12 @@ test(
888921
"With packs combining",
889922
" + codeql/a, codeql/b, codeql/c, codeql/d",
890923
undefined,
924+
undefined,
891925
[Language.javascript],
892926
{
893927
queriesInputCombines: false,
894928
queriesInput: undefined,
929+
qualityQueriesInput: undefined,
895930
packsInputCombines: true,
896931
packsInput: ["codeql/a", "codeql/b", "codeql/c", "codeql/d"],
897932
defaultQueryFilters: [],
@@ -904,6 +939,7 @@ const calculateAugmentationErrorMacro = test.macro({
904939
_title: string,
905940
rawPacksInput: string | undefined,
906941
rawQueriesInput: string | undefined,
942+
rawQualityQueriesInput: string | undefined,
907943
languages: Language[],
908944
expectedError: RegExp | string,
909945
) => {
@@ -914,6 +950,7 @@ const calculateAugmentationErrorMacro = test.macro({
914950
createFeatures([]),
915951
rawPacksInput,
916952
rawQueriesInput,
953+
rawQualityQueriesInput,
917954
languages,
918955
mockLogger,
919956
),
@@ -928,6 +965,7 @@ test(
928965
"Plus (+) with nothing else (queries)",
929966
undefined,
930967
" + ",
968+
undefined,
931969
[Language.javascript],
932970
/The workflow property "queries" is invalid/,
933971
);
@@ -937,6 +975,7 @@ test(
937975
"Plus (+) with nothing else (packs)",
938976
" + ",
939977
undefined,
978+
undefined,
940979
[Language.javascript],
941980
/The workflow property "packs" is invalid/,
942981
);
@@ -946,6 +985,7 @@ test(
946985
"Packs input with multiple languages",
947986
" + a/b, c/d ",
948987
undefined,
988+
undefined,
949989
[Language.javascript, Language.java],
950990
/Cannot specify a 'packs' input in a multi-language analysis/,
951991
);
@@ -955,6 +995,7 @@ test(
955995
"Packs input with no languages",
956996
" + a/b, c/d ",
957997
undefined,
998+
undefined,
958999
[],
9591000
/No languages specified/,
9601001
);
@@ -964,6 +1005,7 @@ test(
9641005
"Invalid packs",
9651006
" a-pack-without-a-scope ",
9661007
undefined,
1008+
undefined,
9671009
[Language.javascript],
9681010
/"a-pack-without-a-scope" is not a valid pack/,
9691011
);

0 commit comments

Comments
 (0)