Conversation
`when`, `else` and `end` sat one column right of `case`, which is what `Layout/CaseIndentation` and `Layout/EndAlignment` reject. The rest of the document's Ruby already agrees with the cops.
`output` was a root that the namespace was appended to, so a tree declaring `Api::V3::Generated` landed in `output/api/v3/generated`. Inferring a file layout from a namespace only holds where `output` is an autoload root, and it forced the tree into a directory of its own, because the generator claimed everything under `output` and nothing hand-written could share it. `output` is now the directory itself and `modules` only says what the code declares. Whether the two agree, so Zeitwerk resolves the constants, is the caller's to arrange, which is what lets the tree sit beside the code that implements it. What the generator owns shrinks to match: `output`, and the `.rb` beside it that names the namespace, because Zeitwerk looks for `Api::V3::Generated` in `generated.rb` rather than inside `generated/`. The rest of the parent directory is not its business. `module_path` survives for Rails routing, where `to:` wants a constant path and not a file path. Golden output is byte-identical, since the fixtures now point `output` at the directory the old convention derived.
Collaborator
Author
|
Parking this. The change forces the namespace file outside |
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.
outputused to be a root the namespace was appended to, so the tree landed atoutput/<modules as a path>. That inferred a file layout from a namespace, which only works ifoutputis an autoload root — and it forced the generated tree into a directory of its own, since the generator claimed everything underoutput.Now
outputis the directory,modulesis only the namespace, and whether the two line up for Zeitwerk is the caller's call. The generated tree can sit beside the hand-written code implementing it.The generator owns
outputand the.rbbeside it naming the namespace — Zeitwerk wantsApi::V3::Generatedingenerated.rb, not insidegenerated/. Nothing else in the parent is touched, which is what lets the tree live inside an existing root.module_pathstays for Rails routing, whereto:takes a constant path rather than a file path.Golden output is byte-identical: the fixtures point
outputat the directory the old convention produced.196 examples, 0 failures;
rubocopandsrb tcclean.