Skip to content

Style of arrays, hashes and sets #5

@johnkoht

Description

@johnkoht

I've noticed some ugly spacing with arrays, hashes and sets, like the following:

def technology_process_params
        params.require(:technology_process).permit(
                                              :type,
                                              :technology_id,
                                              :cohort_id,
                                              :user_id,
                                              :parent_id,
                                              :name,
                                              :description,
                                              citations_attributes: [:url]
                                            )
      end

I suggest we have the opening and closing character at the same level indentation, and all items in the set be indented only once, for example:

def technology_process_params
  params.require(:technology_process).permit(
    :type,
    :technology_id,
    :cohort_id,
    :user_id,
    :parent_id,
    :name,
    :description,
    citations_attributes: [:url]
  )
end

This should go for any array or hash that you are creating that is too long, some more examples:

# Hash examles
hash = {
  key_1: value,
  key_2: value2,
  ...
}

# Array example
array = [
  "Something",
  "Another super cool thing",
  "And one more for the win"
]

Thoughts on this? Agree/disagree?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions