ltsecurityinc安防产品在线商城代码
This commit is contained in:
@@ -0,0 +1,436 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Magento\Test\Php;
|
||||
|
||||
use Magento\Framework\App\Utility\Files;
|
||||
use Magento\TestFramework\CodingStandard\Tool\CodeMessDetector;
|
||||
use Magento\TestFramework\CodingStandard\Tool\CodeSniffer;
|
||||
use Magento\TestFramework\CodingStandard\Tool\CodeSniffer\Wrapper;
|
||||
use Magento\TestFramework\CodingStandard\Tool\CopyPasteDetector;
|
||||
use Magento\TestFramework\CodingStandard\Tool\PhpCompatibility;
|
||||
use Magento\TestFramework\CodingStandard\Tool\PhpStan;
|
||||
use Magento\TestFramework\Utility\AddedFiles;
|
||||
use Magento\TestFramework\Utility\FilesSearch;
|
||||
use PHPMD\TextUI\Command;
|
||||
|
||||
/**
|
||||
* Set of tests for static code analysis, e.g. code style, code complexity, copy paste detecting, etc.
|
||||
*/
|
||||
class LiveCodeTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected static $reportDir = '';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected static $pathToSource = '';
|
||||
|
||||
/**
|
||||
* Setup basics for all tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function setUpBeforeClass(): void
|
||||
{
|
||||
self::$pathToSource = BP;
|
||||
self::$reportDir = self::$pathToSource . '/dev/tests/static/report';
|
||||
if (!is_dir(self::$reportDir)) {
|
||||
mkdir(self::$reportDir);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns base folder for suite scope
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private static function getBaseFilesFolder()
|
||||
{
|
||||
return __DIR__;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns base directory for whitelisted files
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private static function getChangedFilesBaseDir()
|
||||
{
|
||||
return __DIR__ . '/..';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whitelist based on blacklist and git changed files
|
||||
*
|
||||
* @param array $fileTypes
|
||||
* @param string $changedFilesBaseDir
|
||||
* @param string $baseFilesFolder
|
||||
* @param string $whitelistFile
|
||||
* @return array
|
||||
*/
|
||||
public static function getWhitelist(
|
||||
$fileTypes = ['php'],
|
||||
$changedFilesBaseDir = '',
|
||||
$baseFilesFolder = '',
|
||||
$whitelistFile = '/_files/whitelist/common.txt'
|
||||
) {
|
||||
$changedFiles = self::getChangedFilesList($changedFilesBaseDir);
|
||||
if (empty($changedFiles)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$globPatternsFolder = ('' !== $baseFilesFolder) ? $baseFilesFolder : self::getBaseFilesFolder();
|
||||
try {
|
||||
$directoriesToCheck = Files::init()->readLists($globPatternsFolder . $whitelistFile);
|
||||
} catch (\Exception $e) {
|
||||
// no directories matched white list
|
||||
return [];
|
||||
}
|
||||
$targetFiles = self::filterFiles($changedFiles, $fileTypes, $directoriesToCheck);
|
||||
return $targetFiles;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method loads list of changed files.
|
||||
*
|
||||
* List may be generated by:
|
||||
* - dev/tests/static/get_github_changes.php utility (allow to generate diffs between branches),
|
||||
* - CLI command "git diff --name-only > dev/tests/static/testsuite/Magento/Test/_files/changed_files_local.txt",
|
||||
*
|
||||
* If no generated changed files list found "git diff" will be used to find not committed changed
|
||||
* (tests should be invoked from target gir repo).
|
||||
*
|
||||
* Note: "static" modifier used for compatibility with legacy implementation of self::getWhitelist method
|
||||
*
|
||||
* @param string $changedFilesBaseDir Base dir with previously generated list files
|
||||
* @return string[] List of changed files
|
||||
*/
|
||||
private static function getChangedFilesList($changedFilesBaseDir)
|
||||
{
|
||||
return FilesSearch::getFilesFromListFile(
|
||||
$changedFilesBaseDir ?: self::getChangedFilesBaseDir(),
|
||||
'changed_files*',
|
||||
function () {
|
||||
// if no list files, probably, this is the dev environment
|
||||
// phpcs:disable Generic.PHP.NoSilencedErrors,Magento2.Security.InsecureFunction
|
||||
@exec('git diff --name-only', $changedFiles);
|
||||
@exec('git diff --cached --name-only', $addedFiles);
|
||||
// phpcs:enable
|
||||
$changedFiles = array_unique(array_merge($changedFiles, $addedFiles));
|
||||
return $changedFiles;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter list of files.
|
||||
*
|
||||
* File removed from list:
|
||||
* - if it not exists,
|
||||
* - if allowed types are specified and file has another type (extension),
|
||||
* - if allowed directories specified and file not located in one of them.
|
||||
*
|
||||
* Note: "static" modifier used for compatibility with legacy implementation of self::getWhitelist method
|
||||
*
|
||||
* @param string[] $files List of file paths to filter
|
||||
* @param string[] $allowedFileTypes List of allowed file extensions (pass empty array to allow all)
|
||||
* @param string[] $allowedDirectories List of allowed directories (pass empty array to allow all)
|
||||
* @return string[] Filtered file paths
|
||||
*/
|
||||
private static function filterFiles(array $files, array $allowedFileTypes, array $allowedDirectories)
|
||||
{
|
||||
if (empty($allowedFileTypes)) {
|
||||
$fileHasAllowedType = function () {
|
||||
return true;
|
||||
};
|
||||
} else {
|
||||
$fileHasAllowedType = function ($file) use ($allowedFileTypes) {
|
||||
return in_array(pathinfo($file, PATHINFO_EXTENSION), $allowedFileTypes);
|
||||
};
|
||||
}
|
||||
|
||||
if (empty($allowedDirectories)) {
|
||||
$fileIsInAllowedDirectory = function () {
|
||||
return true;
|
||||
};
|
||||
} else {
|
||||
$allowedDirectories = array_map('realpath', $allowedDirectories);
|
||||
usort(
|
||||
$allowedDirectories,
|
||||
function ($dir1, $dir2) {
|
||||
return strlen($dir1) - strlen($dir2);
|
||||
}
|
||||
);
|
||||
$fileIsInAllowedDirectory = function ($file) use ($allowedDirectories) {
|
||||
foreach ($allowedDirectories as $directory) {
|
||||
if (strpos($file, $directory) === 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
}
|
||||
|
||||
$filtered = array_filter(
|
||||
$files,
|
||||
function ($file) use ($fileHasAllowedType, $fileIsInAllowedDirectory) {
|
||||
$file = realpath($file);
|
||||
if (false === $file) {
|
||||
return false;
|
||||
}
|
||||
return $fileHasAllowedType($file) && $fileIsInAllowedDirectory($file);
|
||||
}
|
||||
);
|
||||
|
||||
return $filtered;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves full list of codebase paths without any files/folders filtered out
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function getFullWhitelist()
|
||||
{
|
||||
try {
|
||||
return Files::init()->readLists(__DIR__ . '/_files/whitelist/common.txt');
|
||||
} catch (\Exception $e) {
|
||||
// nothing is whitelisted
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether a full scan was requested.
|
||||
*
|
||||
* This can be set in the `phpunit.xml` used to run these test cases, by setting the constant
|
||||
* `TESTCODESTYLE_IS_FULL_SCAN` to `1`, e.g.:
|
||||
* ```xml
|
||||
* <php>
|
||||
* <!-- TESTCODESTYLE_IS_FULL_SCAN - specify if full scan should be performed for test code style test -->
|
||||
* <const name="TESTCODESTYLE_IS_FULL_SCAN" value="0"/>
|
||||
* </php>
|
||||
* ```
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function isFullScan(): bool
|
||||
{
|
||||
return defined('TESTCODESTYLE_IS_FULL_SCAN') && TESTCODESTYLE_IS_FULL_SCAN === '1';
|
||||
}
|
||||
|
||||
/**
|
||||
* Test code quality using phpcs
|
||||
*/
|
||||
public function testCodeStyle()
|
||||
{
|
||||
$reportFile = self::$reportDir . '/phpcs_report.txt';
|
||||
if (!file_exists($reportFile)) {
|
||||
touch($reportFile);
|
||||
}
|
||||
$codeSniffer = new CodeSniffer('Magento', $reportFile, new Wrapper());
|
||||
$fileList = $this->isFullScan() ? $this->getFullWhitelist() : self::getWhitelist(['php', 'phtml']);
|
||||
$ignoreList = Files::init()->readLists(__DIR__ . '/_files/phpcs/ignorelist/*.txt');
|
||||
if ($ignoreList) {
|
||||
$ignoreListPattern = sprintf('#(%s)#i', implode('|', $ignoreList));
|
||||
$fileList = array_filter(
|
||||
$fileList,
|
||||
function ($path) use ($ignoreListPattern) {
|
||||
return !preg_match($ignoreListPattern, $path);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
$result = $codeSniffer->run($fileList);
|
||||
$report = file_get_contents($reportFile);
|
||||
$this->assertEquals(
|
||||
0,
|
||||
$result,
|
||||
"PHP Code Sniffer detected {$result} violation(s): " . PHP_EOL . $report
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test code quality using phpmd
|
||||
*/
|
||||
public function testCodeMess()
|
||||
{
|
||||
$reportFile = self::$reportDir . '/phpmd_report.txt';
|
||||
$codeMessDetector = new CodeMessDetector(realpath(__DIR__ . '/_files/phpmd/ruleset.xml'), $reportFile);
|
||||
|
||||
if (!$codeMessDetector->canRun()) {
|
||||
$this->markTestSkipped('PHP Mess Detector is not available.');
|
||||
}
|
||||
$fileList = self::getWhitelist(['php']);
|
||||
$ignoreList = Files::init()->readLists(__DIR__ . '/_files/phpmd/ignorelist/*.txt');
|
||||
if ($ignoreList) {
|
||||
$ignoreListPattern = sprintf('#(%s)#i', implode('|', $ignoreList));
|
||||
$fileList = array_filter(
|
||||
$fileList,
|
||||
function ($path) use ($ignoreListPattern) {
|
||||
return !preg_match($ignoreListPattern, $path);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
$result = $codeMessDetector->run($fileList);
|
||||
|
||||
$output = "";
|
||||
if (file_exists($reportFile)) {
|
||||
$output = file_get_contents($reportFile);
|
||||
}
|
||||
|
||||
$this->assertEquals(
|
||||
Command::EXIT_SUCCESS,
|
||||
$result,
|
||||
"PHP Code Mess has found error(s):" . PHP_EOL . $output
|
||||
);
|
||||
|
||||
// delete empty reports
|
||||
if (file_exists($reportFile)) {
|
||||
unlink($reportFile);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test code quality using phpcpd
|
||||
*/
|
||||
public function testCopyPaste()
|
||||
{
|
||||
$reportFile = self::$reportDir . '/phpcpd_report.xml';
|
||||
$copyPasteDetector = new CopyPasteDetector($reportFile);
|
||||
|
||||
if (!$copyPasteDetector->canRun()) {
|
||||
$this->markTestSkipped('PHP Copy/Paste Detector is not available.');
|
||||
}
|
||||
|
||||
$blackList = [];
|
||||
foreach (glob(__DIR__ . '/_files/phpcpd/blacklist/*.txt') as $list) {
|
||||
$blackList[] = file($list, FILE_IGNORE_NEW_LINES);
|
||||
}
|
||||
$blackList = array_merge([], ...$blackList);
|
||||
|
||||
$copyPasteDetector->setBlackList($blackList);
|
||||
|
||||
$result = $copyPasteDetector->run([BP]);
|
||||
|
||||
$output = file_exists($reportFile) ? file_get_contents($reportFile) : '';
|
||||
|
||||
$this->assertTrue(
|
||||
$result,
|
||||
"PHP Copy/Paste Detector has found error(s):" . PHP_EOL . $output
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests whitelisted files for strict type declarations.
|
||||
*/
|
||||
public function testStrictTypes()
|
||||
{
|
||||
$changedFiles = AddedFiles::getAddedFilesList(self::getChangedFilesBaseDir());
|
||||
|
||||
try {
|
||||
$blackList = Files::init()->readLists(
|
||||
self::getBaseFilesFolder() . '/_files/blacklist/strict_type.txt'
|
||||
);
|
||||
} catch (\Exception $e) {
|
||||
// nothing matched black list
|
||||
$blackList = [];
|
||||
}
|
||||
|
||||
$toBeTestedFiles = array_diff(
|
||||
self::filterFiles($changedFiles, ['php'], []),
|
||||
$blackList
|
||||
);
|
||||
|
||||
$filesMissingStrictTyping = [];
|
||||
foreach ($toBeTestedFiles as $fileName) {
|
||||
$file = file_get_contents($fileName);
|
||||
if (strstr($file, 'strict_types=1') === false) {
|
||||
$filesMissingStrictTyping[] = $fileName;
|
||||
}
|
||||
}
|
||||
|
||||
$this->assertCount(
|
||||
0,
|
||||
$filesMissingStrictTyping,
|
||||
"Following files are missing strict type declaration:"
|
||||
. PHP_EOL
|
||||
. implode(PHP_EOL, $filesMissingStrictTyping)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test code quality using PHPStan
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function testPhpStan()
|
||||
{
|
||||
$reportFile = self::$reportDir . '/phpstan_report.txt';
|
||||
$confFile = __DIR__ . '/_files/phpstan/phpstan.neon';
|
||||
|
||||
if (!file_exists($reportFile)) {
|
||||
touch($reportFile);
|
||||
}
|
||||
|
||||
$fileList = self::getWhitelist(['php']);
|
||||
$blackList = Files::init()->readLists(__DIR__ . '/_files/phpstan/blacklist/*.txt');
|
||||
if ($blackList) {
|
||||
$blackListPattern = sprintf('#(%s)#i', implode('|', $blackList));
|
||||
$fileList = array_filter(
|
||||
$fileList,
|
||||
function ($path) use ($blackListPattern) {
|
||||
return !preg_match($blackListPattern, $path);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
$phpStan = new PhpStan($confFile, $reportFile);
|
||||
$exitCode = $phpStan->run($fileList);
|
||||
$report = file_get_contents($reportFile);
|
||||
|
||||
$errorMessage = empty($report) ?
|
||||
'PHPStan command run failed.' : 'PHPStan detected violation(s):' . PHP_EOL . $report;
|
||||
$this->assertEquals(0, $exitCode, $errorMessage);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests whitelisted fixtures for reuse other fixtures.
|
||||
*/
|
||||
public function testFixtureReuse()
|
||||
{
|
||||
$changedFiles = self::getWhitelist(['php']);
|
||||
$toBeTestedFiles = self::filterFiles($changedFiles, ['php'], []);
|
||||
|
||||
$filesWithIncorrectReuse = [];
|
||||
foreach ($toBeTestedFiles as $fileName) {
|
||||
//check only _files and Fixtures directory
|
||||
if (!preg_match('/integration.+\/(_files|Fixtures)/', $fileName)) {
|
||||
continue;
|
||||
}
|
||||
$file = str_replace(["\n", "\r"], '', file_get_contents($fileName));
|
||||
if (preg_match('/(?<![\=\s*])\b(require|require_once|include)\b/', $file)) {
|
||||
$filesWithIncorrectReuse[] = $fileName;
|
||||
}
|
||||
}
|
||||
|
||||
$this->assertEquals(
|
||||
0,
|
||||
count($filesWithIncorrectReuse),
|
||||
"The following files incorrectly reuse fixtures:"
|
||||
. PHP_EOL
|
||||
. implode(PHP_EOL, $filesWithIncorrectReuse)
|
||||
. PHP_EOL
|
||||
. 'Please use Magento\TestFramework\Workaround\Override\Fixture\Resolver::requireDataFixture'
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
# Format: <componentType=module|library|theme|language|*> <componentName> <globPattern> or simply <globPattern>
|
||||
@@ -0,0 +1,113 @@
|
||||
app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php
|
||||
app/code/Magento/Backend/Block/Dashboard/Tab/Customers/Most.php
|
||||
app/code/Magento/Backend/Test/Unit/Model/_files/
|
||||
app/code/Magento/Bundle
|
||||
app/code/Magento/Catalog/Model/Product/Visibility.php
|
||||
app/code/Magento/Catalog/Model/Product/Attribute/Source/Status.php
|
||||
app/code/Magento/Catalog/Model/Category.php
|
||||
app/code/Magento/Catalog/Model/ResourceModel/Product/Link/SaveHandler.php
|
||||
dev
|
||||
lib/internal/Magento/Framework/DB/Select/RendererProxy.php
|
||||
lib/internal/Magento/Framework/DB/Query/Generator.php
|
||||
app/code/Magento/Paypal/Model/Method/Agreement.php
|
||||
app/code/Magento/Paypal/Test/Unit/Model/_files/additional_info_data.php
|
||||
app/code/Magento/Downloadable/Model/Link.php
|
||||
app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/Creditmemo.php
|
||||
app/code/Magento/Downloadable/Model/ResourceModel/Link/Collection.php
|
||||
app/code/Magento/Downloadable/Ui/DataProvider/Product/Form/Modifier/Links.php
|
||||
app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Crosssell.php
|
||||
app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Related.php
|
||||
app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Upsell.php
|
||||
app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Advanced.php
|
||||
app/code/Magento/Catalog/Block/Adminhtml/Category/Helper/Sortby/Available.php
|
||||
app/code/Magento/Catalog/Model/Layer/Filter/Dynamic/Auto.php
|
||||
app/code/Magento/Sales/Model/Order/Pdf/
|
||||
app/code/Magento/Sales/Model/Order/CreditmemoRepository.php
|
||||
app/code/Magento/Sales/Model/Order/Email/Container/
|
||||
app/code/Magento/Sales/Model/Order/Invoice.php
|
||||
app/code/Magento/Sales/Model/Order/Invoice/Item.php
|
||||
app/code/Magento/Sales/Model/Order/Creditmemo/Item.php
|
||||
app/code/Magento/Sales/Model/Order/ShipmentRepository.php
|
||||
app/code/Magento/Sales/Model/ResourceModel/Order/Creditmemo/Relation/Refund.php
|
||||
app/code/Magento/Sales/Model/Order/Shipment/Sender/EmailSender.php
|
||||
app/code/Magento/Sales/Model/Order/Invoice/Sender/EmailSender.php
|
||||
app/code/Magento/Sales/Model/Order/Email/Sender/CreditmemoSender.php
|
||||
app/code/Magento/Cms/Model/ResourceModel/Page/Grid/Collection.php
|
||||
app/code/Magento/Shipping/Block/Order/Shipment.php
|
||||
app/code/Magento/Sales/Block/Order/Creditmemo.php
|
||||
app/code/Magento/Sales/Block/Order/Invoice.php
|
||||
app/code/Magento/Sales/Block/Order/PrintOrder/Creditmemo.php
|
||||
app/code/Magento/Sales/Controller/Adminhtml/Order/Creditmemo/NewAction.php
|
||||
app/code/Magento/AdvancedCheckout/Controller/Adminhtml/Index/ConfigureQuoteItems.php
|
||||
app/code/Magento/AdvancedPricingImportExport/Model/Export/AdvancedPricing.php
|
||||
app/code/Magento/Cron/Model/Config/Backend/Product/Alert.php
|
||||
app/code/Magento/Customer/Controller/Adminhtml/Address/Viewfile.php
|
||||
app/code/Magento/Customer/Model/Metadata/Form/AbstractData.php
|
||||
app/code/Magento/GiftMessage/Block/Adminhtml/Sales/Order/View/Items.php
|
||||
app/code/Magento/ImportExport/Model/Export/Entity/AbstractEntity.php
|
||||
app/code/Magento/ImportExport/Model/Import/Entity/AbstractEntity.php
|
||||
app/code/Magento/Newsletter/Block/Adminhtml/Queue/Preview/Form.php
|
||||
app/code/Magento/ProductAlert/Model/Observer.php
|
||||
app/code/Magento/Reports/Block/Adminhtml/Sales/Invoiced/Grid.php
|
||||
app/code/Magento/Reports/Model/ResourceModel/Customer/Totals/Collection.php
|
||||
app/code/Magento/Review/Block/Customer/View.php
|
||||
app/code/Magento/Rule/Test/Mftf/Helper/RuleHelper.php
|
||||
app/code/Magento/Sales/Block/Adminhtml/Order/Status/NewStatus/Form.php
|
||||
app/code/Magento/Sales/Model/ResourceModel/Collection/AbstractCollection.php
|
||||
app/code/Magento/Sales/Model/ResourceModel/Report/
|
||||
app/code/Magento/Search/Block/Adminhtml/Dashboard/Last.php
|
||||
app/code/Magento/Shipping/Model/Carrier/AbstractCarrierOnline.php
|
||||
app/code/Magento/CatalogRule/Model/ResourceModel/SaveHandler.php
|
||||
lib/internal/Magento/Framework/HTTP/Client/Socket.php
|
||||
lib/internal/Magento/Framework/App/Config/Scope/Validator.php
|
||||
app/code/Magento/Cron/Model/Schedule.php
|
||||
generated/code
|
||||
lib/internal/Magento/Framework/Filesystem/Driver/File/Mime.php
|
||||
app/code/Magento/Shipping/Model/Rate/PackageResult.php
|
||||
app/code/Magento/Ui/DataProvider/AbstractDataProvider.php
|
||||
app/code/Magento/Ui/Config/Converter/Url.php
|
||||
app/code/Magento/Ui/Config/Converter/Buttons.php
|
||||
app/code/Magento/Ui/Controller/Adminhtml/Index/Render.php
|
||||
app/code/Magento/Sales/Api/Data/CreditmemoItemInterface.php
|
||||
vendor
|
||||
lib/internal/Magento/Framework/DataObject/Copy/Config/Data/Proxy.php
|
||||
app/code/Magento/Catalog/Setup/Patch/Data/UpgradeWebsiteAttributes.php
|
||||
app/code/Magento/CatalogUrlRewrite/Setup/Recurring.php
|
||||
app/code/Magento/Checkout/Setup/Patch/Data/PrepareInitialCheckoutConfiguration.php
|
||||
app/code/Magento/ConfigurableProduct/Setup/Recurring.php
|
||||
app/code/Magento/Sales/Setup/SalesSetup.php
|
||||
app/code/Magento/Weee/Setup/Recurring.php
|
||||
app/code/Magento/Wishlist/Setup/Recurring.php
|
||||
setup/src/Magento/Setup/Fixtures
|
||||
app/code/Magento/Catalog/Model/Indexer/Category/Product/Action/Rows.php
|
||||
app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/Query/BaseFinalPrice.php
|
||||
app/code/Magento/Catalog/Model/Attribute/Backend/ConsumerWebsiteAssign.php
|
||||
app/code/Magento/Catalog/Ui/Component/Listing/
|
||||
app/code/Magento/Payment/Gateway/Data/Order/AddressAdapter.php
|
||||
app/code/Magento/SalesRule/Model/CouponRepository.php
|
||||
app/code/Magento/SalesRule/Test/Unit/Model/Rule/Metadata/_files/MetaData.php
|
||||
app/code/Magento/Tax/Model/Calculation/UnitBaseCalculator.php
|
||||
app/code/Magento/Customer/Block/Widget/
|
||||
app/code/Magento/Persistent/Observer/EmulateCustomerObserver.php
|
||||
app/code/Magento/Eav/Model/Api/SearchCriteria/CollectionProcessor/FilterProcessor.php
|
||||
lib/internal/Magento/Framework/App/AreaList/Proxy.php
|
||||
lib/internal/Magento/Framework/App/Route/ConfigInterface/Proxy.php
|
||||
lib/internal/Magento/Framework/Backup/Filesystem/Iterator/Filter.php
|
||||
app/code/Magento/Theme/Model/Indexer/Design/Config.php
|
||||
lib/internal/Magento/Framework/Mview/Config/Data/Proxy.php
|
||||
lib/internal/Magento/Framework/View/File/Collector/Override
|
||||
lib/internal/Magento/Framework/MessageQueue/Consumer/Config/ConsumerConfigItem/
|
||||
lib/internal/Magento/Framework/MessageQueue/Publisher/Config/PublisherConfigItem/Iterator.php
|
||||
lib/internal/Magento/Framework/MessageQueue/Topology/Config/ExchangeConfigItem/Iterator.php
|
||||
app/code/Magento/Integration/Model/IntegrationConfig.php
|
||||
*Test.php
|
||||
Test/_files
|
||||
Test/Unit/_files
|
||||
Test/Integration/_files
|
||||
app/code/Magento/Elasticsearch/Elasticsearch5/Model/Adapter/FieldMapper/Product/FieldProvider/FieldType/Resolver/CompositeResolver.php
|
||||
app/code/Magento/Elasticsearch/Model/Layer/Search/ItemCollectionProvider.php
|
||||
app/code/Magento/Newsletter/Model/Queue/TransportBuilder.php
|
||||
app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/attribute/steps/bulk.phtml
|
||||
app/code/Magento/GoogleGtag
|
||||
app/code/Magento/AdminAdobeIms/Observer/AuthObserver
|
||||
app/code/Magento/OpenSearch/SearchAdapter/Adapter
|
||||
@@ -0,0 +1,11 @@
|
||||
app/code/Magento/InventoryBundleProductIndexer/Indexer/SelectBuilder.php
|
||||
app/code/Magento/InventoryConfigurableProductIndexer/Indexer/SelectBuilder.php
|
||||
app/code/Magento/InventoryCatalogAdminUi/Controller/Adminhtml/Source/BulkAssignPost.php
|
||||
app/code/Magento/InventoryBundleProductIndexer/Indexer/SourceItem/SourceItemIndexer.php
|
||||
app/code/Magento/InventoryShippingAdminUi/Ui/DataProvider/GetSourcesByOrderIdSkuAndQty.php
|
||||
app/code/Magento/InventoryBundleProductIndexer/Indexer/SourceItem/SiblingSkuListInStockProvider.php
|
||||
app/code/Magento/InventoryInStorePickupWebapiExtension/Model/Rest/Swagger/Generator.php
|
||||
app/code/Magento/InventoryAdminUi/Controller/Adminhtml/Source/MassDisable.php
|
||||
app/code/Magento/InventoryBundleProductIndexer/Indexer/StockIndexer.php
|
||||
app/code/Magento/InventoryBundleProductIndexer/Indexer/SelectBuilder.php
|
||||
app/code/Magento/InventoryConfigurableProductIndexer/Indexer/SourceItem/SiblingSkuListInStockProvider.php
|
||||
@@ -0,0 +1,49 @@
|
||||
<?xml version='1.0' encoding="UTF-8"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<ruleset name="Magento PHPMD rule set" xmlns="http://pmd.sf.net/ruleset/1.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
|
||||
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
|
||||
<description>Magento Code Check Rules</description>
|
||||
<php-includepath>../../../../../../framework</php-includepath>
|
||||
|
||||
<!-- Code Size Rules -->
|
||||
<rule ref="rulesets/codesize.xml/CyclomaticComplexity" />
|
||||
<rule ref="rulesets/codesize.xml/NPathComplexity" />
|
||||
<rule ref="rulesets/codesize.xml/ExcessiveMethodLength" />
|
||||
<rule ref="rulesets/codesize.xml/ExcessiveParameterList" />
|
||||
<rule ref="rulesets/codesize.xml/ExcessivePublicCount" />
|
||||
<rule ref="rulesets/codesize.xml/TooManyFields" />
|
||||
<rule ref="rulesets/codesize.xml/ExcessiveClassComplexity">
|
||||
<properties>
|
||||
<property name="maximum" value="100" />
|
||||
</properties>
|
||||
</rule>
|
||||
|
||||
<!-- Unused code rules -->
|
||||
<rule ref="rulesets/unusedcode.xml" />
|
||||
|
||||
<!-- Code design rules -->
|
||||
<rule ref="rulesets/design.xml/NumberOfChildren" />
|
||||
<rule ref="rulesets/design.xml/DepthOfInheritance">
|
||||
<properties>
|
||||
<property name="minimum" value="8" />
|
||||
</properties>
|
||||
</rule>
|
||||
<rule ref="rulesets/design.xml/CouplingBetweenObjects" />
|
||||
|
||||
<!-- Naming Rules -->
|
||||
<rule ref="rulesets/naming.xml/ShortMethodName" />
|
||||
<rule ref="rulesets/naming.xml/ConstantNamingConventions" />
|
||||
<rule ref="rulesets/naming.xml/BooleanGetMethodName" />
|
||||
|
||||
<!-- Magento Specific Rules -->
|
||||
<rule ref="Magento/CodeMessDetector/resources/rulesets/design.xml/AllPurposeAction" />
|
||||
<rule ref="Magento/CodeMessDetector/resources/rulesets/design.xml/CookieAndSessionMisuse" />
|
||||
|
||||
</ruleset>
|
||||
@@ -0,0 +1,23 @@
|
||||
# Format: path to directory or path to file
|
||||
#
|
||||
# Example:
|
||||
# app/code/Magento/Catalog
|
||||
# dev/tests/static/framework/bootstrap.php
|
||||
lib/internal/Magento/Framework/Cache/Backend/Eaccelerator.php
|
||||
lib/internal/Magento/Framework/Image/Adapter/ImageMagick.php
|
||||
lib/internal/Magento/Framework/Interception/Test/Unit/Code/Generator/InterceptorTest.php
|
||||
lib/internal/Magento/Framework/Interception/Test/Unit/Config/ConfigTest.php
|
||||
dev/tests/integration/framework/deployTestModules.php
|
||||
dev/tests/integration/testsuite/Magento/Framework/Code/Generator/AutoloaderTest.php
|
||||
dev/tests/integration/testsuite/Magento/Framework/Communication/ConfigTest.php
|
||||
dev/tests/integration/testsuite/Magento/Framework/Filter/DirectiveProcessor/SimpleDirectiveTest.php
|
||||
dev/tests/integration/testsuite/Magento/Framework/Session/ConfigTest.php
|
||||
dev/tests/integration/testsuite/Magento/Framework/Session/SessionManagerTest.php
|
||||
dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/AbstractFiltersTest.php
|
||||
dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/CategoryTest.php
|
||||
dev/tests/api-functional/testsuite/Magento/Customer/Api/AddressRepositoryTest.php
|
||||
dev/tests/api-functional/testsuite/Magento/Framework/Model/Entity/HydratorTest.php
|
||||
dev/tests/api-functional/testsuite/Magento/Integration/Model/AdminTokenServiceTest.php
|
||||
dev/tests/api-functional/testsuite/Magento/Integration/Model/CustomerTokenServiceTest.php
|
||||
app/code/Magento/Developer/Test/Unit/Console/Command/DevTestsRunCommandTest.php
|
||||
app/code/Magento/OfflineShipping/Test/Unit/Model/ResourceModel/Carrier/Tablerate/CSV/ColumnResolverTest.php
|
||||
@@ -0,0 +1,49 @@
|
||||
parameters:
|
||||
checkExplicitMixedMissingReturn: true
|
||||
checkPhpDocMissingReturn: true
|
||||
reportUnmatchedIgnoredErrors: false
|
||||
excludePaths:
|
||||
- %rootDir%/../../../lib/internal/Magento/Framework/ObjectManager/Test/Unit/*
|
||||
- %rootDir%/../../../*/_files/*
|
||||
- %rootDir%/../../../dev/tests/*/Fixtures/*
|
||||
- %rootDir%/../../../dev/tests/*/tmp/*
|
||||
- %rootDir%/../../../dev/tests/*/_generated/*
|
||||
- %rootDir%/../../../pub/*
|
||||
scanDirectories:
|
||||
- %rootDir%/../../../dev/tests/static/framework/tests/unit/testsuite/Magento
|
||||
- %rootDir%/../../../dev/tests/integration/framework/tests/unit/testsuite/Magento
|
||||
- %rootDir%/../../../dev/tests/api-functional/_files/Magento
|
||||
bootstrapFiles:
|
||||
- %rootDir%/../../../dev/tests/static/framework/autoload.php
|
||||
- %rootDir%/../../../dev/tests/integration/framework/autoload.php
|
||||
- %rootDir%/../../../dev/tests/api-functional/framework/autoload.php
|
||||
- %rootDir%/../../../dev/tests/setup-integration/framework/autoload.php
|
||||
- %rootDir%/../../../dev/tests/static/framework/Magento/PhpStan/autoload.php
|
||||
ignoreErrors:
|
||||
# Ignore PHPStan\Rules\Classes\UnusedConstructorParametersRule
|
||||
- '#Constructor of class [a-zA-Z0-9\\_]+ has an unused parameter#'
|
||||
# Ignore setCustomErrorHandler function not found in bootstrap files
|
||||
- '#Function setCustomErrorHandler not found#'
|
||||
# Ignore 'return statement is missing' error when 'void' is present in return type list
|
||||
- '#Method (?:.*?) should return (?:.*?)void(?:.*?) but return statement is missing.#'
|
||||
# Ignore constants, defined dynamically.
|
||||
- '#Constant TESTS_WEB_API_ADAPTER not found.#'
|
||||
- '#Constant TESTS_BASE_URL not found.#'
|
||||
- '#Constant TESTS_XDEBUG_ENABLED not found.#'
|
||||
- '#Constant TESTS_XDEBUG_SESSION not found.#'
|
||||
- '#Constant INTEGRATION_TESTS_DIR not found.#'
|
||||
- '#Constant MAGENTO_MODULES_PATH not found.#'
|
||||
- '#Constant TESTS_MODULES_PATH not found.#'
|
||||
- '#Constant TESTS_INSTALLATION_DB_CONFIG_FILE not found.#'
|
||||
- '#Constant T_[A-Z_]+ not found.#'
|
||||
|
||||
|
||||
services:
|
||||
-
|
||||
class: Magento\PhpStan\Reflection\Php\DataObjectClassReflectionExtension
|
||||
tags: {phpstan.broker.methodsClassReflectionExtension: {priority: 100}}
|
||||
|
||||
errorFormatter.filtered:
|
||||
class: Magento\PhpStan\Formatters\FilteredErrorFormatter
|
||||
arguments:
|
||||
tableErrorFormatter: @errorFormatter.table
|
||||
@@ -0,0 +1,6 @@
|
||||
# Format: <componentType=module|library|theme|language|*> <componentName> <globPattern> or simply <globPattern>
|
||||
* * /
|
||||
dev/tests
|
||||
phpserver
|
||||
pub
|
||||
setup
|
||||
Reference in New Issue
Block a user