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
Use standard.rb to lint code #166
Conversation
@@ -20,3 +20,5 @@ group :test do | |||
end | |||
|
|||
gem "github_fast_changelog", require: false | |||
|
|||
gem "standardrb", "~> 1.0", require: false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
@@ -22,7 +22,7 @@ require "rspec/core/rake_task" | |||
|
|||
RSpec::Core::RakeTask.new(:spec) | |||
|
|||
task :default => ["alchemy:spec:prepare", :spec] | |||
task default: ["alchemy:spec:prepare", :spec] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
else | ||
# We have to strip double slashes from beginning of path, because of strange rails/rack bug. | ||
redirect_path = session[:redirect_path].gsub(/\A\/{2,}/, "/") | ||
session[:redirect_path].gsub(/\A\/{2,}/, "/") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/RegexpLiteral: Use %r around regular expression.
Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
if session[:redirect_path].blank? | ||
redirect_path = admin_dashboard_path | ||
redirect_path = if session[:redirect_path].blank? | ||
admin_dashboard_path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/IndentationWidth: Use 2 (not -14) spaces for indentation.
@@ -116,7 +115,7 @@ def can_update_role? | |||
end | |||
|
|||
def deliver_welcome_mail | |||
if @user.valid? && @user.send_credentials == '1' | |||
if @user.valid? && @user.send_credentials == "1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/GuardClause: Use a guard clause instead of wrapping the code inside a conditional expression.
Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
:as => :reset_password | ||
patch '/passwords' => 'passwords#update', | ||
patch "/passwords" => "passwords#update", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
:as => :edit_password | ||
post '/passwords' => 'passwords#create', | ||
post "/passwords" => "passwords#create", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
:as => :new_password | ||
get '/passwords/:id/edit/:reset_password_token' => 'passwords#edit', | ||
get "/passwords/:id/edit/:reset_password_token" => "passwords#edit", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
|
||
get '/passwords' => 'passwords#new', | ||
get "/passwords" => "passwords#new", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
:as => :logout, via: Devise.sign_out_via | ||
post "/login" => "user_sessions#create" | ||
match "/logout" => "user_sessions#destroy", | ||
:as => :logout, :via => Devise.sign_out_via |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/AlignHash: Align the elements of a hash literal if they span more than one line.
Uses standard.rb as code linter over Rubocop. Standard uses Rubocop under the hood, but provides sane defaults and
removes the necessity to maintain Rubocop rules. We still configure Rubocop so that it uses the standard.yml rules, so that
your editor can use that to auto-format and lint the code in Alchemy.