forked from Wavyzz/dolibarr
Try to merge phpstan.neon and phpstan_action.neon
This commit is contained in:
@@ -5,18 +5,22 @@ PHPStan requires PHP >= 7.1
|
||||
|
||||
Config File is: ./phpstan.neon
|
||||
|
||||
In dolibarr/build/phpstan
|
||||
= Installation =
|
||||
|
||||
cd ./build/phpstan
|
||||
mkdir phpstan
|
||||
cd phpstan
|
||||
composer require --dev phpstan/phpstan
|
||||
|
||||
Build report from CLI:
|
||||
|
||||
= Build report from CLI =
|
||||
|
||||
In dolibarr/
|
||||
mv htdocs/custom /tmp/
|
||||
php build/phpstan/phpstan/vendor/bin/phpstan -v analyze -c ./phpstan.neon -a build/phpstan/bootstrap.php --memory-limit 4G --error-format=table htdocs/commande/class
|
||||
php build/phpstan/phpstan/vendor/bin/phpstan -v analyze -c ./phpstan.neon -a build/phpstan/bootstrap.php --memory-limit 4G --error-format=table htdocs/
|
||||
php build/phpstan/phpstan/vendor/bin/phpstan -v analyze -c ./phpstan.neon --memory-limit 4G --error-format=table htdocs/commande/class
|
||||
php build/phpstan/phpstan/vendor/bin/phpstan -v analyze -c ./phpstan.neon --memory-limit 4G --error-format=table htdocs/
|
||||
mv /tmp/custom htdocs
|
||||
|
||||
Build HTML report from Cron:
|
||||
Example of line to add into a cron to generate a HTML report:
|
||||
0 1 5 * * cd /home/dolibarr/preview.dolibarr.org/dolibarr; chmod -R u+w /home/dolibarr/preview.dolibarr.org/dolibarr; git pull; /home/dolibarr/phpstan/vendor/bin/phpstan -v analyze -a build/phpstan/bootstrap.php --memory-limit 4G --error-format=github | awk ' BEGIN{ print "Date "strftime("%Y-%m-%d")"<br>" } { print $0"<br>" } END{ print NR } ' > /home/dolibarr/doxygen.dolibarr.org/phpstan/index.html
|
||||
0 1 5 * * cd /home/dolibarr/preview.dolibarr.org/dolibarr; chmod -R u+w /home/dolibarr/preview.dolibarr.org/dolibarr; git pull; /home/dolibarr/phpstan/vendor/bin/phpstan -v analyze --memory-limit 4G --error-format=github | awk ' BEGIN{ print "Date "strftime("%Y-%m-%d")"<br>" } { print $0"<br>" } END{ print NR } ' > /home/dolibarr/doxygen.dolibarr.org/phpstan/index.html
|
||||
|
||||
@@ -16,5 +16,5 @@ if (!defined("NOHTTPSREDIRECT")) {
|
||||
define("NOHTTPSREDIRECT", '1');
|
||||
}
|
||||
|
||||
global $conf, $langs, $user, $db;
|
||||
global $conf, $db, $langs, $user;
|
||||
include_once __DIR__ . '/../../htdocs/main.inc.php';
|
||||
|
||||
@@ -1,5 +1,16 @@
|
||||
<?php
|
||||
|
||||
// Load the main.inc.php file to have functions env defined
|
||||
if (!defined("NOLOGIN")) {
|
||||
define("NOLOGIN", '1');
|
||||
}
|
||||
if (!defined("NOSESSION")) {
|
||||
define("NOSESSION", '1');
|
||||
}
|
||||
if (!defined("NOHTTPSREDIRECT")) {
|
||||
define("NOHTTPSREDIRECT", '1');
|
||||
}
|
||||
|
||||
// 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');
|
||||
@@ -7,9 +18,5 @@ 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';
|
||||
|
||||
47
phpstan.neon
47
phpstan.neon
@@ -1,4 +1,13 @@
|
||||
parameters:
|
||||
bootstrapFiles:
|
||||
- build/phpstan/bootstrap.php
|
||||
tmpDir: ./.github/tmp
|
||||
parallel:
|
||||
jobSize: 20
|
||||
processTimeout: 600.0
|
||||
maximumNumberOfProcesses: 8
|
||||
minimumNumberOfJobsPerProcess: 2
|
||||
buffer: 134217728 # 128 MB
|
||||
customRulesetUsed: true
|
||||
level: 2
|
||||
fileExtensions:
|
||||
@@ -24,7 +33,7 @@ parameters:
|
||||
checkAlwaysTrueStrictComparison: false
|
||||
checkClassCaseSensitivity: false
|
||||
checkFunctionArgumentTypes: false
|
||||
checkFunctionNameCase: false
|
||||
checkFunctionNameCase: true
|
||||
checkArgumentsPassedByReference: false
|
||||
checkMaybeUndefinedVariables: false
|
||||
checkNullables: false
|
||||
@@ -39,38 +48,16 @@ parameters:
|
||||
reportMagicMethods: false
|
||||
reportMagicProperties: false
|
||||
ignoreErrors:
|
||||
- '#Undefined variable: \$langs#'
|
||||
- '#Undefined variable: \$user#'
|
||||
- '#Undefined variable: \$db#'
|
||||
- '#Undefined variable: \$conf#'
|
||||
- '#Undefined variable: \$hookmanager#'
|
||||
- '#Undefined variable: \$mysoc#'
|
||||
- '#Undefined variable: \$error#'
|
||||
- '#Undefined variable: \$errors#'
|
||||
- '#Undefined variable: \$form#'
|
||||
- '#has an unused parameter \$param#'
|
||||
- '#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#'
|
||||
- '#is always true#'
|
||||
- '#is always fal#'
|
||||
- '#has no return type specified#'
|
||||
- '#always exists and is not nullable#'
|
||||
- '#PHPDoc tag @return has invalid value#'
|
||||
- '#type has no value type specified in iterable type array#'
|
||||
- '#with no value type specified in iterable type array#'
|
||||
- '#Empty array passed to foreach#'
|
||||
- '#Result of function fieldList#'
|
||||
- '#in isset\(\) is not nullable#'
|
||||
- '#in isset\(\) is never defined#'
|
||||
- '#(\$force_dolibarr_lib|\$dolibarr_main_db).*in empty\(\) is never defined.#'
|
||||
- '#Caught class Stripe#'
|
||||
- '#Function llx.* invoked with#'
|
||||
- '#always exists and is not falsy#'
|
||||
- '#is always fal#'
|
||||
- '#always exists and is not nullable#'
|
||||
- '#(\$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\w+ has an unused parameter \$type#'
|
||||
- '#Constructor of class .* has an unused parameter #'
|
||||
- '#Default value of the parameter#'
|
||||
internalErrorsCountLimit: 50
|
||||
cache:
|
||||
nodesByFileCountMax: 512
|
||||
|
||||
@@ -57,7 +57,7 @@ Now we can run selenium by two ways:
|
||||
npm update
|
||||
```
|
||||
|
||||
* In *nightwatch.conf.js* file inside the root directory of the project and inside the configuration file following environment variable has been specified. We can change the default values according to our local configuration.
|
||||
* Copy the file *nightwatch.conf.js* inside the root directory of the project and inside this configuration file set the following environment variable. We can change the default values according to our local configuration.
|
||||
|
||||
```
|
||||
const admin_username = process.env.ADMIN_USERNAME || 'admin';
|
||||
|
||||
Reference in New Issue
Block a user