Skip to content

Commit

Permalink
⚡ Update the CLI to v2022.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
tiulpin committed Jul 3, 2022
1 parent 32c8eba commit 974668a
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 44 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 6 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 2 additions & 6 deletions common/qodana.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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',
Expand Down
5 changes: 1 addition & 4 deletions scan/__tests__/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ function defaultDockerRunCommandFixture(): string[] {
return [
'scan',
'--skip-pull',
'-e',
`QODANA_ENV=github:${VERSION}`,
'--cache-dir',
'${{ runner.temp }}/qodana-caches',
'--results-dir',
Expand All @@ -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())
})
Expand Down
9 changes: 3 additions & 6 deletions scan/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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";
Expand Down Expand Up @@ -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
Expand Down
8 changes: 1 addition & 7 deletions scan/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,9 @@ export function getInputs(): Inputs {
* @returns The qodana command execution output.
*/
export async function qodana(args: string[] = []): Promise<number> {
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, {
Expand Down
13 changes: 6 additions & 7 deletions vsts/QodanaScan/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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";
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -4420,7 +4419,7 @@ var require_utils2 = __commonJS({
});
}
exports2.uploadReport = uploadReport;
function isServer() {
function isServices() {
return tl2.getVariable("SYSTEM_TEAMFOUNDATIONCOLLECTIONURI") !== void 0;
}
}
Expand Down
4 changes: 2 additions & 2 deletions vsts/QodanaScan/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
14 changes: 5 additions & 9 deletions vsts/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,11 @@ export function getInputs(): Inputs {
* @returns The qodana command execution output.
*/
export async function qodana(args: string[] = []): Promise<number> {
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
Expand Down Expand Up @@ -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
}
2 changes: 1 addition & 1 deletion vsts/vss-extension.dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifestVersion": 1,
"id": "qodana-dev",
"name": "Qodana (Dev)",
"version": "1.0.5",
"version": "2022.1.1",
"publisher": "JetBrains",
"targets": [
{
Expand Down
2 changes: 1 addition & 1 deletion vsts/vss-extension.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifestVersion": 1,
"id": "qodana",
"name": "Qodana",
"version": "1.1.0",
"version": "2022.1.1",
"public": true,
"publisher": "JetBrains",
"targets": [
Expand Down

0 comments on commit 974668a

Please sign in to comment.