Skip to content

Commit c9f5024

Browse files
authored
Fix handling of severity if it's not lowercase (#77)
1 parent fe2bd1a commit c9f5024

File tree

5 files changed

+19
-0
lines changed

5 files changed

+19
-0
lines changed

.editorconfig

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ trim_trailing_whitespace = true
1010
indent_style = space
1111
indent_size = 4
1212

13+
[*.expect]
14+
insert_final_newline = false;
15+
1316
[*.md]
1417
max_line_length = 80
1518

cs2pr

+1
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ function relativePath($path)
144144

145145
function annotateType($type, $noticeAsWarning)
146146
{
147+
$type = strtolower($type);
147148
if (in_array($type, array('error', 'failure'))) {
148149
return 'error';
149150
}

tests/errors/mixed-case.expect

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
::error file=redaxo\src\addons\2factor_auth\boot.php,line=6::Call to static method getInstance() on an unknown class rex_one_time_password.
2+
::error file=redaxo\src\addons\2factor_auth\boot.php,line=9::Call to static method getInstance() on an unknown class rex_minibar.
3+
::error file=redaxo\src\addons\2factor_auth\lib\one_time_password.php,line=0::Class rex_one_time_password was not found while trying to analyse it - autoloading is probably not configured properly.

tests/errors/mixed-case.xml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<checkstyle>
3+
<file name="redaxo\src\addons\2factor_auth\boot.php">
4+
<error line="6" column="1" severity="ERROR" message="Call to static method getInstance() on an unknown class rex_one_time_password." />
5+
<error line="9" column="1" severity="FAILURE" message="Call to static method getInstance() on an unknown class rex_minibar." />
6+
</file>
7+
<file name="redaxo\src\addons\2factor_auth\lib\one_time_password.php">
8+
<error line="0" column="1" severity="Error" message="Class rex_one_time_password was not found while trying to analyse it - autoloading is probably not configured properly." />
9+
</file>
10+
</checkstyle>

tests/tests.php

+2
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,5 @@ function testXml($xmlPath, $expectedExit, $expectedOutput = null, $options = '')
5858

5959
testXml(__DIR__.'/noerrors/only-header.xml', 0, file_get_contents(__DIR__.'/noerrors/only-header.expect'));
6060
testXml(__DIR__.'/noerrors/only-header-php-cs-fixer.xml', 0, file_get_contents(__DIR__.'/noerrors/only-header-php-cs-fixer.expect'));
61+
62+
testXml(__DIR__.'/errors/mixed-case.xml', 1, file_get_contents(__DIR__.'/errors/mixed-case.expect'));

0 commit comments

Comments
 (0)