Comments (4)
I haven't been feeling much pain from this. I think I've been writing this version:
stub_request(:put, url).
with(
headers: {
"Authorization" => "some_token",
"Accept" => "some_media_type",
}
).
to_return(
body: "some body text",
status: 200
)
It's consistent with all the guidelines, it's consistently formatted, and it's easy to scan for method names in the chain.
from guides.
I'm going to close this, as the discussion seems to have wrapped up.
@gylaz want to open a pull request to solidify this?
from guides.
FWIW, I agree with this, we should make this a guideline. I've seen the second form lately and was irked.
from guides.
Actually, we already have a guideline that covers this:
If you break up a chain of method invocations, keep each method invocation on its own line. Place the . at the end of each line, except the last.
However, I'm not sure how it's suppose to work in a case like this:
some_really_really_long_method_name(
arg1: "foo",
arg2: "bar",
arg3: "baz",
).
another_method_name_with_args(
arg1: "one",
arg2: "two",
arg3: "three",
)
Should the another_method_name_with_args
method be indented one level (but that would look weird)?
We always indent subsequent method in chains like:
User.where(name: "blah").
order("name DESC").
includes(:subscriptions, :address).
limit(10)
from guides.
Related Issues (20)
- Add accessibility resources to guides HOT 8
- YouTube Video Unavailable HOT 5
- Should we delete empty (seemingly duplicate) graphql guide? HOT 1
- Document SVG best practices HOT 5
- Update Backbone guide? HOT 2
- Update Ember guide? HOT 1
- Update how-to guide on feature-testing a Rails app’s Javascript? HOT 2
- Document Go Best Practices HOT 2
- Replace Ruby style guide with standard HOT 2
- Combine Best Practices and Style guides HOT 3
- Our testing guides are ruby/rails-centric HOT 2
- What layout should we suggest for test suite files in JavaScript / TypeScript projects?
- Audit guides for potential improvements
- Guides have inconsistent formatting
- Data guide should use description lists HOT 4
- Change master to main in thoughtbot/guides HOT 4
- Inquiring about JSONB column issues HOT 2
- rebase workflow link missing from Git guide HOT 1
- 404 link in relational-databases
- A11y template HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from guides.