Skip to content

Commit 9706441

Browse files
authored
Merge pull request #37 from magento/REPO-70-Assign-severity-to-each-sniff
Assign severity to each sniff
2 parents d55b20b + 1d0c79a commit 9706441

File tree

4 files changed

+362
-122
lines changed

4 files changed

+362
-122
lines changed

Magento/Sniffs/Legacy/MageEntitySniff.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
*/
1414
class MageEntitySniff implements Sniff
1515
{
16-
/**
17-
* String representation of error.
18-
*
19-
* @var string
20-
*/
16+
/**
17+
* String representation of error.
18+
*
19+
* @var string
20+
*/
2121
protected $errorMessage = 'Possible Magento 2 design violation. Detected typical Magento 1.x construction "%s".';
2222

2323
/**

Magento/Sniffs/Security/IncludeFileSniff.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
*/
1515
class IncludeFileSniff implements Sniff
1616
{
17-
/**
18-
* Warning violation code.
19-
*
20-
* @var string
21-
*/
17+
/**
18+
* Warning violation code.
19+
*
20+
* @var string
21+
*/
2222
protected $warningCode = 'FoundIncludeFile';
2323

2424
/**
@@ -93,7 +93,7 @@ public function process(File $phpcsFile, $stackPtr)
9393
if ($hasVariable) {
9494
$message .= ' Variables inside are insecure.';
9595
}
96-
$phpcsFile->addWarning(
96+
$phpcsFile->addError(
9797
$message,
9898
$stackPtr,
9999
$this->warningCode,

Magento/Tests/Security/IncludeFileUnitTest.php

+9-8
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright © Magento. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
67
namespace Magento\Tests\Security;
78

89
use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
@@ -16,14 +17,6 @@ class IncludeFileUnitTest extends AbstractSniffUnitTest
1617
* @inheritdoc
1718
*/
1819
public function getErrorList()
19-
{
20-
return [];
21-
}
22-
23-
/**
24-
* @inheritdoc
25-
*/
26-
public function getWarningList()
2720
{
2821
return [
2922
3 => 1,
@@ -42,4 +35,12 @@ public function getWarningList()
4235
34 => 1,
4336
];
4437
}
38+
39+
/**
40+
* @inheritdoc
41+
*/
42+
public function getWarningList()
43+
{
44+
return [];
45+
}
4546
}

0 commit comments

Comments
 (0)