boring_generators 0.1.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/FUNDING.yml +12 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +11 -0
- data/.github/workflows/ci.yml +17 -0
- data/CHANGELOG.md +36 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +148 -0
- data/README.md +52 -6
- data/boring_generators.gemspec +3 -1
- data/exe/boring +5 -0
- data/lib/boring_generators.rb +1 -0
- data/lib/boring_generators/cli.rb +26 -0
- data/lib/boring_generators/version.rb +1 -1
- data/lib/generators/boring/active_storage/aws/install/install_generator.rb +48 -0
- data/lib/generators/boring/active_storage/azure/install/install_generator.rb +48 -0
- data/lib/generators/boring/active_storage/google/install/install_generator.rb +48 -0
- data/lib/generators/boring/audit/install/install_generator.rb +22 -0
- data/lib/generators/boring/bootstrap/install/install_generator.rb +67 -0
- data/lib/generators/boring/bootstrap/install/templates/application.scss +1 -0
- data/lib/generators/boring/bullet/install/install_generator.rb +31 -0
- data/lib/generators/boring/bullet/install/templates/bullet.rb +8 -0
- data/lib/generators/boring/ci/circleci/install/install_generator.rb +31 -0
- data/lib/generators/boring/ci/circleci/install/templates/config.psql.yml.tt +48 -0
- data/lib/generators/boring/ci/circleci/install/templates/config.sql.yml.tt +48 -0
- data/lib/generators/boring/ci/circleci/install/templates/database.yml.ci.tt +14 -0
- data/lib/generators/boring/ci/github_action/install/install_generator.rb +45 -0
- data/lib/generators/boring/ci/github_action/install/templates/ci.yml.tt +49 -0
- data/lib/generators/boring/ci/travisci/install/install_generator.rb +23 -0
- data/lib/generators/boring/ci/travisci/install/templates/.travis.yml.tt +35 -0
- data/lib/generators/boring/devise/install/install_generator.rb +75 -0
- data/lib/generators/boring/favicon/build/build_generator.rb +120 -0
- data/lib/generators/boring/favicon/build/templates/favicon.html.erb.tt +19 -0
- data/lib/generators/boring/font_awesome/ruby_gem/install/install_generator.rb +42 -0
- data/lib/generators/boring/font_awesome/yarn/install/install_generator.rb +53 -0
- data/lib/generators/boring/font_awesome/yarn/install/templates/application.scss +1 -0
- data/lib/generators/boring/graphql/install/install_generator.rb +51 -0
- data/lib/generators/boring/graphql/install/templates/base_resolver.rb +2 -0
- data/lib/generators/boring/graphql/install/templates/hello_world_resolver.rb +11 -0
- data/lib/generators/boring/jquery/install/install_generator.rb +32 -0
- data/lib/generators/boring/oauth/facebook/install/install_generator.rb +91 -0
- data/lib/generators/boring/oauth/facebook/install/templates/README +24 -0
- data/lib/generators/boring/oauth/facebook/install/templates/omniauth.rb +3 -0
- data/lib/generators/boring/oauth/facebook/install/templates/omniauth_callbacks_controller.rb +21 -0
- data/lib/generators/boring/pry/install/install_generator.rb +29 -0
- data/lib/generators/boring/pry/install/templates/pryrc +24 -0
- data/lib/generators/boring/pundit/install/install_generator.rb +85 -0
- data/lib/generators/boring/rubocop/install/install_generator.rb +37 -0
- data/lib/generators/boring/rubocop/install/templates/.rubocop.yml.tt +262 -0
- data/lib/generators/boring/simple_form/install/install_generator.rb +44 -0
- data/lib/generators/boring/tailwind/install/install_generator.rb +28 -20
- metadata +2527 -6
- data/.travis.yml +0 -6
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Boring
|
4
|
+
module Jquery
|
5
|
+
class InstallGenerator < Rails::Generators::Base
|
6
|
+
desc "Adds JQuery to the application"
|
7
|
+
|
8
|
+
def add_jquery_package
|
9
|
+
say "Adding JQuery packages", :green
|
10
|
+
run "yarn add jquery"
|
11
|
+
end
|
12
|
+
|
13
|
+
def add_jquery_plugin_provider_to_webpack_environment
|
14
|
+
say "Initailizing tailwind configuration", :green
|
15
|
+
if File.exist?("config/webpack/environment.js")
|
16
|
+
insert_into_file "config/webpack/environment.js", <<~RUBY, after: /@rails\/webpacker.*\n/
|
17
|
+
const webpack = require("webpack")
|
18
|
+
|
19
|
+
environment.plugins.append("Provide", new webpack.ProvidePlugin({
|
20
|
+
$: 'jquery',
|
21
|
+
jQuery: 'jquery'
|
22
|
+
}))
|
23
|
+
RUBY
|
24
|
+
else
|
25
|
+
say <<~WARNING, :red
|
26
|
+
ERROR: Looks like the webpacker installation is incomplete. Could not find environment.js in config/webpack.
|
27
|
+
WARNING
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'bundler'
|
4
|
+
|
5
|
+
module Boring
|
6
|
+
module Oauth
|
7
|
+
module Facebook
|
8
|
+
class InstallGenerator < Rails::Generators::Base
|
9
|
+
class MissingDeviseConfigurationError < StandardError; end
|
10
|
+
|
11
|
+
desc "Adds facebook OmniAuth to the application"
|
12
|
+
source_root File.expand_path("templates", __dir__)
|
13
|
+
|
14
|
+
def add_facebook_omniauth_gem
|
15
|
+
say "Adding Facebook OmniAuth gem", :green
|
16
|
+
facebook_omniauth_gem = <<~RUBY
|
17
|
+
\n
|
18
|
+
# for omniauth facebook
|
19
|
+
gem 'omniauth-facebook', '~> 8.0'
|
20
|
+
RUBY
|
21
|
+
append_to_file "Gemfile", facebook_omniauth_gem
|
22
|
+
Bundler.with_unbundled_env do
|
23
|
+
run "bundle install"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def add_provider_and_uuid_user_details
|
28
|
+
say "Adding migration to add provider and uuid columns to users", :green
|
29
|
+
Bundler.with_unbundled_env do
|
30
|
+
run "DISABLE_SPRING=1 bundle exec rails generate migration AddOmniauthToUsers provider:string uid:string"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def configure_devise_omniauth_facebook
|
35
|
+
say "Adding omniauth devise configuration", :green
|
36
|
+
if File.exist?("config/initializers/devise.rb")
|
37
|
+
insert_into_file "config/initializers/devise.rb", <<~RUBY, after: /Devise.setup do \|config\|/
|
38
|
+
\n
|
39
|
+
\tconfig.omniauth :facebook, "APP_ID", "APP_SECRET"
|
40
|
+
RUBY
|
41
|
+
else
|
42
|
+
raise MissingDeviseConfigurationError, <<~ERROR
|
43
|
+
Looks like the devise installation is incomplete. Could not find devise.rb in config/initializers.
|
44
|
+
ERROR
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def add_omniauth_callback_routes
|
49
|
+
devise_route = '# devise_for :users, controllers: { omniauth_callbacks: "users/omniauth_callbacks" }'.dup
|
50
|
+
route devise_route
|
51
|
+
end
|
52
|
+
|
53
|
+
def add_omniauth_callback_controller
|
54
|
+
say "Copying omniauth_callbacks_controller.rb", :green
|
55
|
+
template("omniauth_callbacks_controller.rb", "app/controllers/users/omniauth_callbacks_controller.rb")
|
56
|
+
end
|
57
|
+
|
58
|
+
def configure_and_add_devise_setting_in_user_model
|
59
|
+
say "Configuring facebook omniauth for user model", :green
|
60
|
+
insert_into_file "app/models/user.rb", <<~RUBY, after: /class User < ApplicationRecord/
|
61
|
+
|
62
|
+
\tdevise :omniauthable, omniauth_providers: %i[facebook]
|
63
|
+
|
64
|
+
\tdef self.from_omniauth(auth)
|
65
|
+
\twhere(provider: auth.provider, uid: auth.uid).first_or_create do |user|
|
66
|
+
\tuser.email = auth.info.email
|
67
|
+
\tuser.password = Devise.friendly_token[0, 20]
|
68
|
+
\tuser.name = auth.info.name # assuming the user model has a name
|
69
|
+
\t# user.image = auth.info.image # assuming the user model has an image
|
70
|
+
\t# If you are using confirmable and the provider(s) you use validate emails,
|
71
|
+
\t# uncomment the line below to skip the confirmation emails.
|
72
|
+
\t# user.skip_confirmation!
|
73
|
+
\tend
|
74
|
+
\tend
|
75
|
+
RUBY
|
76
|
+
end
|
77
|
+
|
78
|
+
def add_the_facebook_devise_omniauth_view
|
79
|
+
insert_into_file "app/views/users/sessions/new.html.erb", <<~RUBY, after: /<%= render "users\/shared\/links" %>/
|
80
|
+
|
81
|
+
<%= link_to "Sign in with Facebook", user_facebook_omniauth_authorize_path %>
|
82
|
+
RUBY
|
83
|
+
end
|
84
|
+
|
85
|
+
def show_readme
|
86
|
+
readme "README"
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
===============================================================================
|
2
|
+
|
3
|
+
Some setup you must do manually if you haven't yet:
|
4
|
+
|
5
|
+
1. Ensure you have overridden or uncommented the routes for generated omniauth callback controllers in your routes.rb.
|
6
|
+
For example:
|
7
|
+
|
8
|
+
Rails.application.routes.draw do
|
9
|
+
devise_for :users, controllers: {
|
10
|
+
omniauth_callbacks: "users/omniauth_callbacks"
|
11
|
+
}
|
12
|
+
end
|
13
|
+
|
14
|
+
2. Update the devise facebook omniauth APP_ID and APP_SECRET in "config/initializers/devise.rb"
|
15
|
+
after registering the Rails application on: https://developers.facebook.com/apps/
|
16
|
+
For example:
|
17
|
+
|
18
|
+
config.omniauth :facebook, "APP_ID", "APP_SECRET"
|
19
|
+
3. Ensure you have added the facebook omniauth route in the devise session view:
|
20
|
+
For example:
|
21
|
+
|
22
|
+
<%= link_to "Sign in with Facebook", user_facebook_omniauth_authorize_path %>
|
23
|
+
|
24
|
+
===============================================================================
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
2
|
+
# See https://github.com/omniauth/omniauth/wiki/FAQ#rails-session-is-clobbered-after-callback-on-developer-strategy
|
3
|
+
skip_before_action :verify_authenticity_token, only: :facebook
|
4
|
+
|
5
|
+
def facebook
|
6
|
+
# You need to implement the method below in your model (e.g. app/models/user.rb)
|
7
|
+
@user = User.from_omniauth(request.env["omniauth.auth"])
|
8
|
+
|
9
|
+
if @user.persisted?
|
10
|
+
sign_in_and_redirect @user, event: :authentication #this will throw if @user is not activated
|
11
|
+
set_flash_message(:notice, :success, kind: "Facebook") if is_navigational_format?
|
12
|
+
else
|
13
|
+
session["devise.facebook_data"] = request.env["omniauth.auth"].except(:extra) # Removing extra as it can overflow some session stores
|
14
|
+
redirect_to new_user_registration_url
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def failure
|
19
|
+
redirect_to root_path
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Boring
|
4
|
+
module Pry
|
5
|
+
class InstallGenerator < Rails::Generators::Base
|
6
|
+
desc "Adds pry to the application"
|
7
|
+
source_root File.expand_path("templates", __dir__)
|
8
|
+
|
9
|
+
def add_bullet_gem
|
10
|
+
say "Adding Bullet gem", :green
|
11
|
+
pry_gem_content = <<~RUBY
|
12
|
+
\n
|
13
|
+
# for using pry as Rails console
|
14
|
+
gem "pry"
|
15
|
+
gem "pry-rails"
|
16
|
+
RUBY
|
17
|
+
append_to_file "Gemfile", pry_gem_content
|
18
|
+
run "bundle install"
|
19
|
+
end
|
20
|
+
|
21
|
+
def add_pryrc_configuration
|
22
|
+
return if options[:skip_configuration]
|
23
|
+
|
24
|
+
say "Copying pryrc configuration", :green
|
25
|
+
template("pryrc", ".pryrc")
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
|
5
|
+
if defined?(Rails)
|
6
|
+
# https://wiki.hackzine.org/development/misc/readline-color-prompt.html
|
7
|
+
Pry.config.prompt_name = if Rails.env.production?
|
8
|
+
"\001\e[0m\002PROD"
|
9
|
+
else
|
10
|
+
"\001\e[0m\002dev"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
Pry.config.pager = false
|
14
|
+
|
15
|
+
def define_byebug_aliases!
|
16
|
+
if defined?(PryByebug)
|
17
|
+
Pry.commands.alias_command "c", "continue"
|
18
|
+
Pry.commands.alias_command "s", "step"
|
19
|
+
Pry.commands.alias_command "n", "next"
|
20
|
+
Pry.commands.alias_command "f", "finish"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
extend Rails::ConsoleMethods if defined?(Rails::ConsoleMethods)
|
@@ -0,0 +1,85 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Boring
|
4
|
+
module Pundit
|
5
|
+
class InstallGenerator < Rails::Generators::Base
|
6
|
+
desc "Adds pundit to the application"
|
7
|
+
|
8
|
+
class_option :skip_ensuring_policies, type: :boolean, aliases: "-s",
|
9
|
+
desc: "Skip before_action to ensure user is authorized"
|
10
|
+
class_option :skip_rescue, type: :boolean, aliases: "-sr",
|
11
|
+
desc: "Skip adding rescue for Pundit::NotAuthorizedError"
|
12
|
+
class_option :skip_generator, type: :boolean, aliases: "-sg",
|
13
|
+
desc: "Skip running Pundit install generator"
|
14
|
+
|
15
|
+
def add_pundit_gem
|
16
|
+
say "Adding Pundit gem", :green
|
17
|
+
pundit_gem = <<~RUBY
|
18
|
+
\n
|
19
|
+
# for authorization
|
20
|
+
gem 'pundit', '~> 2.1'
|
21
|
+
RUBY
|
22
|
+
append_to_file "Gemfile", pundit_gem
|
23
|
+
Bundler.with_unbundled_env do
|
24
|
+
run "bundle install"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def run_pundit_generator
|
29
|
+
return if options[:skip_generator]
|
30
|
+
|
31
|
+
say "Running Pundit Generator", :green
|
32
|
+
run "DISABLE_SPRING=1 rails generate pundit:install"
|
33
|
+
end
|
34
|
+
|
35
|
+
def inject_pundit_to_controller
|
36
|
+
say "Adding Pundit module into ApplicationController", :green
|
37
|
+
inject_into_file 'app/controllers/application_controller.rb', after: "class ApplicationController < ActionController::Base\n" do
|
38
|
+
" include Pundit\n"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def ensure_policies
|
43
|
+
return if options[:skip_ensuring_policies]
|
44
|
+
|
45
|
+
say "Force ensuring policies", :green
|
46
|
+
inject_into_file 'app/controllers/application_controller.rb', after: "include Pundit\n" do
|
47
|
+
" after_action :verify_authorized\n"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def rescue_from_not_authorized
|
52
|
+
return if options[:skip_rescue]
|
53
|
+
|
54
|
+
say "Adding rescue from Pundit::NotAuthorizedError", :green
|
55
|
+
|
56
|
+
after = if File.read('app/controllers/application_controller.rb') =~ (/:verify_authorized/)
|
57
|
+
"after_action :verify_authorized\n"
|
58
|
+
else
|
59
|
+
"include Pundit\n"
|
60
|
+
end
|
61
|
+
|
62
|
+
inject_into_file 'app/controllers/application_controller.rb', after: after do
|
63
|
+
<<~RUBY
|
64
|
+
\trescue_from Pundit::NotAuthorizedError, with: :user_not_authorized
|
65
|
+
|
66
|
+
\tprivate
|
67
|
+
|
68
|
+
\tdef user_not_authorized
|
69
|
+
\t flash[:alert] = "You are not authorized to perform this action."
|
70
|
+
\t redirect_to(request.referrer || root_path)
|
71
|
+
\tend
|
72
|
+
RUBY
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def after_run
|
77
|
+
unless options[:skip_rescue]
|
78
|
+
say "\nPlease check the `application_controller.rb` file and fix any potential issues"
|
79
|
+
end
|
80
|
+
|
81
|
+
say "\nDon't forget, that you can generate policies with \nrails g pundit:policy Model\n"
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Boring
|
4
|
+
module Rubocop
|
5
|
+
class InstallGenerator < Rails::Generators::Base
|
6
|
+
desc "Adds rubocop to the application"
|
7
|
+
source_root File.expand_path("templates", __dir__)
|
8
|
+
|
9
|
+
DEFAULT_RUBY_VERSION = "2.7.1"
|
10
|
+
|
11
|
+
class_option :skip_adding_rubocop_rules, type: :boolean, aliases: "-s",
|
12
|
+
desc: "Skip adding rubocop rules and add empty file."
|
13
|
+
class_option :ruby_version, type: :string, aliases: "-v",
|
14
|
+
desc: "Tell us the ruby version which you use for the application. Default to Ruby #{DEFAULT_RUBY_VERSION}"
|
15
|
+
|
16
|
+
def add_rubocop_gems
|
17
|
+
say "Adding rubocop gems", :green
|
18
|
+
bullet_gem_content = <<~RUBY
|
19
|
+
\n
|
20
|
+
\t# A Ruby static code analyzer, based on the community Ruby style guide
|
21
|
+
\tgem "rubocop", require: false
|
22
|
+
\tgem "rubocop-rails", require: false
|
23
|
+
\tgem "rubocop-performance", require: false
|
24
|
+
RUBY
|
25
|
+
insert_into_file "Gemfile", bullet_gem_content, after: /group :development do/
|
26
|
+
run "bundle install"
|
27
|
+
end
|
28
|
+
|
29
|
+
def add_rails_prefered_rubocop_rules
|
30
|
+
say "Adding rubocop style guides", :green
|
31
|
+
@skip_adding_rules = options[:skip_adding_rubocop_rules]
|
32
|
+
@target_ruby_version = options[:ruby_version] ? options[:ruby_version] : DEFAULT_RUBY_VERSION
|
33
|
+
template(".rubocop.yml", ".rubocop.yml")
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,262 @@
|
|
1
|
+
require:
|
2
|
+
- rubocop-performance
|
3
|
+
- rubocop-rails
|
4
|
+
|
5
|
+
<%- unless @skip_adding_rules %>
|
6
|
+
AllCops:
|
7
|
+
TargetRubyVersion: <%= @target_ruby_version %>
|
8
|
+
# RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
|
9
|
+
# to ignore them, so only the ones explicitly set in this file are enabled.
|
10
|
+
DisabledByDefault: true
|
11
|
+
Exclude:
|
12
|
+
- bin/*
|
13
|
+
- db/**/*
|
14
|
+
- script/**/*
|
15
|
+
- vendor/**/*
|
16
|
+
- node_modules/**/*
|
17
|
+
- node-server/**/*
|
18
|
+
- tmp/**/*
|
19
|
+
- config/**/*
|
20
|
+
- Gemfile
|
21
|
+
|
22
|
+
# Prefer assert_not over assert !
|
23
|
+
Rails/AssertNot:
|
24
|
+
Include:
|
25
|
+
- '**/test/**/*'
|
26
|
+
|
27
|
+
# Prefer assert_not_x over refute_x
|
28
|
+
Rails/RefuteMethods:
|
29
|
+
Include:
|
30
|
+
- '**/test/**/*'
|
31
|
+
|
32
|
+
Rails/IndexBy:
|
33
|
+
Enabled: true
|
34
|
+
|
35
|
+
Rails/IndexWith:
|
36
|
+
Enabled: true
|
37
|
+
|
38
|
+
# Prefer &&/|| over and/or.
|
39
|
+
Style/AndOr:
|
40
|
+
Enabled: true
|
41
|
+
|
42
|
+
# Align `when` with `case`.
|
43
|
+
Layout/CaseIndentation:
|
44
|
+
Enabled: true
|
45
|
+
|
46
|
+
Layout/ClosingHeredocIndentation:
|
47
|
+
Enabled: true
|
48
|
+
|
49
|
+
# Align comments with method definitions.
|
50
|
+
Layout/CommentIndentation:
|
51
|
+
Enabled: true
|
52
|
+
|
53
|
+
Layout/ElseAlignment:
|
54
|
+
Enabled: true
|
55
|
+
|
56
|
+
# Align `end` with the matching keyword or starting expression except for
|
57
|
+
# assignments, where it should be aligned with the LHS.
|
58
|
+
Layout/EndAlignment:
|
59
|
+
Enabled: true
|
60
|
+
EnforcedStyleAlignWith: variable
|
61
|
+
AutoCorrect: true
|
62
|
+
|
63
|
+
Layout/EmptyLineAfterMagicComment:
|
64
|
+
Enabled: true
|
65
|
+
|
66
|
+
Layout/EmptyLinesAroundAccessModifier:
|
67
|
+
Enabled: true
|
68
|
+
EnforcedStyle: only_before
|
69
|
+
|
70
|
+
Layout/EmptyLinesAroundBlockBody:
|
71
|
+
Enabled: true
|
72
|
+
|
73
|
+
# In a regular class definition, no empty lines around the body.
|
74
|
+
Layout/EmptyLinesAroundClassBody:
|
75
|
+
Enabled: true
|
76
|
+
|
77
|
+
# In a regular method definition, no empty lines around the body.
|
78
|
+
Layout/EmptyLinesAroundMethodBody:
|
79
|
+
Enabled: true
|
80
|
+
|
81
|
+
# In a regular module definition, no empty lines around the body.
|
82
|
+
Layout/EmptyLinesAroundModuleBody:
|
83
|
+
Enabled: true
|
84
|
+
|
85
|
+
# Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }.
|
86
|
+
Style/HashSyntax:
|
87
|
+
Enabled: true
|
88
|
+
|
89
|
+
Layout/FirstArgumentIndentation:
|
90
|
+
Enabled: true
|
91
|
+
|
92
|
+
# Method definitions after `private` or `protected` isolated calls need one
|
93
|
+
# extra level of indentation.
|
94
|
+
Layout/IndentationConsistency:
|
95
|
+
Enabled: true
|
96
|
+
EnforcedStyle: indented_internal_methods
|
97
|
+
|
98
|
+
# Two spaces, no tabs (for indentation).
|
99
|
+
Layout/IndentationWidth:
|
100
|
+
Enabled: true
|
101
|
+
|
102
|
+
Layout/LeadingCommentSpace:
|
103
|
+
Enabled: true
|
104
|
+
|
105
|
+
Layout/SpaceAfterColon:
|
106
|
+
Enabled: true
|
107
|
+
|
108
|
+
Layout/SpaceAfterComma:
|
109
|
+
Enabled: true
|
110
|
+
|
111
|
+
Layout/SpaceAfterSemicolon:
|
112
|
+
Enabled: true
|
113
|
+
|
114
|
+
Layout/SpaceAroundEqualsInParameterDefault:
|
115
|
+
Enabled: true
|
116
|
+
|
117
|
+
Layout/SpaceAroundKeyword:
|
118
|
+
Enabled: true
|
119
|
+
|
120
|
+
Layout/SpaceBeforeComma:
|
121
|
+
Enabled: true
|
122
|
+
|
123
|
+
Layout/SpaceBeforeComment:
|
124
|
+
Enabled: true
|
125
|
+
|
126
|
+
Layout/SpaceBeforeFirstArg:
|
127
|
+
Enabled: true
|
128
|
+
|
129
|
+
Style/DefWithParentheses:
|
130
|
+
Enabled: true
|
131
|
+
|
132
|
+
# Defining a method with parameters needs parentheses.
|
133
|
+
Style/MethodDefParentheses:
|
134
|
+
Enabled: true
|
135
|
+
|
136
|
+
Style/FrozenStringLiteralComment:
|
137
|
+
Enabled: true
|
138
|
+
EnforcedStyle: always
|
139
|
+
|
140
|
+
Style/RedundantFreeze:
|
141
|
+
Enabled: true
|
142
|
+
|
143
|
+
# Use `foo {}` not `foo{}`.
|
144
|
+
Layout/SpaceBeforeBlockBraces:
|
145
|
+
Enabled: true
|
146
|
+
|
147
|
+
# Use `foo { bar }` not `foo {bar}`.
|
148
|
+
Layout/SpaceInsideBlockBraces:
|
149
|
+
Enabled: true
|
150
|
+
EnforcedStyleForEmptyBraces: space
|
151
|
+
|
152
|
+
# Use `{ a: 1 }` not `{a:1}`.
|
153
|
+
Layout/SpaceInsideHashLiteralBraces:
|
154
|
+
Enabled: true
|
155
|
+
|
156
|
+
Layout/SpaceInsideParens:
|
157
|
+
Enabled: true
|
158
|
+
|
159
|
+
# Check quotes usage according to lint rule below.
|
160
|
+
Style/StringLiterals:
|
161
|
+
Enabled: true
|
162
|
+
EnforcedStyle: double_quotes
|
163
|
+
|
164
|
+
# Detect hard tabs, no hard tabs.
|
165
|
+
Layout/IndentationStyle:
|
166
|
+
Enabled: true
|
167
|
+
|
168
|
+
# Empty lines should not have any spaces.
|
169
|
+
Layout/TrailingEmptyLines:
|
170
|
+
Enabled: true
|
171
|
+
|
172
|
+
# No trailing whitespace.
|
173
|
+
Layout/TrailingWhitespace:
|
174
|
+
Enabled: true
|
175
|
+
|
176
|
+
# Use quotes for string literals when they are enough.
|
177
|
+
Style/RedundantPercentQ:
|
178
|
+
Enabled: true
|
179
|
+
|
180
|
+
Lint/AmbiguousOperator:
|
181
|
+
Enabled: true
|
182
|
+
|
183
|
+
Lint/AmbiguousRegexpLiteral:
|
184
|
+
Enabled: true
|
185
|
+
|
186
|
+
Lint/ErbNewArguments:
|
187
|
+
Enabled: true
|
188
|
+
|
189
|
+
# Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
|
190
|
+
Lint/RequireParentheses:
|
191
|
+
Enabled: true
|
192
|
+
|
193
|
+
Lint/ShadowingOuterLocalVariable:
|
194
|
+
Enabled: true
|
195
|
+
|
196
|
+
Lint/RedundantStringCoercion:
|
197
|
+
Enabled: true
|
198
|
+
|
199
|
+
Lint/UriEscapeUnescape:
|
200
|
+
Enabled: true
|
201
|
+
|
202
|
+
Lint/UselessAssignment:
|
203
|
+
Enabled: true
|
204
|
+
|
205
|
+
Lint/DeprecatedClassMethods:
|
206
|
+
Enabled: true
|
207
|
+
|
208
|
+
Style/ParenthesesAroundCondition:
|
209
|
+
Enabled: true
|
210
|
+
|
211
|
+
Style/HashTransformKeys:
|
212
|
+
Enabled: true
|
213
|
+
|
214
|
+
Style/HashTransformValues:
|
215
|
+
Enabled: true
|
216
|
+
|
217
|
+
Style/RedundantBegin:
|
218
|
+
Enabled: true
|
219
|
+
|
220
|
+
Style/RedundantReturn:
|
221
|
+
Enabled: true
|
222
|
+
AllowMultipleReturnValues: true
|
223
|
+
|
224
|
+
Style/Semicolon:
|
225
|
+
Enabled: true
|
226
|
+
AllowAsExpressionSeparator: true
|
227
|
+
|
228
|
+
# Prefer Foo.method over Foo::method
|
229
|
+
Style/ColonMethodCall:
|
230
|
+
Enabled: true
|
231
|
+
|
232
|
+
Style/TrivialAccessors:
|
233
|
+
Enabled: true
|
234
|
+
|
235
|
+
Performance/FlatMap:
|
236
|
+
Enabled: true
|
237
|
+
|
238
|
+
Performance/RedundantMerge:
|
239
|
+
Enabled: true
|
240
|
+
|
241
|
+
Performance/StartWith:
|
242
|
+
Enabled: true
|
243
|
+
|
244
|
+
Performance/EndWith:
|
245
|
+
Enabled: true
|
246
|
+
|
247
|
+
Performance/RegexpMatch:
|
248
|
+
Enabled: true
|
249
|
+
|
250
|
+
Performance/ReverseEach:
|
251
|
+
Enabled: true
|
252
|
+
|
253
|
+
Performance/UnfreezeString:
|
254
|
+
Enabled: true
|
255
|
+
|
256
|
+
Performance/DeletePrefix:
|
257
|
+
Enabled: true
|
258
|
+
|
259
|
+
Performance/DeleteSuffix:
|
260
|
+
Enabled: true
|
261
|
+
|
262
|
+
<% end %>
|