-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmago.toml
More file actions
136 lines (127 loc) · 6.22 KB
/
Copy pathmago.toml
File metadata and controls
136 lines (127 loc) · 6.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# 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]
assert-description = { enabled = false }
braced-string-interpolation = { enabled = false }
class-name = { enabled = false }
constant-name = { 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-else-clause = { enabled = false }
no-empty = { enabled = false } # empty() is awful, but loose truthiness is just as bad without being explicit about it.
no-empty-comment = { enabled = false }
no-literal-password = { enabled = false }
no-shorthand-ternary = { enabled = false }
prefer-first-class-callable = { 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 individual rules as needed
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-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", # unnecessary in many cases
"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
]