AspireCloud/mago.toml
2025-09-27 07:40:10 -06:00

148 lines
6.7 KiB
TOML

# Welcome to Mago!
# For full documentation, see https://mago.carthage.software/tools/overview
php-version = "8.3.0"
[source]
paths = ["app/", "database/factories/", "database/seeders/", "tests/"]
includes = ["vendor"]
excludes = []
[formatter]
inline-empty-function-braces = true
inline-empty-classlike-braces = true
preserve-breaking-member-access-chain = true
preserve-breaking-argument-list = true
preserve-breaking-array-like = true
preserve-breaking-parameter-list = true
preserve-breaking-attribute-list = true
preserve-breaking-conditional-expression = true
break-promoted-properties-list = true
always-break-named-arguments-list = false
[linter]
integrations = ["symfony", "laravel"]
[linter.rules]
# Disable all rules currently firing by default
# vendor/bin/mago lint --reporting-format=emacs | perl -nE 'say qq[$1 = { enabled = false }] if / - (.*?):/' | sort | uniq | pbcopy
assert-description = { enabled = false }
braced-string-interpolation = { enabled = false }
class-name = { enabled = false }
constant-name = { enabled = false }
constant-type = { enabled = false }
cyclomatic-complexity = { enabled = false }
excessive-parameter-list = { enabled = false }
final-controller = { enabled = false }
function-name = { enabled = false }
halstead = { enabled = false }
interface-name = { enabled = false }
literal-named-argument = { enabled = false }
no-assign-in-condition = { enabled = false }
no-boolean-flag-parameter = { enabled = false }
no-boolean-literal-comparison = { enabled = false }
no-else-clause = { enabled = false }
no-empty = { enabled = false }
no-empty-comment = { enabled = false }
no-literal-password = { enabled = false }
no-request-all = { enabled = false }
no-shorthand-ternary = { enabled = false }
parameter-type = { enabled = false }
prefer-arrow-function = { enabled = false }
prefer-first-class-callable = { enabled = false }
property-type = { enabled = false }
return-type = { enabled = false }
strict-behavior = { enabled = false }
tagged-fixme = { enabled = false }
tagged-todo = { enabled = false }
too-many-methods = { enabled = false }
trait-name = { enabled = false }
[analyzer]
# Enable all features and categories, then disable every rule by default
allow-possibly-undefined-array-keys = false
analyze-dead-code = true
check-throws = true
find-unused-definitions = true
find-unused-expressions = true
memoize-properties = true
perform-heuristic-checks = true
# Issue categories
ambiguity-issues = true
argument-issues = true
array-issues = true
deprecation-issues = true
existence-issues = true
falsable-issues = true
generator-issues = true
impossibility-issues = true
iterator-issues = true
method-issues = true
mixed-issues = true
nullable-issues = true
operand-issues = true
property-issues = true
redundancy-issues = true
reference-issues = true
return-issues = true
template-issues = true
unreachable-issues = true
# to get a list of all firing rules suitable for pasting in below:
# vendor/bin/mago analyze --reporting-format=emacs | perl -nE 'say qq{"$1",} if / - (.*?):/' | sort | uniq
ignore = [
"impossible-assignment", # bad type inference
"impossible-condition", # wrong in very obvious places
"impossible-nonnull-entry-check", # confidently claims that keys cannot exist which very well can
"incompatible-property-type", # doesn't allow list<string> as an alias for array<int, string>
"invalid-argument", # bizarre inference failures, also doesn't grok list<>
"invalid-array-index", # doesn't allow non-negative-int
"invalid-destructuring-source", # thinks collections are `mixed`
"invalid-method-access", # completely broken with laravel
"invalid-named-argument", # Unknown argument name `${argument_name}` (definitely a mago bug)
"invalid-operand", # prevents useful control-flow shorthand. would enable if it allowed void context.
"invalid-return-statement", # broken when `static` return type is involved anywhere
"less-specific-nested-argument-type", # fails on every single test. need to disable this just for tests/
"less-specific-nested-return-statement", # can't deal with collection method chaining
"less-specific-return-statement", # deferred
"mismatched-array-index", # deferred until we can put a stake through Laravel's craptastic __() function
"missing-magic-method", # laravel's obfuscations are still too much for mago to handle
"missing-override-attribute", # deferred, there's just too many of these
"mixed-argument", # poor type inference
"mixed-array-access", # completely broken, fails to infer an array even when it's the only return type
"mixed-array-assignment", # broken in the same fashion as mixed-array-access
"mixed-assignment", # complete non-starter, seems to do no type inference at all
"mixed-method-access", # might have some use if i could disable it on tests
"mixed-operand", # forbids even truthiness checks without a known type
"mixed-property-access", # deferred
"mixed-return-statement", # terrible type inference
"no-value", # infers 'never' for local variables that were guarded with !empty() on the line immediately above
"non-documented-method", # misses docblocks that are quite plainly present
"non-documented-property", # misses docblocks that are quite plainly present
"non-existent-method", # cannot handle magic methods at all, making it a non-starter with laravel
"non-existent-property", # also lacks magic support. ironic for something called mago.
"null-argument", # fails to read type from @property-read
"null-array-index", # fails to read type from @property-read
"null-operand", # fails to read type from @property-read
"null-property-access", # fails to read type from @property-read
"possibly-invalid-argument", # deferred
"possibly-null-argument", # basic type inference failures
"possibly-null-array-access", # fails to read type from @property-read
"possibly-null-array-index", # more trouble with the __() function
"possibly-undefined-array-index", # deferred
"possibly-undefined-string-array-index", # fires on unset(), where it's fine for the index to not exist
"redundant-comparison", # fails to read type from @property-read
"redundant-condition", # basic type inference failures
"redundant-logical-operation", # basic type inference failures
"redundant-null-coalesce", # fails to read type from @property-read
"template-constraint-violation", # deferred
"too-many-arguments", # signature for test() is broken
"undefined-string-array-index", # won't even _assign_ to arbitrary arrays
"undefined-variable", # can't handle Pest's use of $this
"unhandled-thrown-type", # we will not globally enforce checked exceptions
"unused-parameter", # too common a case to warn about
"unused-statement", # too common a case to warn about
]