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

Use standard.rb to lint code #166

Merged
merged 3 commits into from Apr 28, 2023
Merged

Use standard.rb to lint code #166

merged 3 commits into from Apr 28, 2023

Conversation

tvdeyen
Copy link
Member

@tvdeyen tvdeyen commented Apr 27, 2023

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.

@@ -20,3 +20,5 @@ group :test do
end

gem "github_fast_changelog", require: false

gem "standardrb", "~> 1.0", require: false
Copy link

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]
Copy link

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,}/, "/")
Copy link

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
Copy link

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"
Copy link

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",
Copy link

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",
Copy link

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",
Copy link

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",
Copy link

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
Copy link

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.

@tvdeyen tvdeyen merged commit 3bf18bd into AlchemyCMS:main Apr 28, 2023
25 checks passed
@tvdeyen tvdeyen deleted the standardrb branch April 28, 2023 07:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant