Skip to content

Commit 03f0a65

Browse files
committed
MQE-1031: Empty files are flagged during generation or dealt with
gracefully - Added windows compatibility for checks - Fixed static check in Filesystem
1 parent 3f4add8 commit 03f0a65

File tree

5 files changed

+60
-10
lines changed

5 files changed

+60
-10
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ coverage/
1313
.vscode
1414
codeception.yml
1515
dev/tests/functional/MFTF.suite.yml
16-
dev/tests/functional/_output
16+
dev/tests/functional/_output
17+
dev/tests/mftf.log

bin/all-checks.bat

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
:: Copyright © Magento, Inc. All rights reserved.
2+
:: See COPYING.txt for license details.
3+
4+
@echo off
5+
call bin\static-checks.bat
6+
7+
@echo off
8+
call bin\phpunit-checks.bat

bin/copyright-check.bat

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
:: Copyright © Magento, Inc. All rights reserved.
2+
:: See COPYING.txt for license details.
3+
4+
@echo off
5+
SETLOCAL EnableDelayedExpansion
6+
SET BLACKLIST_FILE=bin/blacklist.txt
7+
SET i=0
8+
9+
FOR /F %%x IN ('git ls-tree --full-tree -r --name-only HEAD') DO (
10+
SET GOOD_EXT=
11+
if "%%~xx"==".php" set GOOD_EXT=1
12+
if "%%~xx"==".xml" set GOOD_EXT=1
13+
if "%%~xx"==".xsd" set GOOD_EXT=1
14+
IF DEFINED GOOD_EXT (
15+
SET BLACKLISTED=
16+
FOR /F "tokens=* skip=5" %%f IN (%BLACKLIST_FILE%) DO (
17+
SET LINE=%%x
18+
IF NOT "!LINE!"=="!LINE:%%f=!" (
19+
SET BLACKLISTED=1
20+
)
21+
)
22+
IF NOT DEFINED BLACKLISTED (
23+
FIND "Copyright © Magento, Inc. All rights reserved." %%x >nul
24+
IF ERRORLEVEL 1 (
25+
SET /A i+=1
26+
SET NO_COPYRIGHT_LIST[!i!]=%%x
27+
)
28+
)
29+
)
30+
)
31+
32+
IF DEFINED NO_COPYRIGHT_LIST[1] (
33+
ECHO THE FOLLOWING FILES ARE MISSING THE MAGENTO COPYRIGHT:
34+
ECHO.
35+
ECHO Copyright © Magento, Inc. All rights reserved.
36+
ECHO See COPYING.txt for license details.
37+
ECHO.
38+
FOR /L %%a IN (1,1,%i%) DO (
39+
ECHO !NO_COPYRIGHT_LIST[%%a]!
40+
)
41+
)

bin/static-checks.bat

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,15 @@
55

66
@echo off
77
@echo ===============================PHP CODE SNIFFER REPORT===============================
8-
call vendor\bin\phpcs .\src --standard=.\dev\tests\static\Magento --ignore=src\Magento\FunctionalTestingFramework\Group,src\Magento\FunctionalTestingFramework\AcceptanceTester.php
9-
call vendor\bin\phpcs .\dev\tests\unit --standard=.\dev\tests\static\Magento
10-
call vendor\bin\phpcs .\dev\tests\verification --standard=.\dev\tests\static\Magento --ignore=dev\tests\verification\_generated
8+
call vendor\bin\phpcs --standard=.\dev\tests\static\Magento --ignore=src/Magento/FunctionalTestingFramework/Group,src/Magento/FunctionalTestingFramework/AcceptanceTester.php .\src
9+
call vendor\bin\phpcs --standard=.\dev\tests\static\Magento .\dev\tests\unit
10+
call vendor\bin\phpcs --standard=.\dev\tests\static\Magento --ignore=dev/tests/verification/_generated .\dev\tests\verification
1111

1212
@echo ===============================COPY PASTE DETECTOR REPORT===============================
1313
call vendor\bin\phpcpd .\src
1414

15-
@echo "===============================PHP MESS DETECTOR REPORT===============================
16-
vendor\bin\phpmd .\src text \dev\tests\static\Magento\CodeMessDetector\ruleset.xml --exclude _generated,src\Magento\FunctionalTestingFramework\Group,src\Magento\FunctionalTestingFramework\AcceptanceTester.php
15+
@echo ===============================PHP MESS DETECTOR REPORT===============================
16+
call vendor\bin\phpmd --exclude _generated,src\Magento\FunctionalTestingFramework\Group,src\Magento\FunctionalTestingFramework\AcceptanceTester.php .\src text \dev\tests\static\Magento\CodeMessDetector\ruleset.xml
1717

1818
@echo ===============================MAGENTO COPYRIGHT REPORT===============================
19-
echo msgbox "INFO:Copyright check currently not run as part of .bat implementation" > "%temp%\popup.vbs"
20-
wscript.exe "%temp%\popup.vbs"
21-
::bin\copyright-check
19+
call bin\copyright-check.bat

src/Magento/FunctionalTestingFramework/Config/Reader/Filesystem.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* See COPYING.txt for license details.
55
*/
66
namespace Magento\FunctionalTestingFramework\Config\Reader;
7+
78
use Magento\FunctionalTestingFramework\Config\MftfApplicationConfig;
89
use Magento\FunctionalTestingFramework\Util\Logger\LoggingUtil;
910

@@ -211,7 +212,8 @@ protected function verifyFileStatus($content, $fileName)
211212
if (empty($content)) {
212213
if (MftfApplicationConfig::getConfig()->verboseEnabled()) {
213214
LoggingUtil::getInstance()->getLogger(Filesystem::class)->warn(
214-
"XML File is empty.", ["File" => $fileName]
215+
"XML File is empty.",
216+
["File" => $fileName]
215217
);
216218
}
217219
return false;

0 commit comments

Comments
 (0)