Repository navigation
docs(controller): name controller members for what they do - #174
Merged
Merged
Conversation
A noun-named method or property competes with a schema field the model may gain on the next regeneration; a property makes it worse by doing work where a plain attribute read is expected.
Contributor
Release previewNo version bump from the current commits (stays at Changelog preview (truncated)Preview via python-semantic-release and conventional commits. |
Contributor
📊 Benchmark ResultsClick to see benchmark comparisonThreshold: 1.3x (30% slower triggers a regression warning) Note: Benchmarks are informational only and won't fail the build. 💡 Tip: Download the |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
Adds two guidelines to the controller how-to.
A controller extends a model whose field names come from a schema, so a
noun-named method or property competes with a field the schema may gain at the
next regeneration: it shadows the field, or the field shadows it, and the two
are hard to tell apart because both answer to attribute access. A verb is
almost never a field name.
A property is the worst case: it reads like data, so callers reach for it with
getattr(), and whatever it does on the way surfaces where a plain attributeread was expected.
Both come from the file controllers in
opensemantic.core:
pathwas a model field in one implementation and a property derived fromlocal_pathin another, so the same noun meant two different things.urlon the wiki controller is a property that opens a session, which made acaller probing
download_url/url/access_urlwithgetattr()raiseinstead of answering.
get(),put(),put_from()andmaterialize_data()have never collidedwith anything.