Alle 4 Kommentare

[–]NL_Northsider 1 Punkt2 Punkte  (3 Kinder)

Looking at what it does and what it detects, you can achieve this with Rector and arch tests, or SonarQube for open-source.

What exactly is the added value of this package?

[–]ReadingFormal[S] -1 Punkte0 Punkte  (2 Kinder)

The main reason I built it: `sloppy:diff` looks at your working tree, not just commits. So when an agent writes a new class, I can check it before I commit instead of waiting for CI. It also splits new findings from old ones, so you can run it on an old codebase without 400 existing problems failing the build.

If you already use sonar, arch tests and/or rector this just adds the laravel-specific part. If you don't use any of them, it's the easiest way to get most of it I think.

[–]NL_Northsider 0 Punkte1 Punkt  (1 Kind)

But you can also run arch tests and Rector against your diff? Why would someone go for this package instead of using the rules of those packages?

And I'm gonna be honest, the code itself feels a bit sloppy in some parts. For example, git statuses as string literals. It also feels like I see quite some magic numbers when it comes to scoring/weighting calculation.

As for the N+1 risks, as this is also focussed on Laravel, why wouldn't you just disable lazy loading (when using models, that is)?

[–]ReadingFormal[S] -1 Punkte0 Punkte  (0 Kinder)

Fair points, but you can point rector at changed files but that just picks which files to scan, it still reports everything inside them. so touching one method in an old controller dumps the whole file back at you. sloppy:diff runs on your branch + the base so it only shows what you actually added, and theres a baseline so you dont have to fix 400 old findings before you can use it. arch tests are great for rules you write yourself, this is just 23 of them already written.

statuses should be an enum yeah, fair, good catch. the score weights/bands/multiplier are all in config/sloppy.php so those are tunable, confidence is hardcoded on purpose tho, thats the rule saying how sure it is, not really a user setting. If you have a better idea, submit a PR:)

and yes turn preventLazyLoading on does a different thing. it only fires when the code actually runs and its off in prod, so anything without a test slips past. also it only catches lazy relations, not find() inside a foreach or all() then filtering in php.