mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-05 17:18:13 +01:00
QUAL phpstan github action
This commit is contained in:
3
.gitattributes
vendored
3
.gitattributes
vendored
@@ -3,7 +3,7 @@
|
|||||||
* text=auto
|
* text=auto
|
||||||
|
|
||||||
|
|
||||||
# Explicitly declare text files we want to always be normalized and converted
|
# Explicitly declare text files we want to always be normalized and converted
|
||||||
# to native line endings on checkout.
|
# to native line endings on checkout.
|
||||||
*.php text eol=lf
|
*.php text eol=lf
|
||||||
*.pl text eol=lf
|
*.pl text eol=lf
|
||||||
@@ -21,6 +21,7 @@
|
|||||||
*.yml text eol=lf
|
*.yml text eol=lf
|
||||||
*.yaml text eol=lf
|
*.yaml text eol=lf
|
||||||
*.conf text eol=lf
|
*.conf text eol=lf
|
||||||
|
*.neon text eol=lf
|
||||||
|
|
||||||
.bash_aliases text eol=lf
|
.bash_aliases text eol=lf
|
||||||
|
|
||||||
|
|||||||
60
.github/workflows/phpstan.yml
vendored
Normal file
60
.github/workflows/phpstan.yml
vendored
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
# This is a basic workflow to check code with PHPSTAN tool
|
||||||
|
|
||||||
|
name: PHPSTAN
|
||||||
|
|
||||||
|
# Controls when the workflow will run
|
||||||
|
on:
|
||||||
|
# Triggers the workflow on pull request events but only for the develop branch
|
||||||
|
pull_request:
|
||||||
|
branches: [ develop ]
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
||||||
|
jobs:
|
||||||
|
# This workflow contains a single job called "build"
|
||||||
|
build:
|
||||||
|
# The type of runner that the job will run on
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
php-version:
|
||||||
|
- "7.1"
|
||||||
|
- "8.2"
|
||||||
|
# Steps represent a sequence of tasks that will be executed as part of the job
|
||||||
|
steps:
|
||||||
|
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Setup PHP
|
||||||
|
id: setup-php
|
||||||
|
uses: shivammathur/setup-php@v2
|
||||||
|
with:
|
||||||
|
php-version: "${{ matrix.php-version }}"
|
||||||
|
tools: phpstan, cs2pr
|
||||||
|
extensions: calendar, json, imagick, gd, zip, mbstring, intl, opcache, imap, mysql, pgsql, sqlite3, ldap, xml
|
||||||
|
- uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 14.x
|
||||||
|
registry-url: 'https://registry.npmjs.org'
|
||||||
|
- name: Restore phpstan cache
|
||||||
|
uses: actions/cache/restore@v3
|
||||||
|
with:
|
||||||
|
path: ./tmp
|
||||||
|
key: "phpstan-cache-PR-${{ matrix.php-version }}-${{ github.run_id }}"
|
||||||
|
restore-keys: |
|
||||||
|
phpstan-cache-PR-${{ matrix.php-version }}-
|
||||||
|
- name: Debug
|
||||||
|
run: cd ./tmp && ls -al
|
||||||
|
- name: Run PHPSTAN
|
||||||
|
run: phpstan -vvv analyse --error-format=checkstyle --memory-limit 4G -c phpstan_action.neon | cs2pr --graceful-warnings
|
||||||
|
continue-on-error: true
|
||||||
|
- name: "Save phpstan cache"
|
||||||
|
uses: actions/cache/save@v3
|
||||||
|
if: always()
|
||||||
|
with:
|
||||||
|
path: ./tmp
|
||||||
|
key: "phpstan-cache-PR-${{ matrix.php-version }}-${{ github.run_id }}"
|
||||||
13
build/phpstan/bootstrap_action.php
Normal file
13
build/phpstan/bootstrap_action.php
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
// Defined some constants and load Dolibarr env to reduce PHPStan bootstrap that fails to load a lot of things.
|
||||||
|
define('DOL_DOCUMENT_ROOT', __DIR__ . '/../../htdocs');
|
||||||
|
define('DOL_DATA_ROOT', __DIR__ . '/../../documents');
|
||||||
|
define('DOL_URL_ROOT', '/');
|
||||||
|
define('DOL_MAIN_URL_ROOT', '/');
|
||||||
|
define('MAIN_DB_PREFIX', 'llx_');
|
||||||
|
|
||||||
|
// Load the main.inc.php file to have functions env defined
|
||||||
|
define("NOLOGIN", '1');
|
||||||
|
define("NOHTTPSREDIRECT", '1');
|
||||||
|
global $conf, $db, $langs, $user;
|
||||||
|
// include_once DOL_DOCUMENT_ROOT . '/../../htdocs/main.inc.php';
|
||||||
118
phpstan_action.neon
Normal file
118
phpstan_action.neon
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
parameters:
|
||||||
|
bootstrapFiles:
|
||||||
|
- build/phpstan/bootstrap_action.php
|
||||||
|
tmpDir: ./tmp
|
||||||
|
parallel:
|
||||||
|
jobSize: 20
|
||||||
|
processTimeout: 600.0
|
||||||
|
maximumNumberOfProcesses: 8
|
||||||
|
minimumNumberOfJobsPerProcess: 2
|
||||||
|
buffer: 134217728 # 128 MB
|
||||||
|
customRulesetUsed: true
|
||||||
|
level: 2
|
||||||
|
fileExtensions:
|
||||||
|
- php
|
||||||
|
paths:
|
||||||
|
- htdocs
|
||||||
|
- scripts
|
||||||
|
excludePaths:
|
||||||
|
analyseAndScan:
|
||||||
|
- htdocs/custom/*
|
||||||
|
- htdocs/documents/*
|
||||||
|
- htdocs/install/doctemplates/*
|
||||||
|
- htdocs/langs/*
|
||||||
|
- htdocs/modulebuilder/template/test/*
|
||||||
|
- htdocs/support/*
|
||||||
|
analyse:
|
||||||
|
- htdocs/includes/*
|
||||||
|
checkAlwaysTrueCheckTypeFunctionCall: false
|
||||||
|
checkAlwaysTrueInstanceof: false
|
||||||
|
checkAlwaysTrueStrictComparison: false
|
||||||
|
checkClassCaseSensitivity: false
|
||||||
|
checkFunctionArgumentTypes: false
|
||||||
|
checkFunctionNameCase: false
|
||||||
|
checkArgumentsPassedByReference: false
|
||||||
|
checkMaybeUndefinedVariables: false
|
||||||
|
checkNullables: false
|
||||||
|
checkThisOnly: true
|
||||||
|
checkUnionTypes: false
|
||||||
|
checkExplicitMixedMissingReturn: false
|
||||||
|
checkPhpDocMissingReturn: false
|
||||||
|
reportMaybes: false
|
||||||
|
reportMaybesInMethodSignatures: false
|
||||||
|
reportStaticMethodSignatures: false
|
||||||
|
polluteScopeWithLoopInitialAssignments: true
|
||||||
|
polluteScopeWithAlwaysIterableForeach: true
|
||||||
|
reportMagicMethods: false
|
||||||
|
reportMagicProperties: false
|
||||||
|
ignoreErrors:
|
||||||
|
- '#has an unused parameter \$param#'
|
||||||
|
- '#Result of function fieldList#'
|
||||||
|
- '#Caught class Stripe#'
|
||||||
|
- '#Function llxHeader invoked with#'
|
||||||
|
- '#Function llxHeaderVierge invoked with#'
|
||||||
|
- '#Function llxFooter invoked with#'
|
||||||
|
- '#Function llxFooterVierge invoked with#'
|
||||||
|
- '#If condition is always true#'
|
||||||
|
- '#always exists and is not falsy#'
|
||||||
|
- '#has no return type specified#'
|
||||||
|
- '#is always true#'
|
||||||
|
- '#is always fal#'
|
||||||
|
- '#always exists and is not nullable#'
|
||||||
|
- '#type has no value type specified in iterable type array#'
|
||||||
|
- '#with no value type specified in iterable type array#'
|
||||||
|
- '#Empty array passed to foreach#'
|
||||||
|
- '#in isset\(\) is not nullable#'
|
||||||
|
- '#in isset\(\) is never defined#'
|
||||||
|
- '#(\$force_dolibarr_lib|\$dolibarr_main_db).*in empty\(\) is never defined.#'
|
||||||
|
- '#Sprain\\SwissQrBill\\#'
|
||||||
|
- '#Constructor of class DolEditor has an unused parameter \$toolbarlocation#'
|
||||||
|
- '#Constructor of class DoliDB.* has an unused parameter \$type#'
|
||||||
|
- '#Default value of the parameter#'
|
||||||
|
internalErrorsCountLimit: 50
|
||||||
|
cache:
|
||||||
|
nodesByFileCountMax: 512
|
||||||
|
nodesByStringCountMax: 512
|
||||||
|
reportUnmatchedIgnoredErrors: false
|
||||||
|
universalObjectCratesClasses:
|
||||||
|
- stdClass
|
||||||
|
- SimpleXMLElement
|
||||||
|
earlyTerminatingMethodCalls: []
|
||||||
|
dynamicConstantNames:
|
||||||
|
- ICONV_IMPL
|
||||||
|
- PHP_VERSION
|
||||||
|
- PHP_MAJOR_VERSION
|
||||||
|
- PHP_MINOR_VERSION
|
||||||
|
- PHP_RELEASE_VERSION
|
||||||
|
- PHP_VERSION_ID
|
||||||
|
- PHP_EXTRA_VERSION
|
||||||
|
- PHP_ZTS
|
||||||
|
- PHP_DEBUG
|
||||||
|
- PHP_MAXPATHLEN
|
||||||
|
- PHP_OS
|
||||||
|
- PHP_OS_FAMILY
|
||||||
|
- PHP_SAPI
|
||||||
|
- PHP_EOL
|
||||||
|
- PHP_INT_MAX
|
||||||
|
- PHP_INT_MIN
|
||||||
|
- PHP_INT_SIZE
|
||||||
|
- PHP_FLOAT_DIG
|
||||||
|
- PHP_FLOAT_EPSILON
|
||||||
|
- PHP_FLOAT_MIN
|
||||||
|
- PHP_FLOAT_MAX
|
||||||
|
- DEFAULT_INCLUDE_PATH
|
||||||
|
- PEAR_INSTALL_DIR
|
||||||
|
- PEAR_EXTENSION_DIR
|
||||||
|
- PHP_EXTENSION_DIR
|
||||||
|
- PHP_PREFIX
|
||||||
|
- PHP_BINDIR
|
||||||
|
- PHP_BINARY
|
||||||
|
- PHP_MANDIR
|
||||||
|
- PHP_LIBDIR
|
||||||
|
- PHP_DATADIR
|
||||||
|
- PHP_SYSCONFDIR
|
||||||
|
- PHP_LOCALSTATEDIR
|
||||||
|
- PHP_CONFIG_FILE_PATH
|
||||||
|
- PHP_CONFIG_FILE_SCAN_DIR
|
||||||
|
- PHP_SHLIB_SUFFIX
|
||||||
|
- PHP_FD_SETSIZE
|
||||||
0
tmp/.gitkeep
Normal file
0
tmp/.gitkeep
Normal file
Reference in New Issue
Block a user