Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ webpack.config.js export-ignore
/stripe/js/frmstrp.js export-ignore
rector.php export-ignore
_typos.toml export-ignore
mago.toml export-ignore
/resources/ export-ignore
webpack.dev.js export-ignore
.browserslistrc export-ignore
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/mago.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
on: [push]

name: Mago Code Analysis and Linting
jobs:
mago:
name: Mago

runs-on: ubuntu-latest

steps:
- name: "📥 Fetching Repository Contents"
uses: actions/[email protected]

- name: "💽 Installing PHP"
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
coverage: none
ini-values: display_errors=On, error_reporting=E_ALL

- name: "⚡ Install Mago"
run: |
mkdir -p bin
curl --proto '=https' --tlsv1.2 -sSf https://carthage.software/mago.sh | bash -s -- --install-dir=bin

- name: "✅ Mago Lint"
run: ./bin/mago lint

- name: "🔎 Mago Analyze"
run: ./bin/mago analyze
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@ sonar-project.properties
.sonar_lock
report-task.txt

# Mago
bin/mago
1 change: 1 addition & 0 deletions bin/zip-plugin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ zip -r $zipname $destination \
-x "*/report-task.txt" \
-x "*/cypress.config.js" \
-x "*/_typos.toml" \
-x "*/mago.toml" \
-x "formidable-ai/resources/*" \
-x "*/webpack.dev.js" \
-x "*/phpcs-sniffs/*"
Expand Down
189 changes: 189 additions & 0 deletions mago.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
# Welcome to Mago!
# For full documentation, see https://mago.carthage.software/tools/overview
php-version = "8.5.0"

[source]
workspace = "."
paths = [
"formidable.php",
"classes",
"paypal",
"stripe",
"square",
"tests",
]
includes = []
excludes = ["vendor", "node_modules", "mago"]
extensions = ["php"]

[formatter]
preset = "default"
use-tabs = true

[linter]
integrations = []

[linter.rules]
ambiguous-function-call = { enabled = false }
literal-named-argument = { enabled = false }
array-style = { enabled = false }
strict-types = { enabled = false }
no-else-clause = { enabled = false }
no-empty = { enabled = false }
no-global = { enabled = false }
identity-comparison = { enabled = false }
prefer-static-closure = { enabled = false }
prefer-arrow-function = { enabled = false }
class-name = { enabled = false }
no-sprintf-concat = { enabled = false }
prefer-early-continue = { enabled = false }
excessive-parameter-list = { enabled = false }
no-nested-ternary = { enabled = false }
braced-string-interpolation = { enabled = false }
combine-consecutive-issets = { enabled = false }
kan-defect = { enabled = false }
no-request-variable = { enabled = false }
too-many-methods = { enabled = false }
cyclomatic-complexity = { enabled = false }
tagged-todo = { enabled = false }
strict-behavior = { enabled = false }
loop-does-not-iterate = { enabled = false }
explicit-octal = { enabled = false }
no-redundant-math = { enabled = false }
no-error-control-operator = { enabled = false }
no-closing-tag = { enabled = false }
too-many-properties = { enabled = false }
sensitive-parameter = { enabled = false }
halstead = { enabled = false } # Consider enabling this soon.
use-compound-assignment = { enabled = false } # Consider enabling this soon.
require-preg-quote-delimiter = { enabled = false }
no-assign-in-condition = { enabled = false }
no-insecure-comparison = { enabled = false } # Consider enabling this soon.
excessive-nesting = { enabled = false } # Consider enabling this soon.
no-redundant-parentheses = { enabled = false } # Fix this first.
inline-variable-return = { enabled = false } # Fix this first.
no-redundant-method-override = { enabled = false } # Fix this first.

[analyzer]
plugins = []
find-unused-definitions = true
find-unused-expressions = false
analyze-dead-code = true
memoize-properties = true
allow-possibly-undefined-array-keys = true
check-throws = false
check-missing-override = false
find-unused-parameters = false
strict-list-index-checks = false
no-boolean-literal-comparison = false
check-missing-type-hints = false
register-super-globals = true
ignore = [
"invalid-param-tag",
"malformed-docblock-comment",
"non-existent-function",
"undefined-variable",
"mixed-argument",
"redundant-condition",
"mixed-array-access",
"mixed-operand",
"mixed-property-access",
"invalid-global",
"possibly-false-argument",
"unknown-class-instantiation",
"unused-method",
"non-existent-method",
"invalid-return-statement",
"invalid-iterator",
"less-specific-nested-argument-type",
"reference-to-undefined-variable",
"mixed-return-statement",
"redundant-logical-operation",
"undefined-int-array-index",
"possibly-invalid-argument",
"mixed-assignment",
"possibly-null-argument",
"invalid-argument",
"invalid-operand",
"less-specific-return-statement",
"non-existent-constant",
"ambiguous-object-property-access",
"less-specific-argument",
"invalid-type-cast",
"reference-constraint-violation",
"possibly-false-operand",
"nullable-return-statement",
"array-to-string-conversion",
"possibly-undefined-string-array-index",
"redundant-comparison",
"mixed-array-assignment",
"generic-object-iteration",
"mixed-method-access",
"mixed-array-assignment",
"redundant-type-comparison",
"false-argument", # Fix this soon
"mixed-property-type-coercion",
"invalid-method-access",
"possible-method-access-on-null",
"possibly-null-property-access",
"mixed-array-index",
"less-specific-nested-return-statement",
"null-operand",
"invalid-property-access",
"impossible-assignment",
"non-existent-class",
"never-return",
"non-existent-class-like",
"invalid-member-selector",
"non-existent-property",
"invalid-member-selector",
"too-few-arguments",
"impossible-type-comparison", # Fix this soon
"string-member-selector",
"impossible-condition",
"falsable-return-statement",
"property-type-coercion",
"invalid-property-assignment-value",
"unused-property",
"possibly-undefined-variable",
"impossible-nonnull-entry-check",
"ambiguous-object-method-access",
"null-array-index",
"possibly-null-operand",
"missing-return-statement",
"incompatible-parameter-type",
"null-array-access",
"null-argument",
"mismatched-array-index",
"no-value",
"possibly-invalid-operand",
"non-documented-property",
"conflicting-reference-constraint",
"redundant-null-coalesce",
"unsafe-instantiation",
"invalid-destructuring-source",
"unknown-iterator-type",
"invalid-array-access",
"undefined-variable-in-closure-use",
"possibly-false-iterator",
"invalid-unset",
"redundant-isset-check",
"possibly-invalid-iterator",
"undefined-string-array-index",
"invalid-array-element-key",
"deprecated-function",
"redundant-isset-check",
"mixed-clone",
"invalid-array-index",
"possibly-null-array-access",
"possibly-null-iterator",
"false-operand",
"null-property-access",
"redundant-key-check",
"possibly-null-array-index",
"invalid-property-read",
"possibly-invalid-clone",
"ambiguous-instantiation-target",
"method-access-on-null",
"null-iterator",
]
4 changes: 1 addition & 3 deletions stripe/helpers/FrmTransLiteListHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,13 @@ private function get_table_query() {
}

// @codingStandardsIgnoreStart
$query = $wpdb->prepare(
return $wpdb->prepare(
"FROM `{$wpdb->prefix}{$table_name}` p
JOIN `{$wpdb->prefix}frm_items` i ON p.item_id = i.id
WHERE i.form_id = %d",
$form_id
);
// @codingStandardsIgnoreEnd

return $query;
}

/**
Expand Down