Use CircleCI version 2.1 at the top of your .circleci/config.yml file.
1
version: 2.1
Add the orbs
stanza below your version, invoking the orb:
1
2
orbs:
qodana: jetbrains/qodana@2022.2.1
Use qodana
elements in your existing workflows and jobs.
Opt-in to use of uncertified orbs on your organization’s Security settings page.
Scan the project with Qodana.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
version: '2.1'
orbs:
qodana: jetbrains/qodana@2022.2.1
jobs:
code-quality:
machine:
image: ubuntu-2004:current
steps:
- checkout
- qodana/scan
workflows:
main:
jobs:
- code-quality:
context: qodana
Scan a project with Qodana. It runs Qodana `scan` command and reports the results. Note that most options can be configured via qodana.yaml (https://www.jetbrains.com/help/qodana/qodana-yaml.html) file.
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
additional-cache-hash | Allows customizing the generated cache hash. Optional.
| No | << pipeline.git.revision >> | string |
args | Additional Qodana CLI `scan` command arguments (https://github.com/jetbrains/qodana-cli#scan). Optional.
| No | '' | string |
artifact-name | Specify Qodana results artifact name, used for results uploading. Optional.
| No | qodana-report | string |
cache-dir | Directory to store Qodana caches. Optional.
| No | /tmp/cache/qodana | string |
results-dir | Directory to store the analysis results. Optional.
| No | /tmp/qodana/results | string |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# This code is licensed from CircleCI to the user under the MIT license.
# See here for details: https://circleci.com/developer/orbs/licensing
version: 2.1
description: |
⚙️ Scan your Java, Kotlin, PHP, Python, JavaScript, TypeScript projects at CircleCI with Qodana
display:
home_url: https://jetbrains.com/qodana
source_url: https://github.com/JetBrains/qodana-action
commands:
scan:
description: |
Scan a project with Qodana. It runs Qodana `scan` command and reports the results. Note that most options can be configured via qodana.yaml (https://www.jetbrains.com/help/qodana/qodana-yaml.html) file.
parameters:
additional-cache-hash:
default: << pipeline.git.revision >>
description: |
Allows customizing the generated cache hash. Optional.
type: string
args:
default: ""
description: |
Additional Qodana CLI `scan` command arguments (https://github.com/jetbrains/qodana-cli#scan). Optional.
type: string
artifact-name:
default: qodana-report
description: |
Specify Qodana results artifact name, used for results uploading. Optional.
type: string
cache-dir:
default: /tmp/cache/qodana
description: |
Directory to store Qodana caches. Optional.
type: string
results-dir:
default: /tmp/qodana/results
description: |
Directory to store the analysis results. Optional.
type: string
steps:
- restore_cache:
keys:
- qodana-{{ .Branch }}-2022.2.1-<< parameters.additional-cache-hash >>
- qodana-{{ .Branch }}-2022.2.1-
- qodana-{{ .Branch }}-
- qodana-
- run:
command: |
set -e
CLI_DIRECTORY=/tmp/cache/qodana-cli/2022.2.1
mkdir -p $CLI_DIRECTORY
if [[ ! -x "$CLI_DIRECTORY/qodana" ]]; then
curl -fsSL https://jb.gg/qodana-cli/install | bash -s -- \
v2022.2.1 $CLI_DIRECTORY \
1> /dev/null
fi
NONINTERACTIVE=1 $CLI_DIRECTORY/qodana scan \
--cache-dir << parameters.cache-dir >> \
-o << parameters.results-dir >> \
<< parameters.args >>
name: Qodana Scan
- store_artifacts:
destination: << parameters.artifact-name >>
path: << parameters.results-dir >>
- save_cache:
key: qodana-{{ .Branch }}-2022.2.1-<< parameters.additional-cache-hash >>
paths:
- << parameters.cache-dir >>
- /tmp/cache/qodana-cli/
examples:
scan:
description: |
Scan the project with Qodana.
usage:
version: "2.1"
orbs:
qodana: jetbrains/qodana@2022.2.1
jobs:
code-quality:
machine:
image: ubuntu-2004:current
steps:
- checkout
- qodana/scan
workflows:
main:
jobs:
- code-quality:
context: qodana