Skip to content

Commit

Permalink
Added Qodana code quality tool integration.
Browse files Browse the repository at this point in the history
  • Loading branch information
DKravtsov committed Sep 27, 2023
1 parent 2e7d864 commit ad80214
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 3 deletions.
19 changes: 16 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,8 @@ on:
types: [published]

jobs:

build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- name: Build the docker images
Expand Down Expand Up @@ -48,3 +45,19 @@ jobs:
run: make phpinsights
- name: Stop the docker images
run: make stop-test
qodana:
runs-on: ubuntu-latest
needs: build
permissions:
contents: write
pull-requests: write
checks: write
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }} # to check out the actual pull request commit, not the merge commit
fetch-depth: 0 # a full history is required for pull request analysis
- name: 'Qodana Scan'
uses: JetBrains/[email protected]
env:
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}
7 changes: 7 additions & 0 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,10 @@ make ssh
vendor/bin/rector process app/your_folder_with_code_for_refactoring
```
Note: You can process rector without specifying folder, in such case it will process app and tests folder.

## Qodana (trial)
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.
The platform can be integrated into any CI/CD pipeline and can analyze code.

If you are using IDE PHPStorm, you can use it via menu `Tools` -> `Qodana` -> `Try Code Analysis with Qodana` -> `Try Locally` -> `Run`.
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).
2 changes: 2 additions & 0 deletions docs/phpstorm.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ This document describing how you can configure your IDE [PhpStorm](https://www.j
- String Manipulation
- Extra ToolWindow Colorful Icons
* Go to `Settings -> Php -> Laravel` and check `Enable plugin for this project`.
* If you want control quality of your project - pay your attention to tools, described [here](development.md) and `Qodana` tool.

### CLI Interpreter
You need to set correct CLI interpreter for your PhpStorm.
Expand Down Expand Up @@ -92,3 +93,4 @@ For inspecting your code you can use main menu item `Code -> Inspect Code`. Code
* [Laravel Development using PhpStorm](https://blog.jetbrains.com/phpstorm/2015/01/laravel-development-using-phpstorm/)
* [Laravel Plugin plugin for PhpStorm](https://plugins.jetbrains.com/plugin/7532-laravel)
* [Php Inspections (EA Extended) plugin for PhpStorm](https://plugins.jetbrains.com/idea/plugin/7622-php-inspections-ea-extended-)
* [Qodana code quality tool](https://blog.jetbrains.com/qodana/2023/09/code-quality-under-pressure-supporting-developers-with-qodana-integration-in-intellij-based-ides/)
33 changes: 33 additions & 0 deletions qodana.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#-------------------------------------------------------------------------------#
# Qodana analysis is configured by qodana.yaml file #
# https://www.jetbrains.com/help/qodana/qodana-yaml.html #
#-------------------------------------------------------------------------------#
version: "1.0"

#Specify inspection profile for code analysis
profile:
name: qodana.recommended

#Enable inspections
#include:
# - name: <SomeEnabledInspectionId>

#Disable inspections
exclude:
- name: All
paths:
- reports
- tools

php:
version: 8.2 #(Applied in CI/CD pipeline)

#Execute shell command before Qodana execution (Applied in CI/CD pipeline)
#bootstrap: sh ./prepare-qodana.sh

#Install IDE plugins before Qodana execution (Applied in CI/CD pipeline)
#plugins:
# - id: <plugin.id> #(plugin id can be found at https://plugins.jetbrains.com)

#Specify Qodana linter for analysis (Applied in CI/CD pipeline)
linter: jetbrains/qodana-php:latest

0 comments on commit ad80214

Please sign in to comment.