Skip to content

Commit

Permalink
adding qodana setup
Browse files Browse the repository at this point in the history
  • Loading branch information
niden committed Nov 30, 2023
1 parent 2f15332 commit 680780a
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 1 deletion.
35 changes: 35 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,33 @@ jobs:
run: |
make -j$(getconf _NPROCESSORS_ONLN)
qodana-analysis:
permissions:
contents: read

name: "Qodana Analysis"
runs-on: "ubuntu-22.04"
needs:
- "build-and-test"

steps:
- name: "Checkout"
uses: "actions/checkout@v3"
with:
fetch-depth: 2

- name: "Qodana Analysis"
run: |
docker run \
-p 8080:8080 \
-v $(pwd):/data/project \
-v $(pwd)/res:/data/results/ \
-e QODANA_TOKEN="${{ secrets.QODANA_TOKEN }}" \
jetbrains/qodana-php:latest \
--show-report
//--show-report --baseline=qodana.sarif.json
- name: Upload Code Coverage Report
uses: codecov/codecov-action@v3
with:
Expand All @@ -198,6 +225,14 @@ jobs:
flags: unittests,${{ runner.os }},php-${{ matrix.php }}
name: codecov-umbrella

- name: "Upload to Qodana"
run: |
docker run \
-v $(pwd):/data/project/ \
-v ./tests/output/:/data/coverage \
-e QODANA_TOKEN="${{ secrets.QODANA_TOKEN }}" \
jetbrains/qodana-php
- name: Upload build artifacts after Failure
if: failure()
uses: actions/upload-artifact@v2
Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/qodana_code_quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Qodana
on:
workflow_dispatch:
pull_request:
push:

jobs:
qodana:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: 'Qodana Scan'
uses: JetBrains/[email protected]
env:
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}
37 changes: 37 additions & 0 deletions qodana.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#-------------------------------------------------------------------------------#
# 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: <SomeDisabledInspectionId>
# paths:
# - <path/where/not/run/inspection>

php:
version: 8.0 #(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
exclude:
- name: All
paths:
- vendor
include:
- name: CheckDependencyLicenses
3 changes: 2 additions & 1 deletion src/Operators/Logical/AndOperator.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ private function getAssignmentExpression(CompiledExpression $left, array $expres
'value' => null,
],
default => throw new CompilerException(
$left->getType(), $expression
$left->getType(),
$expression
),
};
}
Expand Down

0 comments on commit 680780a

Please sign in to comment.