Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rubocop #322

Open
connorshea opened this issue Jan 1, 2016 · 2 comments
Open

Rubocop #322

connorshea opened this issue Jan 1, 2016 · 2 comments

Comments

@connorshea
Copy link
Contributor

We should use Rubocop to maintain a standardized style for Ruby code across the project.

Check out these rules:

  • SpaceBeforeBlockBraces
  • SpaceAroundBlockParameters
  • SpaceAroundEqualsInParameterDefault
  • EmptyLineBetweenDefs

All rules are listed in rubocop's default.yml.

Add the following to the Gemfile (Source):

##
# A Ruby static code analyzer based on the community Ruby style guide.
# Config file: `.rubocop.yml`
# Run Rubocop with `rake rubocop`
# https://github.com/bbatsov/rubocop
gem 'rubocop', require: false

Add the following to the Rakefile to enable rake rubocop and rake rubocop:auto_correct (Source):

require 'rubocop/rake_task'

RuboCop::RakeTask.new

Here's a .rubycop.yml to start with:

AllCops:
  Exclude:
    - 'vendor/**/*'
    - 'spec/fixtures/**/*'

Rails:
  Enabled: true

Style/Encoding:
  Enabled: true

Style/IndentationWidth:
  Width: 2

Style/MethodName:
  EnforcedStyle: snake_case

Metrics/LineLength:
  Max: 80

Some custom cops we may want to look into:

@AnthonySuper
Copy link
Member

Done in cf8da8a

@connorshea
Copy link
Contributor Author

Regarding Time Zones: https://robots.thoughtbot.com/its-about-time-zones

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants