Repository navigation
Work down the Mago lint and analyzer baselines (354 findings) #13
Copy link
Copy link
Open
Description
Summary
Tracks working down the mago baselines added in #11: 123 linter findings in lint-baseline.toml, 231 analyzer findings in analyzer-baseline.toml. New findings in new code already fail, so this is about ratcheting the recorded ones back to zero.
Per batch: fix a group, regenerate with mago lint --baseline lint-baseline.toml --generate-baseline or the analyze equivalent, check the count dropped and nothing new appeared, open a PR. The groups are independent.
Distribution
Four files hold 60% of the total, so the analyzer groups are better done per file than per rule.
src/Metadata/Source.php— 99src/Connection.php— 51src/Pdo/Connection.php— 39src/Statement.php— 18src/Driver.php— 13src/AdapterPlatform.php— 12
Linter, 123
- Test conventions, 45, test-only —
assertion-style30,prefer-test-attribute13,strict-assertions2, across six test files. Mostlymago lint --fix --potentially-unsafe, though the#[Test]method renames want reading. no-isset13 —src/Pdo/Connection.php7,src/Metadata/Source.php5,src/Statement.php1. Semantic where absent and null differ.literal-named-argument14 — 12 insrc, 2 in tests, three files.tagged-todo10 — nine files, needs(@user)or(#issue).- Remainder 41 —
no-else-clause7,string-style5,no-multi-assignments4,cyclomatic-complexity3,halstead3,no-empty3,kan-defect2,no-literal-password2,no-dead-store2,no-literal-namespace-string2,prefer-arrow-function2, six singletons. The twono-literal-passwordare both insrc/ConfigProvider.phpand look like default config keys.cyclomatic-complexity,halsteadandkan-defectsit in the same files as the analyzer work and should follow it.
Analyzer, 231
src/Metadata/Source.php99 — all 28invalid-array-access, 23 of the 25possibly-undefined-string-array-index, all 7reference-constraint-violation, all 4too-many-arguments, 5unhandled-thrown-type. Untyped array plumbing overinformation_schema; wants array shapes or DTOs for the metadata rows.unhandled-thrown-type25 —src/Connection.php6,src/Metadata/Source.php5,src/Container/PdoDriverInterfaceFactory.php4,src/Container/DriverInterfaceFactory.php3,src/Pdo/Connection.php3,src/Container/PdoConnectionInterfaceFactory.php2,src/Driver.php2.@throwsundercheck-throws. A driver-level exception that belongs in the sharedunchecked-exceptionsallowlist is aphpdb-qa-toolsPR, not a local fix.- Mixed and imprecise typing 51 —
imprecise-type16 over thirteen files,mixed-argument14,mixed-assignment12,mixed-array-assignment7,mixed-return-statement4,mixed-property-type-coercion1. Largely covered by theSource.phpwork. - Nullability and invalid values 32 —
possibly-null-argument9,possibly-invalid-argument7,invalid-property-assignment-value4,possibly-null-operand3,invalid-argument3,invalid-return-statement3,possibly-null-array-access2,possible-method-access-on-null2,possibly-false-argument2,nullable-return-statement1. Defects rather than missing annotations, for the most part. - Class and property contracts 27 —
uninitialized-property9 (5 src, 4 test),unused-parameter9,class-must-be-final7,missing-constructor1,missing-override-attribute1.enforce-class-finalitywithrequire-api-or-internalmeansAdapterPlatform,Connection,Metadata\Source,Pdo\Connection,Pdo\Driver,ResultandStatementeach have to befinal,abstractor@api. For a 0.x driver that is a policy call to settle across the driver packages, not here. - Redundancy and impossible conditions 14 —
redundant-condition4,docblock-type-mismatch3,less-specific-argument3,impossible-condition2,impossible-type-comparison2,invalid-type-cast2, singletons. Theimpossible-condition,impossible-type-comparisonandnon-existent-methodentries look like bugs or dead code.
Order
- Test conventions.
- The impossible and non-existent entries.
- Nullability.
src/Metadata/Source.php, which covers much of the typing,no-issetand complexity work.unhandled-thrown-type.class-must-be-final, after the finality decision.- The complexity rules.
Related
#10, #11. #12 touches src/Result.php, which also carries a class-must-be-final entry.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity