sdc-build-wp 5.6.12 → 5.6.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.phpcs.xml +0 -6
- package/lib/components/php.js +23 -11
- package/lib/tui.js +4 -10
- package/package.json +1 -1
package/.phpcs.xml
CHANGED
|
@@ -13,12 +13,6 @@
|
|
|
13
13
|
</rule>
|
|
14
14
|
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
|
|
15
15
|
<rule ref="Generic.WhiteSpace.LanguageConstructSpacing"/>
|
|
16
|
-
<rule ref="Generic.WhiteSpace.ScopeIndent">
|
|
17
|
-
<properties>
|
|
18
|
-
<property name="exact" value="true" />
|
|
19
|
-
<property name="indent" value="2"/>
|
|
20
|
-
</properties>
|
|
21
|
-
</rule>
|
|
22
16
|
<rule ref="Generic.WhiteSpace.ArbitraryParenthesesSpacing"/>
|
|
23
17
|
<rule ref="Generic.WhiteSpace.DisallowTabIndent"/>
|
|
24
18
|
<rule ref="Generic.CodeAnalysis.EmptyPHPStatement"/>
|
package/lib/components/php.js
CHANGED
|
@@ -83,21 +83,33 @@ export default class PHPComponent extends BaseComponent {
|
|
|
83
83
|
} catch (error) {
|
|
84
84
|
// Filter out Time: and Memory: lines from error output
|
|
85
85
|
const filterLines = str => str
|
|
86
|
-
? str.split('\n').filter(line => !line.trim().startsWith('Time:') && !line.trim().startsWith('Memory:')).join('\n')
|
|
86
|
+
? str.split('\n').filter(line => !line.trim().startsWith('Time:') && !line.trim().startsWith('Memory:')).join('\n').trim()
|
|
87
87
|
: str;
|
|
88
|
-
|
|
88
|
+
const filteredStderr = filterLines(error.stderr);
|
|
89
|
+
const filteredStdout = filterLines(error.stdout);
|
|
90
|
+
if (filteredStderr && error.stderr.includes('No fixable errors were found')) {
|
|
89
91
|
// No fixable errors were found
|
|
90
92
|
} else if (
|
|
91
|
-
(
|
|
92
|
-
(
|
|
93
|
-
filterLines(error.stdout)?.length &&
|
|
94
|
-
(
|
|
95
|
-
error.stdout.startsWith('ERROR:') ||
|
|
96
|
-
error.stdout.includes('FAILED TO FIX')
|
|
97
|
-
)
|
|
98
|
-
)
|
|
93
|
+
(filteredStderr && !error.stderr.trim().startsWith('Time:')) ||
|
|
94
|
+
(filteredStdout && (error.stdout.startsWith('ERROR:') || error.stdout.includes('FAILED TO FIX')))
|
|
99
95
|
) {
|
|
100
|
-
|
|
96
|
+
let detail = filteredStderr || filteredStdout;
|
|
97
|
+
// If phpcbf failed to fix remaining errors, run phpcs to surface the actual violations
|
|
98
|
+
if (error.stdout.includes('FAILED TO FIX') && options.lintType === 'fix') {
|
|
99
|
+
try {
|
|
100
|
+
const phpcsCmd = [`php`, `-d`, `memory_limit=2G`, `vendor/bin/phpcs`, phpFiles].join(' ');
|
|
101
|
+
const execPromise2 = promisify(exec);
|
|
102
|
+
await execPromise2(phpcsCmd, {
|
|
103
|
+
cwd: this.path.resolve(this.path.dirname(fileURLToPath(import.meta.url)), '../../')
|
|
104
|
+
});
|
|
105
|
+
} catch (phpcsError) {
|
|
106
|
+
const phpcsDetail = filterLines(phpcsError.stdout) || filterLines(phpcsError.stderr);
|
|
107
|
+
if (phpcsDetail) {
|
|
108
|
+
detail = phpcsDetail;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
this.log(null, detail);
|
|
101
113
|
this.log('error', `Failed linting ${entryLabel.replace(this.project.path, '')} - See above error.`);
|
|
102
114
|
return false;
|
|
103
115
|
}
|
package/lib/tui.js
CHANGED
|
@@ -69,11 +69,9 @@ function TUIRoot({ tui }) {
|
|
|
69
69
|
TitledBox,
|
|
70
70
|
{
|
|
71
71
|
borderStyle: 'round',
|
|
72
|
-
borderLeft: false,
|
|
73
|
-
borderRight: false,
|
|
74
72
|
titles: ['SDC Build WP'],
|
|
75
73
|
borderColor: 'blue',
|
|
76
|
-
paddingX:
|
|
74
|
+
paddingX: 1,
|
|
77
75
|
flexDirection: 'column'
|
|
78
76
|
},
|
|
79
77
|
header.titleLine || header.urlLine
|
|
@@ -104,9 +102,7 @@ function TUIRoot({ tui }) {
|
|
|
104
102
|
borderStyle: 'round',
|
|
105
103
|
borderColor: 'blue',
|
|
106
104
|
borderTop: false,
|
|
107
|
-
|
|
108
|
-
borderRight: false,
|
|
109
|
-
paddingX: 0,
|
|
105
|
+
paddingX: 1,
|
|
110
106
|
flexDirection: 'column',
|
|
111
107
|
height: availableLogRows + 1
|
|
112
108
|
},
|
|
@@ -118,9 +114,7 @@ function TUIRoot({ tui }) {
|
|
|
118
114
|
{
|
|
119
115
|
borderStyle: 'round',
|
|
120
116
|
borderColor: 'cyan',
|
|
121
|
-
|
|
122
|
-
borderRight: false,
|
|
123
|
-
paddingX: 0,
|
|
117
|
+
paddingX: 1,
|
|
124
118
|
marginTop: 1,
|
|
125
119
|
flexDirection: 'column'
|
|
126
120
|
},
|
|
@@ -251,7 +245,7 @@ class TUI {
|
|
|
251
245
|
|
|
252
246
|
getHeaderLayout(terminalColumns = 80) {
|
|
253
247
|
const detailLines = [];
|
|
254
|
-
const innerWidth = Math.max(1, terminalColumns);
|
|
248
|
+
const innerWidth = Math.max(1, terminalColumns - 4);
|
|
255
249
|
const statusMessages = [];
|
|
256
250
|
|
|
257
251
|
let titleLine = '';
|