Skip to content

Commit a3dfb3d

Browse files
committed
Add new mago workflow
1 parent 4961d4a commit a3dfb3d

File tree

6 files changed

+222
-3
lines changed

6 files changed

+222
-3
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ webpack.config.js export-ignore
4141
/stripe/js/frmstrp.js export-ignore
4242
rector.php export-ignore
4343
_typos.toml export-ignore
44+
mago.toml export-ignore
4445
/resources/ export-ignore
4546
webpack.dev.js export-ignore
4647
.browserslistrc export-ignore

.github/workflows/mago.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
on: [push]
2+
3+
name: Mago Code Analysis and Linting
4+
jobs:
5+
mago:
6+
name: Mago
7+
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: "📥 Fetching Repository Contents"
12+
uses: actions/[email protected]
13+
14+
- name: "💽 Installing PHP"
15+
uses: shivammathur/setup-php@v2
16+
with:
17+
php-version: 8.2
18+
coverage: none
19+
ini-values: display_errors=On, error_reporting=E_ALL
20+
21+
- name: "⚡ Install Mago"
22+
run: curl --proto '=https' --tlsv1.2 -sSf https://carthage.software/mago.sh | bash
23+
24+
- name: "✅ Mago Lint"
25+
run: ./bin/mago lint
26+
27+
- name: "🔎 Mago Analyze"
28+
run: ./bin/mago analyze

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,5 @@ sonar-project.properties
3535
.sonar_lock
3636
report-task.txt
3737

38+
# Mago
39+
bin/mago

bin/zip-plugin.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ zip -r $zipname $destination \
115115
-x "*/report-task.txt" \
116116
-x "*/cypress.config.js" \
117117
-x "*/_typos.toml" \
118+
-x "*/mago.toml" \
118119
-x "formidable-ai/resources/*" \
119120
-x "*/webpack.dev.js" \
120121
-x "*/phpcs-sniffs/*"

mago.toml

Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
# Welcome to Mago!
2+
# For full documentation, see https://mago.carthage.software/tools/overview
3+
php-version = "8.5.0"
4+
5+
[source]
6+
workspace = "."
7+
paths = [
8+
"formidable.php",
9+
"classes",
10+
"paypal",
11+
"stripe",
12+
"square",
13+
"tests",
14+
]
15+
includes = []
16+
excludes = ["vendor", "node_modules", "mago"]
17+
extensions = ["php"]
18+
19+
[formatter]
20+
preset = "default"
21+
use-tabs = true
22+
23+
[linter]
24+
integrations = []
25+
26+
[linter.rules]
27+
ambiguous-function-call = { enabled = false }
28+
literal-named-argument = { enabled = false }
29+
array-style = { enabled = false }
30+
strict-types = { enabled = false }
31+
no-else-clause = { enabled = false }
32+
no-empty = { enabled = false }
33+
no-global = { enabled = false }
34+
identity-comparison = { enabled = false }
35+
prefer-static-closure = { enabled = false }
36+
prefer-arrow-function = { enabled = false }
37+
class-name = { enabled = false }
38+
no-sprintf-concat = { enabled = false }
39+
prefer-early-continue = { enabled = false }
40+
excessive-parameter-list = { enabled = false }
41+
no-nested-ternary = { enabled = false }
42+
braced-string-interpolation = { enabled = false }
43+
combine-consecutive-issets = { enabled = false }
44+
kan-defect = { enabled = false }
45+
no-request-variable = { enabled = false }
46+
too-many-methods = { enabled = false }
47+
cyclomatic-complexity = { enabled = false }
48+
tagged-todo = { enabled = false }
49+
strict-behavior = { enabled = false }
50+
loop-does-not-iterate = { enabled = false }
51+
explicit-octal = { enabled = false }
52+
no-redundant-math = { enabled = false }
53+
no-error-control-operator = { enabled = false }
54+
no-closing-tag = { enabled = false }
55+
too-many-properties = { enabled = false }
56+
sensitive-parameter = { enabled = false }
57+
halstead = { enabled = false } # Consider enabling this soon.
58+
use-compound-assignment = { enabled = false } # Consider enabling this soon.
59+
require-preg-quote-delimiter = { enabled = false }
60+
no-assign-in-condition = { enabled = false }
61+
no-insecure-comparison = { enabled = false } # Consider enabling this soon.
62+
excessive-nesting = { enabled = false } # Consider enabling this soon.
63+
no-redundant-parentheses = { enabled = false } # Fix this first.
64+
inline-variable-return = { enabled = false } # Fix this first.
65+
no-redundant-method-override = { enabled = false } # Fix this first.
66+
67+
[analyzer]
68+
plugins = []
69+
find-unused-definitions = true
70+
find-unused-expressions = false
71+
analyze-dead-code = true
72+
memoize-properties = true
73+
allow-possibly-undefined-array-keys = true
74+
check-throws = false
75+
check-missing-override = false
76+
find-unused-parameters = false
77+
strict-list-index-checks = false
78+
no-boolean-literal-comparison = false
79+
check-missing-type-hints = false
80+
register-super-globals = true
81+
ignore = [
82+
"invalid-param-tag",
83+
"malformed-docblock-comment",
84+
"non-existent-function",
85+
"undefined-variable",
86+
"mixed-argument",
87+
"redundant-condition",
88+
"mixed-array-access",
89+
"mixed-operand",
90+
"mixed-property-access",
91+
"invalid-global",
92+
"possibly-false-argument",
93+
"unknown-class-instantiation",
94+
"unused-method",
95+
"non-existent-method",
96+
"invalid-return-statement",
97+
"invalid-iterator",
98+
"less-specific-nested-argument-type",
99+
"reference-to-undefined-variable",
100+
"mixed-return-statement",
101+
"redundant-logical-operation",
102+
"undefined-int-array-index",
103+
"possibly-invalid-argument",
104+
"mixed-assignment",
105+
"possibly-null-argument",
106+
"invalid-argument",
107+
"invalid-operand",
108+
"less-specific-return-statement",
109+
"non-existent-constant",
110+
"ambiguous-object-property-access",
111+
"less-specific-argument",
112+
"invalid-type-cast",
113+
"reference-constraint-violation",
114+
"possibly-false-operand",
115+
"nullable-return-statement",
116+
"array-to-string-conversion",
117+
"possibly-undefined-string-array-index",
118+
"redundant-comparison",
119+
"mixed-array-assignment",
120+
"generic-object-iteration",
121+
"mixed-method-access",
122+
"mixed-array-assignment",
123+
"redundant-type-comparison",
124+
"false-argument", # Fix this soon
125+
"mixed-property-type-coercion",
126+
"invalid-method-access",
127+
"possible-method-access-on-null",
128+
"possibly-null-property-access",
129+
"mixed-array-index",
130+
"less-specific-nested-return-statement",
131+
"null-operand",
132+
"invalid-property-access",
133+
"impossible-assignment",
134+
"non-existent-class",
135+
"never-return",
136+
"non-existent-class-like",
137+
"invalid-member-selector",
138+
"non-existent-property",
139+
"invalid-member-selector",
140+
"too-few-arguments",
141+
"impossible-type-comparison", # Fix this soon
142+
"string-member-selector",
143+
"impossible-condition",
144+
"falsable-return-statement",
145+
"property-type-coercion",
146+
"invalid-property-assignment-value",
147+
"unused-property",
148+
"possibly-undefined-variable",
149+
"impossible-nonnull-entry-check",
150+
"ambiguous-object-method-access",
151+
"null-array-index",
152+
"possibly-null-operand",
153+
"missing-return-statement",
154+
"incompatible-parameter-type",
155+
"null-array-access",
156+
"null-argument",
157+
"mismatched-array-index",
158+
"no-value",
159+
"possibly-invalid-operand",
160+
"non-documented-property",
161+
"conflicting-reference-constraint",
162+
"redundant-null-coalesce",
163+
"unsafe-instantiation",
164+
"invalid-destructuring-source",
165+
"unknown-iterator-type",
166+
"invalid-array-access",
167+
"undefined-variable-in-closure-use",
168+
"possibly-false-iterator",
169+
"invalid-unset",
170+
"redundant-isset-check",
171+
"possibly-invalid-iterator",
172+
"undefined-string-array-index",
173+
"invalid-array-element-key",
174+
"deprecated-function",
175+
"redundant-isset-check",
176+
"mixed-clone",
177+
"invalid-array-index",
178+
"possibly-null-array-access",
179+
"possibly-null-iterator",
180+
"false-operand",
181+
"null-property-access",
182+
"redundant-key-check",
183+
"possibly-null-array-index",
184+
"invalid-property-read",
185+
"possibly-invalid-clone",
186+
"ambiguous-instantiation-target",
187+
"method-access-on-null",
188+
"null-iterator",
189+
]

stripe/helpers/FrmTransLiteListHelper.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,13 @@ private function get_table_query() {
9696
}
9797

9898
// @codingStandardsIgnoreStart
99-
$query = $wpdb->prepare(
99+
return $wpdb->prepare(
100100
"FROM `{$wpdb->prefix}{$table_name}` p
101101
JOIN `{$wpdb->prefix}frm_items` i ON p.item_id = i.id
102102
WHERE i.form_id = %d",
103103
$form_id
104104
);
105105
// @codingStandardsIgnoreEnd
106-
107-
return $query;
108106
}
109107

110108
/**

0 commit comments

Comments
 (0)