diff --git a/build/build.php b/build/build.php index a8408f2c12e64..d506d25edf962 100644 --- a/build/build.php +++ b/build/build.php @@ -150,7 +150,6 @@ function clean_checkout(string $dir) run_and_check('rm -rf libraries/vendor/joomla/*/docs'); run_and_check('rm -rf libraries/vendor/joomla/*/tests'); run_and_check('rm -rf libraries/vendor/joomla/*/Tests'); - run_and_check('rm -rf libraries/vendor/joomla/*/ruleset.xml'); // testing sampledata run_and_check('rm -rf plugins/sampledata/testing'); @@ -463,7 +462,6 @@ function capture_or_fail(string $command): string 'plugins/sampledata/testing/testing.xml', 'README.md', 'renovate.json', - 'ruleset.xml', 'tests', ]; diff --git a/build/check_ruleset_xml.php b/build/check_ruleset_xml.php deleted file mode 100644 index f3ba91a7f51fc..0000000000000 --- a/build/check_ruleset_xml.php +++ /dev/null @@ -1,106 +0,0 @@ - - Path to the PHPCS ruleset XML file to be checked, defaults to 'ruleset.xml' in the parent folder. - * --fix - Fix the XML file if any obsolete exclude patterns were found.. - * --help - Show the help and exit. - * - * @package Joomla.Build - * - * @copyright (C) 2023 Open Source Matters, Inc. - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ - -function usage($command) -{ - echo PHP_EOL; - echo 'Usage: php ' . $command . ' [options]' . PHP_EOL; - echo PHP_EOL; - echo "[options]:" . PHP_EOL; - echo "--file :\tPath to the PHPCS ruleset XML file to be checked, defaults to '" . \dirname(__DIR__) . "/ruleset.xml'." . PHP_EOL; - echo "--fix:\t\tFix the XML file if any obsolete exclude patterns were found." . PHP_EOL; - echo "--help:\t\tShow this help output." . PHP_EOL; - echo PHP_EOL; -} - -$options = getopt('', ['file:', 'fix', 'help']); - -if (isset($options['help'])) { - usage($argv[0]); - - exit(0); -} - -$rulesetFile = $options['file'] ?? \dirname(__DIR__) . '/ruleset.xml'; - -// Exclude patterns to be skipped from the check because the file or folder might not exist -$ignoreList = [ - '^configuration.php', - '^libraries/vendor/*', - '^media/*', - '^node_modules/*', -]; - -echo "Checking file '" . $rulesetFile . "' ..." . PHP_EOL; - -$rulesetLines = file($rulesetFile, FILE_IGNORE_NEW_LINES); -$obsoleteLineIdxs = []; - -foreach ($rulesetLines as $line => $text) { - if (!preg_match('/^(?:\s*)(.*)(?:<\/exclude-pattern>\s*)$/', $text, $matches)) { - continue; - } - - if (\in_array($matches[1], $ignoreList)) { - continue; - } - - // Unescape dots - $path = str_replace('\.', '.', $matches[1]); - - // Remove start of string anchor if used - if (substr($path, 0, 1) === '^') { - $path = substr($path, 1); - } - - // Remove asterisk from the end of paths of folders - if (substr($path, -2) === '/*') { - $path = substr($path, 0, -1); - } - - if (substr($path, -1) === '/') { - if (!is_dir(\dirname(__DIR__) . '/' . $path)) { - echo 'Line no. ' . $line + 1 . ': Folder "' . $path . '" doesn\'t exist.' . PHP_EOL; - $obsoleteLineIdxs[] = $line; - } - } elseif (!is_file(\dirname(__DIR__) . '/' . $path)) { - echo 'Line no. ' . $line + 1 . ': File "' . $path . '" doesn\'t exist.' . PHP_EOL; - $obsoleteLineIdxs[] = $line; - } -} - -echo "... done." . PHP_EOL; - -if (!\count($obsoleteLineIdxs)) { - echo "No obsolete lines found." . PHP_EOL; - - exit(0); -} - -if (!isset($options['fix'])) { - exit(0); -} - -foreach ($obsoleteLineIdxs as $line) { - unset($rulesetLines[$line]); -} - -echo "Updating file '" . $rulesetFile . "' ..." . PHP_EOL; - -file_put_contents($rulesetFile, implode(PHP_EOL, $rulesetLines)); - -echo "... done." . PHP_EOL; diff --git a/composer.json b/composer.json index ab1e19b006e45..f01dba36457ea 100644 --- a/composer.json +++ b/composer.json @@ -113,7 +113,6 @@ "require-dev": { "phpunit/phpunit": "^12.5", "friendsofphp/php-cs-fixer": "^3.94.2", - "squizlabs/php_codesniffer": "^3.13.6", "joomla/mediawiki": "^4.0", "joomla/test": "~4.0", "phpstan/phpstan": "^2.1.40", @@ -133,7 +132,6 @@ "post-install-cmd": [ "php build/update_fido_cache.php" ], - "phpcs": "./libraries/vendor/bin/phpcs --extensions=php -p --standard=ruleset.xml .", "csfixer": "./libraries/vendor/bin/php-cs-fixer fix -vvv --dry-run --diff" } } diff --git a/composer.lock b/composer.lock index 0e513833bc795..19eb2824cdeb0 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "a6b35f787925a089f2646438929954ce", + "content-hash": "22e5a337c0b6764a7f43ac3d25409526", "packages": [ { "name": "algo26-matthias/idna-convert", @@ -8937,85 +8937,6 @@ ], "time": "2025-02-07T05:00:38+00:00" }, - { - "name": "squizlabs/php_codesniffer", - "version": "3.13.6", - "source": { - "type": "git", - "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "4c378e1a528ea066890fc2397cbdd2f94eb2fc91" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/4c378e1a528ea066890fc2397cbdd2f94eb2fc91", - "reference": "4c378e1a528ea066890fc2397cbdd2f94eb2fc91", - "shasum": "" - }, - "require": { - "ext-simplexml": "*", - "ext-tokenizer": "*", - "ext-xmlwriter": "*", - "php": ">=5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4" - }, - "bin": [ - "bin/phpcbf", - "bin/phpcs" - ], - "type": "library", - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Greg Sherwood", - "role": "Former lead" - }, - { - "name": "Juliette Reinders Folmer", - "role": "Current lead" - }, - { - "name": "Contributors", - "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer/graphs/contributors" - } - ], - "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", - "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer", - "keywords": [ - "phpcs", - "standards", - "static analysis" - ], - "support": { - "issues": "https://github.com/PHPCSStandards/PHP_CodeSniffer/issues", - "security": "https://github.com/PHPCSStandards/PHP_CodeSniffer/security/policy", - "source": "https://github.com/PHPCSStandards/PHP_CodeSniffer", - "wiki": "https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki" - }, - "funding": [ - { - "url": "https://github.com/PHPCSStandards", - "type": "github" - }, - { - "url": "https://github.com/jrfnl", - "type": "github" - }, - { - "url": "https://opencollective.com/php_codesniffer", - "type": "open_collective" - }, - { - "url": "https://thanks.dev/u/gh/phpcsstandards", - "type": "thanks_dev" - } - ], - "time": "2026-08-06T00:17:32+00:00" - }, { "name": "staabm/side-effects-detector", "version": "1.0.5", @@ -9647,9 +9568,9 @@ "ext-gd": "*", "ext-dom": "*" }, - "platform-dev": [], + "platform-dev": {}, "platform-overrides": { "php": "8.3.0" }, - "plugin-api-version": "2.6.0" + "plugin-api-version": "2.9.0" } diff --git a/ruleset.xml b/ruleset.xml deleted file mode 100644 index f5c11471313f0..0000000000000 --- a/ruleset.xml +++ /dev/null @@ -1,271 +0,0 @@ - - - The Joomla CMS PSR-12 exceptions. - - - ^administrator/cache/* - ^administrator/logs/* - ^build/* - ^cache/* - ^media/* - ^node_modules/* - ^plugins/behaviour/compat7/classes/* - ^tmp/* - - - ^libraries/php-encryption/* - ^libraries/phpass/* - ^libraries/vendor/* - - ^configuration.php - - - - - - - - - - - - - administrator/components/com_banners/src/Model/DownloadModel\.php - administrator/components/com_banners/src/Table/BannerTable\.php - administrator/components/com_banners/src/Table/ClientTable\.php - administrator/components/com_cache/src/Model/CacheModel\.php - administrator/components/com_contact/src/Table/ContactTable\.php - administrator/components/com_fields/src/Table/FieldTable\.php - administrator/components/com_fields/src/Table/GroupTable\.php - administrator/components/com_finder/src/Table/FilterTable\.php - administrator/components/com_finder/src/Table/LinkTable\.php - administrator/components/com_guidedtours/src/Table/StepTable\.php - administrator/components/com_guidedtours/src/Table/TourTable\.php - administrator/components/com_installer/src/Model/DatabaseModel\.php - administrator/components/com_installer/src/Model/InstallModel\.php - administrator/components/com_installer/src/Table/UpdatesiteTable\.php - administrator/components/com_mails/src/Table/TemplateTable\.php - administrator/components/com_menus/src/Helper/MenusHelper\.php - administrator/components/com_menus/src/Model/MenuModel\.php - administrator/components/com_newsfeeds/src/Table/NewsfeedTable\.php - administrator/components/com_plugins/src/Model/PluginModel\.php - administrator/components/com_privacy/src/Table/RequestTable\.php - administrator/components/com_scheduler/src/Table/TaskTable\.php - administrator/components/com_tags/src/Table/TagTable\.php - administrator/components/com_templates/src/Model/StyleModel\.php - administrator/components/com_users/src/Model/UserModel\.php - administrator/components/com_users/src/Table/NoteTable\.php - administrator/components/com_workflow/src/Table/StageTable\.php - administrator/components/com_workflow/src/Table/TransitionTable\.php - administrator/components/com_workflow/src/Table/WorkflowTable\.php - components/com_banners/src/Model/BannerModel\.php - components/com_contact/src/Model/CategoriesModel\.php - components/com_contact/src/Model/CategoryModel\.php - components/com_contact/src/Model/ContactModel\.php - components/com_content/src/Model/ArchiveModel\.php - components/com_content/src/Model/ArticleModel\.php - components/com_content/src/Model/CategoriesModel\.php - components/com_content/src/Model/CategoryModel\.php - components/com_content/src/Model/FeaturedModel\.php - components/com_newsfeeds/src/Model/CategoriesModel\.php - components/com_newsfeeds/src/Model/CategoryModel\.php - components/com_newsfeeds/src/Model/NewsfeedModel\.php - components/com_tags/src/Model/TagsModel\.php - installation/src/View/Preinstall/HtmlView\.php - libraries/src/Adapter/Adapter\.php - libraries/src/Application/ApplicationHelper\.php - libraries/src/Cache/Cache\.php - libraries/src/Cache/CacheStorage\.php - libraries/src/Cache/Controller/OutputController\.php - libraries/src/Cache/Controller/PageController\.php - libraries/src/Cache/Storage/FileStorage\.php - libraries/src/Cache/Storage/MemcachedStorage\.php - libraries/src/Cache/Storage/RedisStorage\.php - libraries/src/Categories/Categories\.php - libraries/src/Categories/CategoryNode\.php - libraries/src/Client/FtpClient\.php - libraries/src/Document/Document\.php - libraries/src/Document/DocumentRenderer\.php - libraries/src/Document/ErrorDocument\.php - libraries/src/Document/HtmlDocument\.php - libraries/src/Document/JsonDocument\.php - libraries/src/Document/OpensearchDocument\.php - libraries/src/Document/Renderer/Feed/AtomRenderer\.php - libraries/src/Document/Renderer/Feed/RssRenderer\.php - libraries/src/Editor/Editor\.php - libraries/src/Encrypt/Totp\.php - libraries/src/Form/Field/CaptchaField\.php - libraries/src/Input/Json\.php - libraries/src/Installer/Manifest\.php - libraries/src/MVC/Model/FormBehaviorTrait\.php - libraries/src/MVC/Model/ItemModel\.php - libraries/src/MVC/Model/StateBehaviorTrait\.php - libraries/src/MVC/View/AbstractView\.php - libraries/src/MVC/View/HtmlView\.php - libraries/src/MVC/View/JsonView\.php - libraries/src/Object/CMSObject\.php - libraries/src/Plugin/CMSPlugin\.php - libraries/src/Router/Route\.php - libraries/src/Table/Category\.php - libraries/src/Table/Content\.php - libraries/src/Table/CoreContent\.php - libraries/src/Table/Extension\.php - libraries/src/Table/Menu\.php - libraries/src/Table/Module\.php - libraries/src/Table/Nested\.php - libraries/src/Table/Table\.php - libraries/src/Table/Update\.php - libraries/src/Table/User\.php - libraries/src/Toolbar/Toolbar\.php - libraries/src/Tree/ImmutableNodeTrait\.php - libraries/src/Updater/UpdateAdapter\.php - libraries/src/User/User\.php - - - - administrator/components/com_banners/src/Controller/BannersController\.php - administrator/components/com_content/src/Service/HTML/Icon\.php - administrator/components/com_installer/src/Controller/InstallController\.php - administrator/components/com_installer/src/Model/DiscoverModel\.php - administrator/components/com_installer/src/Model/WarningsModel\.php - administrator/components/com_users/src/Service/HTML/Users\.php - components/com_content/helpers/icon\.php - components/com_content/helpers/icon\.php - libraries/src/Installer/Adapter/ComponentAdapter\.php - libraries/src/Installer/Adapter/LanguageAdapter\.php - libraries/src/Installer/Adapter/ModuleAdapter\.php - libraries/src/Installer/Installer\.php - libraries/src/Installer/InstallerAdapter\.php - libraries/src/Language/Transliterate\.php - libraries/src/Mail/Mail\.php - libraries/src/Pagination/Pagination\.php - libraries/src/Toolbar/ToolbarHelper\.php - libraries/src/Utility/BufferStreamHandler\.php - - - - - libraries/cms\.php - libraries/loader\.php - - - administrator/components/com_fields/src/Model/FieldsModel\.php - administrator/components/com_fields/src/Model/GroupsModel\.php - administrator/components/com_fields/src/Table/FieldTable\.php - administrator/components/com_fields/src/Table/GroupTable\.php - administrator/components/com_finder/src/Model/MapsModel\.php - administrator/components/com_installer/src/Model/InstallerModel\.php - administrator/components/com_installer/src/Model/InstallModel\.php - administrator/components/com_installer/src/Model/LanguagesModel\.php - administrator/components/com_installer/src/Model/UpdateModel\.php - administrator/components/com_login/src/Model/LoginModel\.php - administrator/components/com_modules/src/Model/ModulesModel\.php - administrator/components/com_plugins/src/Model/PluginsModel\.php - administrator/components/com_scheduler/src/Model/TasksModel\.php - administrator/components/com_scheduler/src/Table/TaskTable\.php - administrator/components/com_users/src/Model/UsersModel\.php - administrator/components/com_workflow/src/Table/StageTable\.php - administrator/components/com_workflow/src/Table/TransitionTable\.php - administrator/components/com_workflow/src/Table/WorkflowTable\.php - api/components/com_contact/src/Controller/ContactController\.php - components/com_config/src/View/Config/HtmlView\.php - components/com_config/src/View/Modules/HtmlView\.php - components/com_config/src/View/Templates/HtmlView\.php - components/com_contact/src/Controller/ContactController\.php - components/com_contact/src/View/Contact/HtmlView\.php - components/com_contact/src/View/Featured/HtmlView\.php - components/com_contact/src/View/Form/HtmlView\.php - components/com_content/src/Model/CategoryModel\.php - components/com_content/src/View/Archive/HtmlView\.php - components/com_content/src/View/Article/HtmlView\.php - components/com_content/src/View/Featured/HtmlView\.php - components/com_content/src/View/Form/HtmlView\.php - components/com_newsfeeds/src/View/Newsfeed/HtmlView\.php - components/com_tags/src/Helper/RouteHelper\.php - components/com_tags/src/View/Tag/HtmlView\.php - components/com_tags/src/View/Tags/HtmlView\.php - installation/src/Form/Field/Installation/LanguageField\.php - libraries/src/Cache/Cache\.php - libraries/src/Cache/CacheStorage\.php - libraries/src/Cache/Controller/CallbackController\.php - libraries/src/Cache/Controller/PageController\.php - libraries/src/Cache/Controller/ViewController\.php - libraries/src/Cache/Storage/FileStorage\.php - libraries/src/Cache/Storage/MemcachedStorage\.php - libraries/src/Captcha/Captcha\.php - libraries/src/Categories/Categories\.php - libraries/src/Client/FtpClient\.php - libraries/src/Document/Document\.php - libraries/src/Document/DocumentRenderer\.php - libraries/src/Document/HtmlDocument\.php - libraries/src/Editor/Editor\.php - libraries/src/Encrypt/Base32\.php - libraries/src/Environment/Browser\.php - libraries/src/Feed/FeedFactory\.php - libraries/src/HTML/Helpers/Grid\.php - libraries/src/Installer/Adapter/ComponentAdapter\.php - libraries/src/Installer/Adapter/LanguageAdapter\.php - libraries/src/Installer/Adapter/ModuleAdapter\.php - libraries/src/Installer/Adapter/PackageAdapter\.php - libraries/src/MVC/Model/BaseDatabaseModel\.php - libraries/src/MVC/Model/LegacyModelLoaderTrait\.php - libraries/src/MVC/Model/ListModel\.php - libraries/src/MVC/View/HtmlView\.php - libraries/src/Pagination/Pagination\.php - libraries/src/Table/Category\.php - libraries/src/Table/Category\.php - libraries/src/Table/Content\.php - libraries/src/Table/Language\.php - libraries/src/Table/MenuType\.php - libraries/src/Table/Module\.php - libraries/src/Table/Nested\.php - libraries/src/Table/Table\.php - libraries/src/Toolbar/Button/ConfirmButton\.php - libraries/src/Toolbar/Button/HelpButton\.php - libraries/src/Toolbar/Button/PopupButton\.php - libraries/src/Toolbar/Button/StandardButton\.php - libraries/src/Updater/Adapter/CollectionAdapter\.php - libraries/src/Updater/Adapter/ExtensionAdapter\.php - libraries/src/Updater/Update\.php - libraries/src/Updater/UpdateAdapter\.php - modules/mod_articles_category/src/Helper/ArticlesCategoryHelper\.php - tests/ - - - - - administrator/components/com_joomlaupdate/finalisation\.php - - - - - administrator/components/com_installer/src/Model/DatabaseModel\.php - libraries/src/Client/FtpClient\.php - - - index\.php - administrator/index\.php - administrator/components/com_joomlaupdate/extract\.php - administrator/includes/app\.php - administrator/includes/defines\.php - administrator/includes/framework\.php - api/includes/app\.php - api/includes/defines\.php - api/includes/framework\.php - api/index\.php - cli/joomla\.php - includes/app\.php - includes/defines\.php - includes/framework\.php - installation/includes/app\.php - installation/includes/cli\.php - installation/includes/defines\.php - installation/index\.php - installation/joomla\.php - libraries/cms\.php - libraries/bootstrap\.php - libraries/import\.php - libraries/import\.legacy\.php - libraries/loader\.php - -