Skip to content

Commit ad80214

Browse files
author
DKravtsov
committed
Added Qodana code quality tool integration.
1 parent 2e7d864 commit ad80214

File tree

4 files changed

+58
-3
lines changed

4 files changed

+58
-3
lines changed

.github/workflows/ci.yml

+16-3
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,8 @@ on:
1313
types: [published]
1414

1515
jobs:
16-
1716
build:
18-
1917
runs-on: ubuntu-latest
20-
2118
steps:
2219
- uses: actions/checkout@v1
2320
- name: Build the docker images
@@ -48,3 +45,19 @@ jobs:
4845
run: make phpinsights
4946
- name: Stop the docker images
5047
run: make stop-test
48+
qodana:
49+
runs-on: ubuntu-latest
50+
needs: build
51+
permissions:
52+
contents: write
53+
pull-requests: write
54+
checks: write
55+
steps:
56+
- uses: actions/checkout@v3
57+
with:
58+
ref: ${{ github.event.pull_request.head.sha }} # to check out the actual pull request commit, not the merge commit
59+
fetch-depth: 0 # a full history is required for pull request analysis
60+
- name: 'Qodana Scan'
61+
uses: JetBrains/[email protected]
62+
env:
63+
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}

docs/development.md

+7
Original file line numberDiff line numberDiff line change
@@ -143,3 +143,10 @@ make ssh
143143
vendor/bin/rector process app/your_folder_with_code_for_refactoring
144144
```
145145
Note: You can process rector without specifying folder, in such case it will process app and tests folder.
146+
147+
## Qodana (trial)
148+
Qodana is a smart code quality platform by JetBrains. This powerful static analysis engine enables development teams to automate code reviews, build quality gates, and enforce code quality guidelines enterprise-wide – all within their JetBrains ecosystems.
149+
The platform can be integrated into any CI/CD pipeline and can analyze code.
150+
151+
If you are using IDE PHPStorm, you can use it via menu `Tools` -> `Qodana` -> `Try Code Analysis with Qodana` -> `Try Locally` -> `Run`.
152+
You can find some video [here](https://blog.jetbrains.com/qodana/2023/09/code-quality-under-pressure-supporting-developers-with-qodana-integration-in-intellij-based-ides/) or more info [here](https://www.jetbrains.com/help/qodana/getting-started.html).

docs/phpstorm.md

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ This document describing how you can configure your IDE [PhpStorm](https://www.j
1313
- String Manipulation
1414
- Extra ToolWindow Colorful Icons
1515
* Go to `Settings -> Php -> Laravel` and check `Enable plugin for this project`.
16+
* If you want control quality of your project - pay your attention to tools, described [here](development.md) and `Qodana` tool.
1617

1718
### CLI Interpreter
1819
You need to set correct CLI interpreter for your PhpStorm.
@@ -92,3 +93,4 @@ For inspecting your code you can use main menu item `Code -> Inspect Code`. Code
9293
* [Laravel Development using PhpStorm](https://blog.jetbrains.com/phpstorm/2015/01/laravel-development-using-phpstorm/)
9394
* [Laravel Plugin plugin for PhpStorm](https://plugins.jetbrains.com/plugin/7532-laravel)
9495
* [Php Inspections (EA Extended) plugin for PhpStorm](https://plugins.jetbrains.com/idea/plugin/7622-php-inspections-ea-extended-)
96+
* [Qodana code quality tool](https://blog.jetbrains.com/qodana/2023/09/code-quality-under-pressure-supporting-developers-with-qodana-integration-in-intellij-based-ides/)

qodana.yaml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#-------------------------------------------------------------------------------#
2+
# Qodana analysis is configured by qodana.yaml file #
3+
# https://www.jetbrains.com/help/qodana/qodana-yaml.html #
4+
#-------------------------------------------------------------------------------#
5+
version: "1.0"
6+
7+
#Specify inspection profile for code analysis
8+
profile:
9+
name: qodana.recommended
10+
11+
#Enable inspections
12+
#include:
13+
# - name: <SomeEnabledInspectionId>
14+
15+
#Disable inspections
16+
exclude:
17+
- name: All
18+
paths:
19+
- reports
20+
- tools
21+
22+
php:
23+
version: 8.2 #(Applied in CI/CD pipeline)
24+
25+
#Execute shell command before Qodana execution (Applied in CI/CD pipeline)
26+
#bootstrap: sh ./prepare-qodana.sh
27+
28+
#Install IDE plugins before Qodana execution (Applied in CI/CD pipeline)
29+
#plugins:
30+
# - id: <plugin.id> #(plugin id can be found at https://plugins.jetbrains.com)
31+
32+
#Specify Qodana linter for analysis (Applied in CI/CD pipeline)
33+
linter: jetbrains/qodana-php:latest

0 commit comments

Comments
 (0)