Repository navigation
Warn when the detected modules are the layers of a Laravel app - #34
Merged
Merged
Conversation
The most common app that tries Cordon is split by layer (app/Http, app/Models, app/Services...). Pointed at app/, Cordon reports almost every reference as internal_access plus one large cycle, which reads as "Cordon is broken" rather than "this app is layered". cordon:modules (and vendor/bin/cordon modules) now warns when at least two modules are named like standard Laravel layers, and links to a new "Is Cordon for my project?" section at the top of the installation guide, which points layered apps to Deptrac or Pest arch(). One module named like a layer, such as Notifications, is not enough. Closes #22
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The most common app that will try Cordon, especially after the announcement, is split by layer (
app/Http,app/Models,app/Services...) rather than by feature. Pointed atapp/, Cordon reports almost every reference asinternal_access, plus one large cycle. That reads as "Cordon is broken" instead of "this app is layered".comparison.mdalready says layered rules are Deptrac's job, but only after installing. Closes #22.cordon:modulesnow warns when at least two of the detected modules are named like standard Laravel layers (Http,Models,Providers,Services,Console,Jobs...). The warning links to a new "Is Cordon for my project?" section at the top of the installation guide, which points layered apps to Deptrac or Pestarch()and tells teams moving to modules where to point Cordon. The threshold is two because a single module can legitimately be called like a layer, aNotificationsmodule say. The check lives inCordon\Module\LayeredLayout, a pure function over the module names, sovendor/bin/cordon modulesgets it too. The exit code doesn't change: it's a hint, not a failure.Verification.
vendor/bin/cordon moduleson a layered app (Http,Models,Providers,Services)cordon:moduleson the feature-module fixtureBilling,Catalog,Notificationsid="is-cordon-for-my-project"present, link to the comparison resolvesNew
tests/Fixtures/layered-app, 3 unit tests forLayeredLayoutand 2 command tests.composer checkpasses (159 tests).Not covered:
cordon:verifydoesn't show the hint; it's the command people run aftercordon:modulesin the installation guide. The list of layer names is a judgement call; an app with unusual layer names won't get the hint.