diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index bd489a7e..cdedeaf6 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -52,7 +52,9 @@ jobs: - uses: actions/checkout@v3 - uses: ./ with: - args: --linter,jetbrains/qodana-js + args: --linter,jetbrains/qodana-js,--print-problems,--log-level,debug + env: + QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }} # Not possible at the moment for GitHub-hosted Windows agents: https://github.com/JetBrains/qodana-action/pull/31#issue-812728409 # test-windows: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8e1dc075..7bd68108 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -26,6 +26,12 @@ Install all dependencies: cd common && npm install && cd ../scan && npm install && cd ../vsts && npm install ``` +Run everything in all subprojects: + +```sh +cd scan && npm run all && cd ../vsts && npm run all && cd ../ +``` + ### GitHub action `cd` into the project directory (the only action available for now is Qodana Scan) and install project dependencies: diff --git a/common/qodana.ts b/common/qodana.ts index 6bc04f2f..eef93a70 100644 --- a/common/qodana.ts +++ b/common/qodana.ts @@ -1,6 +1,6 @@ // noinspection JSUnusedGlobalSymbols -export const VERSION = '1.1.0' +export const VERSION = '2022.1.1' export const EXECUTABLE = 'qodana' export const FAIL_THRESHOLD_OUTPUT = 'The number of problems exceeds the failThreshold' @@ -100,20 +100,16 @@ export function getQodanaPullArgs(args: string[]): string[] { * @param args additional CLI arguments. * @param resultsDir the directory to store the results. * @param cacheDir the directory to store the cache. - * @param env QODANA_ENV value. * @returns The `qodana scan` command arguments. */ export function getQodanaScanArgs( args: string[], resultsDir: string, - cacheDir: string, - env = `cli` + cacheDir: string ): string[] { const cliArgs: string[] = [ 'scan', '--skip-pull', - '-e', - `QODANA_ENV=${env}:${VERSION}`, '--cache-dir', cacheDir, '--results-dir', diff --git a/scan/__tests__/main.test.ts b/scan/__tests__/main.test.ts index a6272f67..df15cb60 100644 --- a/scan/__tests__/main.test.ts +++ b/scan/__tests__/main.test.ts @@ -74,8 +74,6 @@ function defaultDockerRunCommandFixture(): string[] { return [ 'scan', '--skip-pull', - '-e', - `QODANA_ENV=github:${VERSION}`, '--cache-dir', '${{ runner.temp }}/qodana-caches', '--results-dir', @@ -90,8 +88,7 @@ test('qodana scan command args', () => { const result = getQodanaScanArgs( inputs.args, inputs.resultsDir, - inputs.cacheDir, - 'github' + inputs.cacheDir ) expect(result).toEqual(defaultDockerRunCommandFixture()) }) diff --git a/scan/dist/index.js b/scan/dist/index.js index 333c42a0..2265298b 100644 --- a/scan/dist/index.js +++ b/scan/dist/index.js @@ -1902,12 +1902,10 @@ function getQodanaPullArgs(args) { } return pullArgs; } -function getQodanaScanArgs(args, resultsDir, cacheDir, env = `cli`) { +function getQodanaScanArgs(args, resultsDir, cacheDir) { const cliArgs = [ "scan", "--skip-pull", - "-e", - `QODANA_ENV=${env}:${VERSION}`, "--cache-dir", cacheDir, "--results-dir", @@ -1921,7 +1919,7 @@ function getQodanaScanArgs(args, resultsDir, cacheDir, env = `cli`) { var VERSION, EXECUTABLE, FAIL_THRESHOLD_OUTPUT, QODANA_SARIF_NAME, QodanaExitCode; var init_qodana = __esm({ "../common/qodana.ts"() { - VERSION = "1.1.0"; + VERSION = "2022.1.1"; EXECUTABLE = "qodana"; FAIL_THRESHOLD_OUTPUT = "The number of problems exceeds the failThreshold"; QODANA_SARIF_NAME = "qodana.sarif.json"; @@ -68173,10 +68171,9 @@ var require_utils5 = __commonJS({ exports2.getInputs = getInputs; function qodana(args = []) { return __awaiter2(this, void 0, void 0, function* () { - const env = isServer() ? "github-enterprise" : "github"; if (args.length === 0) { const inputs = getInputs(); - args = (0, qodana_12.getQodanaScanArgs)(inputs.args, inputs.resultsDir, inputs.cacheDir, env); + args = (0, qodana_12.getQodanaScanArgs)(inputs.args, inputs.resultsDir, inputs.cacheDir); } return (yield exec.getExecOutput(qodana_12.EXECUTABLE, args, { ignoreReturnCode: true diff --git a/scan/src/utils.ts b/scan/src/utils.ts index af098ef9..68c40fa2 100644 --- a/scan/src/utils.ts +++ b/scan/src/utils.ts @@ -111,15 +111,9 @@ export function getInputs(): Inputs { * @returns The qodana command execution output. */ export async function qodana(args: string[] = []): Promise { - const env = isServer() ? 'github-enterprise' : 'github' if (args.length === 0) { const inputs = getInputs() - args = getQodanaScanArgs( - inputs.args, - inputs.resultsDir, - inputs.cacheDir, - env - ) + args = getQodanaScanArgs(inputs.args, inputs.resultsDir, inputs.cacheDir) } return ( await exec.getExecOutput(EXECUTABLE, args, { diff --git a/vsts/QodanaScan/index.js b/vsts/QodanaScan/index.js index 9d275a52..2d5cfc20 100644 --- a/vsts/QodanaScan/index.js +++ b/vsts/QodanaScan/index.js @@ -82,12 +82,10 @@ function getQodanaPullArgs(args) { } return pullArgs; } -function getQodanaScanArgs(args, resultsDir, cacheDir, env = `cli`) { +function getQodanaScanArgs(args, resultsDir, cacheDir) { const cliArgs = [ "scan", "--skip-pull", - "-e", - `QODANA_ENV=${env}:${VERSION}`, "--cache-dir", cacheDir, "--results-dir", @@ -101,7 +99,7 @@ function getQodanaScanArgs(args, resultsDir, cacheDir, env = `cli`) { var VERSION, EXECUTABLE, FAIL_THRESHOLD_OUTPUT, QODANA_SARIF_NAME, QodanaExitCode; var init_qodana = __esm({ "../common/qodana.ts"() { - VERSION = "1.1.0"; + VERSION = "2022.1.1"; EXECUTABLE = "qodana"; FAIL_THRESHOLD_OUTPUT = "The number of problems exceeds the failThreshold"; QODANA_SARIF_NAME = "qodana.sarif.json"; @@ -4373,10 +4371,11 @@ var require_utils2 = __commonJS({ exports2.getInputs = getInputs; function qodana(args = []) { return __awaiter2(this, void 0, void 0, function* () { - const env = isServer() ? "azure-server" : "azure-services"; + const env = isServices() ? "azure-services" : "azure-server"; if (args.length === 0) { const inputs = getInputs(); - args = (0, qodana_12.getQodanaScanArgs)(inputs.args, inputs.resultsDir, inputs.cacheDir, env); + args = (0, qodana_12.getQodanaScanArgs)(inputs.args, inputs.resultsDir, inputs.cacheDir); + args.push("-e", `QODANA_ENV=${env}:${qodana_12.VERSION}`); } return tl2.exec(qodana_12.EXECUTABLE, args, { ignoreReturnCode: true @@ -4420,7 +4419,7 @@ var require_utils2 = __commonJS({ }); } exports2.uploadReport = uploadReport; - function isServer() { + function isServices() { return tl2.getVariable("SYSTEM_TEAMFOUNDATIONCOLLECTIONURI") !== void 0; } } diff --git a/vsts/QodanaScan/task.json b/vsts/QodanaScan/task.json index ca7c1b5f..d2c2c229 100644 --- a/vsts/QodanaScan/task.json +++ b/vsts/QodanaScan/task.json @@ -8,9 +8,9 @@ "category": "Utility", "author": "JetBrains", "version": { - "Major": 1, + "Major": 2022, "Minor": 1, - "Patch": 0 + "Patch": 1 }, "demands": ["RemoteDockerServerOS -equals linux"], "instanceNameFormat": "Qodana Scan", diff --git a/vsts/src/utils.ts b/vsts/src/utils.ts index f15e9078..93b0f4b8 100644 --- a/vsts/src/utils.ts +++ b/vsts/src/utils.ts @@ -44,15 +44,11 @@ export function getInputs(): Inputs { * @returns The qodana command execution output. */ export async function qodana(args: string[] = []): Promise { - const env = isServer() ? 'azure-server' : 'azure-services' + const env = isServices() ? 'azure-services' : 'azure-server' if (args.length === 0) { const inputs = getInputs() - args = getQodanaScanArgs( - inputs.args, - inputs.resultsDir, - inputs.cacheDir, - env - ) + args = getQodanaScanArgs(inputs.args, inputs.resultsDir, inputs.cacheDir) + args.push('-e', `QODANA_ENV=${env}:${VERSION}`) } return tl.exec(EXECUTABLE, args, { ignoreReturnCode: true @@ -106,8 +102,8 @@ export async function uploadReport( } /** - * Check if the pipeline is run on Azure DevOps Server. + * Check if the pipeline is run on Azure DevOps Services. */ -function isServer(): boolean { +function isServices(): boolean { return tl.getVariable('SYSTEM_TEAMFOUNDATIONCOLLECTIONURI') !== undefined } diff --git a/vsts/vss-extension.dev.json b/vsts/vss-extension.dev.json index f553d98b..55784b8e 100644 --- a/vsts/vss-extension.dev.json +++ b/vsts/vss-extension.dev.json @@ -2,7 +2,7 @@ "manifestVersion": 1, "id": "qodana-dev", "name": "Qodana (Dev)", - "version": "1.0.5", + "version": "2022.1.1", "publisher": "JetBrains", "targets": [ { diff --git a/vsts/vss-extension.json b/vsts/vss-extension.json index cdd51499..145b9b52 100644 --- a/vsts/vss-extension.json +++ b/vsts/vss-extension.json @@ -2,7 +2,7 @@ "manifestVersion": 1, "id": "qodana", "name": "Qodana", - "version": "1.1.0", + "version": "2022.1.1", "public": true, "publisher": "JetBrains", "targets": [