dolibarr/dev/tools/phan/config_fixer.php

53 lines
2.5 KiB
PHP
Raw Permalink Normal View History

Qual: New Phan plugin for testing that argument matches regex (#28424) * Qual: New Phan plugin for testing that argument matches regex # Qual: New Phan plugin for testing that argument matches regex This Plugin - currently applied to GETPOST - allows verifying that a selected argument of a function matches a regular expression. * Qual: Add isModEnabled verification to phan # Qual: Add isModEnabled verification in phan Using ParamMatchRegexPlugin, add isModEnabled parameter verification. * Qual: Verify sanitizeVal check value # Qual: Verify sanitizeVal check value Use ParamMatchPlugin to check sanitizeVal check value * Qual: Extend ParamMatchRegexPlugin with class_method # Qual: Extend ParamMatchRegexPlugin with class_method Allow matching class methods for argument verification. * Update config.php * Qual: New Phan plugin for testing that argument matches regex # Qual: New Phan plugin for testing that argument matches regex This Plugin - currently applied to GETPOST - allows verifying that a selected argument of a function matches a regular expression. * Qual: Add isModEnabled verification to phan # Qual: Add isModEnabled verification in phan Using ParamMatchRegexPlugin, add isModEnabled parameter verification. * Qual: Verify sanitizeVal check value # Qual: Verify sanitizeVal check value Use ParamMatchPlugin to check sanitizeVal check value * Qual: Extend ParamMatchRegexPlugin with class_method # Qual: Extend ParamMatchRegexPlugin with class_method Allow matching class methods for argument verification. * Report scalar values (see null, etc) * Qual: Ignore false Phan Notification * Qual: Ignore false Phan Notification * Qual: Fix Phan needs specific message keys for coloring. --------- Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2024-02-26 23:10:16 +01:00
<?php
2025-02-05 00:54:54 +01:00
/* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
2024-03-11 22:20:29 +01:00
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*/
// Load default configuration (with many exclusions)
//
$config = include __DIR__.DIRECTORY_SEPARATOR."config.php";
Qual: Fix and enable alias deprecation detection (#28716) * Qual: Ignore some false positives for deprecated functions # Qual: Ignore some false positives for deprecated functions The Phan Deprecation Plugin for internal functions has mixed up some mail functions and lists them as deprecated, this ignores that * Qual: Enable detection and fixing of internal deprecations * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Update codespell lines ignore list after format # Qual: Update codespell lines ignore list after forma Done using latest library, so also adds some exceptions that are needed in the future; --------- Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2024-03-08 21:34:18 +01:00
2025-02-05 00:54:54 +01:00
// Note: When more than one fixer is attached to the same Notice, only the last fix is applied.
//require_once __DIR__.'/plugins/DeprecatedModuleNameFixer.php';
//require_once __DIR__.'/plugins/PriceFormFixer.php';
Qual: Fix and enable alias deprecation detection (#28716) * Qual: Ignore some false positives for deprecated functions # Qual: Ignore some false positives for deprecated functions The Phan Deprecation Plugin for internal functions has mixed up some mail functions and lists them as deprecated, this ignores that * Qual: Enable detection and fixing of internal deprecations * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Replace 'join' with 'implode' * Qual: Update codespell lines ignore list after format # Qual: Update codespell lines ignore list after forma Done using latest library, so also adds some exceptions that are needed in the future; --------- Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2024-03-08 21:34:18 +01:00
//require_once __DIR__.'/plugins/UrlEncodeStringifyFixer.php';
2025-02-05 00:54:54 +01:00
//require_once __DIR__.'/plugins/SelectDateFixer.php';
//require_once __DIR__.'/plugins/setPageOrientationFixer.php';
2025-02-08 19:51:31 +01:00
//require_once __DIR__.'/plugins/textwithpictoFixer.php';
require_once __DIR__.'/plugins/ifsqlFixer.php';
2025-02-05 00:54:54 +01:00
//require_once __DIR__.'/plugins/MultiCellFixer.php';
//require_once __DIR__.'/plugins/setAutoPageBreakFixer.php';
//require_once __DIR__.'/plugins/CellFixer.php';
//$deprecatedModuleNameRegex = '/^(?!(?:'.implode('|', array_keys($DEPRECATED_MODULE_MAPPING)).')$).*/';
2025-02-05 00:54:54 +01:00
//require_once __DIR__.'/plugins/DeprecatedModuleNameFixer.php';
$config['exclude_file_regex'] = '@^(' // @phpstan-ignore-line
Qual: New Phan plugin for testing that argument matches regex (#28424) * Qual: New Phan plugin for testing that argument matches regex # Qual: New Phan plugin for testing that argument matches regex This Plugin - currently applied to GETPOST - allows verifying that a selected argument of a function matches a regular expression. * Qual: Add isModEnabled verification to phan # Qual: Add isModEnabled verification in phan Using ParamMatchRegexPlugin, add isModEnabled parameter verification. * Qual: Verify sanitizeVal check value # Qual: Verify sanitizeVal check value Use ParamMatchPlugin to check sanitizeVal check value * Qual: Extend ParamMatchRegexPlugin with class_method # Qual: Extend ParamMatchRegexPlugin with class_method Allow matching class methods for argument verification. * Update config.php * Qual: New Phan plugin for testing that argument matches regex # Qual: New Phan plugin for testing that argument matches regex This Plugin - currently applied to GETPOST - allows verifying that a selected argument of a function matches a regular expression. * Qual: Add isModEnabled verification to phan # Qual: Add isModEnabled verification in phan Using ParamMatchRegexPlugin, add isModEnabled parameter verification. * Qual: Verify sanitizeVal check value # Qual: Verify sanitizeVal check value Use ParamMatchPlugin to check sanitizeVal check value * Qual: Extend ParamMatchRegexPlugin with class_method # Qual: Extend ParamMatchRegexPlugin with class_method Allow matching class methods for argument verification. * Report scalar values (see null, etc) * Qual: Ignore false Phan Notification * Qual: Ignore false Phan Notification * Qual: Fix Phan needs specific message keys for coloring. --------- Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2024-02-26 23:10:16 +01:00
.'dummy' // @phpstan-ignore-line
2025-02-05 00:54:54 +01:00
//.'|(?!htdocs/modulebuilderrtemplate/core/modules/mymodule/doc/pdf_standard_myobject.modules.php).*' // Only this file for test @php-stan-ignore-line
.'|htdocs/custom/.*' // Ignore all custom modules @phpstan-ignore-line
Qual: New Phan plugin for testing that argument matches regex (#28424) * Qual: New Phan plugin for testing that argument matches regex # Qual: New Phan plugin for testing that argument matches regex This Plugin - currently applied to GETPOST - allows verifying that a selected argument of a function matches a regular expression. * Qual: Add isModEnabled verification to phan # Qual: Add isModEnabled verification in phan Using ParamMatchRegexPlugin, add isModEnabled parameter verification. * Qual: Verify sanitizeVal check value # Qual: Verify sanitizeVal check value Use ParamMatchPlugin to check sanitizeVal check value * Qual: Extend ParamMatchRegexPlugin with class_method # Qual: Extend ParamMatchRegexPlugin with class_method Allow matching class methods for argument verification. * Update config.php * Qual: New Phan plugin for testing that argument matches regex # Qual: New Phan plugin for testing that argument matches regex This Plugin - currently applied to GETPOST - allows verifying that a selected argument of a function matches a regular expression. * Qual: Add isModEnabled verification to phan # Qual: Add isModEnabled verification in phan Using ParamMatchRegexPlugin, add isModEnabled parameter verification. * Qual: Verify sanitizeVal check value # Qual: Verify sanitizeVal check value Use ParamMatchPlugin to check sanitizeVal check value * Qual: Extend ParamMatchRegexPlugin with class_method # Qual: Extend ParamMatchRegexPlugin with class_method Allow matching class methods for argument verification. * Report scalar values (see null, etc) * Qual: Ignore false Phan Notification * Qual: Ignore false Phan Notification * Qual: Fix Phan needs specific message keys for coloring. --------- Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2024-02-26 23:10:16 +01:00
.'|htdocs/.*/canvas/.*/tpl/.*.tpl.php' // @phpstan-ignore-line
2024-11-14 00:03:31 +01:00
.'|htdocs/admin/tools/ui/.*' // @phpstan-ignore-line
//.'|htdocs/modulebuilder/template/.*' // @phpstan-ignore-line
2025-02-05 00:54:54 +01:00
// Included as stub (better analysis)
.'|htdocs/includes/nusoap/.*' // @phpstan-ignore-line
Qual: New Phan plugin for testing that argument matches regex (#28424) * Qual: New Phan plugin for testing that argument matches regex # Qual: New Phan plugin for testing that argument matches regex This Plugin - currently applied to GETPOST - allows verifying that a selected argument of a function matches a regular expression. * Qual: Add isModEnabled verification to phan # Qual: Add isModEnabled verification in phan Using ParamMatchRegexPlugin, add isModEnabled parameter verification. * Qual: Verify sanitizeVal check value # Qual: Verify sanitizeVal check value Use ParamMatchPlugin to check sanitizeVal check value * Qual: Extend ParamMatchRegexPlugin with class_method # Qual: Extend ParamMatchRegexPlugin with class_method Allow matching class methods for argument verification. * Update config.php * Qual: New Phan plugin for testing that argument matches regex # Qual: New Phan plugin for testing that argument matches regex This Plugin - currently applied to GETPOST - allows verifying that a selected argument of a function matches a regular expression. * Qual: Add isModEnabled verification to phan # Qual: Add isModEnabled verification in phan Using ParamMatchRegexPlugin, add isModEnabled parameter verification. * Qual: Verify sanitizeVal check value # Qual: Verify sanitizeVal check value Use ParamMatchPlugin to check sanitizeVal check value * Qual: Extend ParamMatchRegexPlugin with class_method # Qual: Extend ParamMatchRegexPlugin with class_method Allow matching class methods for argument verification. * Report scalar values (see null, etc) * Qual: Ignore false Phan Notification * Qual: Ignore false Phan Notification * Qual: Fix Phan needs specific message keys for coloring. --------- Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2024-02-26 23:10:16 +01:00
// Included as stub (old version + incompatible typing hints)
.'|htdocs/includes/restler/.*' // @phpstan-ignore-line
2025-02-05 00:54:54 +01:00
// Included as stub (did not seem properly analyzed by phan without it)
Qual: New Phan plugin for testing that argument matches regex (#28424) * Qual: New Phan plugin for testing that argument matches regex # Qual: New Phan plugin for testing that argument matches regex This Plugin - currently applied to GETPOST - allows verifying that a selected argument of a function matches a regular expression. * Qual: Add isModEnabled verification to phan # Qual: Add isModEnabled verification in phan Using ParamMatchRegexPlugin, add isModEnabled parameter verification. * Qual: Verify sanitizeVal check value # Qual: Verify sanitizeVal check value Use ParamMatchPlugin to check sanitizeVal check value * Qual: Extend ParamMatchRegexPlugin with class_method # Qual: Extend ParamMatchRegexPlugin with class_method Allow matching class methods for argument verification. * Update config.php * Qual: New Phan plugin for testing that argument matches regex # Qual: New Phan plugin for testing that argument matches regex This Plugin - currently applied to GETPOST - allows verifying that a selected argument of a function matches a regular expression. * Qual: Add isModEnabled verification to phan # Qual: Add isModEnabled verification in phan Using ParamMatchRegexPlugin, add isModEnabled parameter verification. * Qual: Verify sanitizeVal check value # Qual: Verify sanitizeVal check value Use ParamMatchPlugin to check sanitizeVal check value * Qual: Extend ParamMatchRegexPlugin with class_method # Qual: Extend ParamMatchRegexPlugin with class_method Allow matching class methods for argument verification. * Report scalar values (see null, etc) * Qual: Ignore false Phan Notification * Qual: Ignore false Phan Notification * Qual: Fix Phan needs specific message keys for coloring. --------- Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2024-02-26 23:10:16 +01:00
.'|htdocs/includes/stripe/.*' // @phpstan-ignore-line
.'|htdocs/conf/conf.php' // @phpstan-ignore-line
2025-02-05 00:54:54 +01:00
//.'|htdocs/[^mi](?!.*(pdf_|tcpdf)).*\.php' // @phpstan-ignore-line
//.'|htdocs/(?!.*modules.*(pdf_|pdf.lib)).*\.php' // @phpstan-ignore-line
.')@'; // @phpstan-ignore-line
Qual: New Phan plugin for testing that argument matches regex (#28424) * Qual: New Phan plugin for testing that argument matches regex # Qual: New Phan plugin for testing that argument matches regex This Plugin - currently applied to GETPOST - allows verifying that a selected argument of a function matches a regular expression. * Qual: Add isModEnabled verification to phan # Qual: Add isModEnabled verification in phan Using ParamMatchRegexPlugin, add isModEnabled parameter verification. * Qual: Verify sanitizeVal check value # Qual: Verify sanitizeVal check value Use ParamMatchPlugin to check sanitizeVal check value * Qual: Extend ParamMatchRegexPlugin with class_method # Qual: Extend ParamMatchRegexPlugin with class_method Allow matching class methods for argument verification. * Update config.php * Qual: New Phan plugin for testing that argument matches regex # Qual: New Phan plugin for testing that argument matches regex This Plugin - currently applied to GETPOST - allows verifying that a selected argument of a function matches a regular expression. * Qual: Add isModEnabled verification to phan # Qual: Add isModEnabled verification in phan Using ParamMatchRegexPlugin, add isModEnabled parameter verification. * Qual: Verify sanitizeVal check value # Qual: Verify sanitizeVal check value Use ParamMatchPlugin to check sanitizeVal check value * Qual: Extend ParamMatchRegexPlugin with class_method # Qual: Extend ParamMatchRegexPlugin with class_method Allow matching class methods for argument verification. * Report scalar values (see null, etc) * Qual: Ignore false Phan Notification * Qual: Ignore false Phan Notification * Qual: Fix Phan needs specific message keys for coloring. --------- Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2024-02-26 23:10:16 +01:00
// $config['plugins'][] = __DIR__.'/plugins/ParamMatchRegexPlugin.php';
2025-02-05 00:54:54 +01:00
$config['plugins'] = [];
$config['plugins'][] = 'DeprecateAliasPlugin';
// $config['plugins'][] = __DIR__.'/plugins/GetPostFixerPlugin.php';
// $config['plugins'][] = 'PHPDocToRealTypesPlugin';
Qual: New Phan plugin for testing that argument matches regex (#28424) * Qual: New Phan plugin for testing that argument matches regex # Qual: New Phan plugin for testing that argument matches regex This Plugin - currently applied to GETPOST - allows verifying that a selected argument of a function matches a regular expression. * Qual: Add isModEnabled verification to phan # Qual: Add isModEnabled verification in phan Using ParamMatchRegexPlugin, add isModEnabled parameter verification. * Qual: Verify sanitizeVal check value # Qual: Verify sanitizeVal check value Use ParamMatchPlugin to check sanitizeVal check value * Qual: Extend ParamMatchRegexPlugin with class_method # Qual: Extend ParamMatchRegexPlugin with class_method Allow matching class methods for argument verification. * Update config.php * Qual: New Phan plugin for testing that argument matches regex # Qual: New Phan plugin for testing that argument matches regex This Plugin - currently applied to GETPOST - allows verifying that a selected argument of a function matches a regular expression. * Qual: Add isModEnabled verification to phan # Qual: Add isModEnabled verification in phan Using ParamMatchRegexPlugin, add isModEnabled parameter verification. * Qual: Verify sanitizeVal check value # Qual: Verify sanitizeVal check value Use ParamMatchPlugin to check sanitizeVal check value * Qual: Extend ParamMatchRegexPlugin with class_method # Qual: Extend ParamMatchRegexPlugin with class_method Allow matching class methods for argument verification. * Report scalar values (see null, etc) * Qual: Ignore false Phan Notification * Qual: Ignore false Phan Notification * Qual: Fix Phan needs specific message keys for coloring. --------- Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2024-02-26 23:10:16 +01:00
return $config;