Indentation Conventions for Ruby and Cucumber


#1

On Thu, Nov 27, 2008 at 4:28 PM, Aslak Hellesøy
removed_email_address@domain.invalidwrote:

When (if) this thread ends, let’s start a discussion about indentation
conventions!

Oh… let the pleasure be mine!.. and why wait?

EVERYONE knows that the only way to indent ruby code is 2 plain
spaces.
Tabs are known to be the source of all evil and 4 spaces obviously
wastes
space and bandwidth…

Anyone else who says otherwise is obviously and irrefutably misguided :smiley:

Mikel


#2

Oh but cucumber features so want to be idented on the I

Scenario: Anonymous user can not duplicate a un-activated account
Given I am an anonymous user
And a registered user Fred exists
When I signup as Fred
Then I should see an error

Really need to view above with a monspaced font - if its not coming out
that
way in your mail reader.

Andrew

2008/12/3 Mikel L. removed_email_address@domain.invalid:


#3

Andrew P. escribió:

Oh but cucumber features so want to be idented on the I

Scenario: Anonymous user can not duplicate a un-activated account
Given I am an anonymous user
And a registered user Fred exists
When I signup as Fred
Then I should see an error

Really need to view above with a monspaced font - if its not coming
out that way in your mail reader.

+0.66 :slight_smile:

I like to indent this way, but within a given, when or then block:

Scenario: Anonymous user can not duplicate a un-activated account
Given I am an anonymous user
And a registered user Fred exists
When I signup as Fred
Then I should see an error

Great idea, I love conventions!!!

Nando


http://rubyforge.org/mailman/listinfo/rspec-users

Fernando García Samblas
removed_email_address@domain.invalid
http://nando.lacoctelera.com

The Cocktail
C/ Salamanca 17
28020 Madrid
+34 91 567 06 05


#4

On Wed, Dec 3, 2008 at 9:27 AM, Andrew P. removed_email_address@domain.invalid
wrote:

Oh but cucumber features so want to be idented on the I

Scenario: Anonymous user can not duplicate a un-activated account
Given I am an anonymous user
And a registered user Fred exists
When I signup as Fred
Then I should see an error

I have to disagree. I find the jagged margin looks messy. I would
never indent other prose this way, so why would I indent my features
this way? They’re not code, they’re prose. They’re not written to be
parsed, they’re written to be read like a story.

Peter


#5

On Thu, Dec 4, 2008 at 2:14 PM, Peter J. removed_email_address@domain.invalid
wrote:

never indent other prose this way, so why would I indent my features
this way? They’re not code, they’re prose. They’re not written to be
parsed, they’re written to be read like a story.

+1 to what Peter said,


Zach D.
http://www.continuousthinking.com
http://www.mutuallyhuman.com


#6

On Thu, Dec 4, 2008 at 1:27 AM, Andrew P. removed_email_address@domain.invalid
wrote:

The problem with that however is that it is not compliant with
Internationalization standards…

Not to mention it would then naturally bias someone toward using an
enforced
I.

What if I didn’t want to use an “I”, but an “it” say, in terms of an API
that is being talked to by another system…


#7

Definitely a matter of taste. A few things

  1. syntax highlighting seems to make aligning on the I more preferable
  2. And’s feel like there nested
  3. Maybe its my programmers eye reading and looking for matches rather
    than
    reading the scenario as a whole

Is a feature prose? Seems closer to poetry in layout at least

2008/12/4 Peter J. removed_email_address@domain.invalid


#8

Original post was somewhat flippant :slight_smile:

To be more precise. This style is

“aligning on the first letter of the second word”

and basically is treating the first word as a label and the rest as
content,
and using indentation to differentiate (hopefully clearly)

Andrew

2008/12/6 Mikel L. removed_email_address@domain.invalid


#9

I think that’s ugly. Better to use syntax highlighting in an editor,
imo.

Pat

“Andrew P.” removed_email_address@domain.invalid writes: