gemaker 0.3.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +5 -5
  2. data/.circleci/config.yml +103 -0
  3. data/.circleci/setup-rubygems.sh +3 -0
  4. data/.rubocop.yml +72 -614
  5. data/.ruby-version +1 -1
  6. data/CHANGELOG.md +33 -0
  7. data/README.md +16 -1
  8. data/gemaker.gemspec +9 -15
  9. data/lib/gemaker.rb +2 -1
  10. data/lib/gemaker/cli.rb +8 -6
  11. data/lib/gemaker/commands/add_cli_structure.rb +1 -0
  12. data/lib/gemaker/commands/add_install_generator.rb +30 -6
  13. data/lib/gemaker/commands/configure_continuous_integration.rb +23 -0
  14. data/lib/gemaker/commands/configure_editor_config.rb +10 -0
  15. data/lib/gemaker/commands/configure_git.rb +13 -2
  16. data/lib/gemaker/commands/configure_test_env.rb +9 -6
  17. data/lib/gemaker/commands/create_gem.rb +11 -5
  18. data/lib/gemaker/commands/customize_engine.rb +31 -4
  19. data/lib/gemaker/config.rb +1 -9
  20. data/lib/gemaker/templates/circle_config.yml.erb +103 -0
  21. data/lib/gemaker/templates/circleci-setup-script.sh +3 -0
  22. data/lib/gemaker/templates/editorconfig +24 -0
  23. data/lib/gemaker/templates/engine/Guardfile +6 -9
  24. data/lib/gemaker/templates/engine/README.md.erb +45 -2
  25. data/lib/gemaker/templates/engine/development.rb.erb +81 -0
  26. data/lib/gemaker/templates/engine/engine.rb.erb +1 -1
  27. data/lib/gemaker/templates/engine/gemspec.erb +9 -5
  28. data/lib/gemaker/templates/engine/gitignore +10 -0
  29. data/lib/gemaker/templates/engine/install_generator.rb.erb +0 -2
  30. data/lib/gemaker/templates/engine/rails_helper.rb.erb +24 -9
  31. data/lib/gemaker/templates/engine/rubocop.yml.erb +503 -0
  32. data/lib/gemaker/templates/normal/README.md.erb +14 -0
  33. data/lib/gemaker/templates/normal/gemspec.erb +9 -5
  34. data/lib/gemaker/templates/normal/rubocop.yml.erb +496 -0
  35. data/lib/gemaker/templates/normal/spec_helper.rb.erb +11 -0
  36. data/lib/gemaker/templates/ruby-version.erb +1 -1
  37. data/lib/gemaker/util.rb +3 -2
  38. data/lib/gemaker/version.rb +7 -1
  39. metadata +65 -50
  40. data/.coveralls.yml +0 -1
  41. data/.hound.yml +0 -4
  42. data/.travis.yml +0 -13
  43. data/lib/gemaker/commands/add_hound_rules.rb +0 -12
@@ -0,0 +1,3 @@
1
+ mkdir ~/.gem
2
+ echo -e "---\r\n:rubygems_api_key: $RUBYGEMS_API_KEY" > ~/.gem/credentials
3
+ chmod 0600 /home/circleci/.gem/credentials
@@ -0,0 +1,24 @@
1
+ # EditorConfig helps developers define and maintain consistent
2
+ # coding styles between different editors and IDEs
3
+ # editorconfig.org
4
+
5
+ root = true
6
+
7
+ [*]
8
+
9
+ # Change these settings to your own preference
10
+ indent_style = space
11
+ indent_size = 2
12
+
13
+ # We recommend you to keep these unchanged
14
+ end_of_line = lf
15
+ charset = utf-8
16
+ trim_trailing_whitespace = true
17
+ insert_final_newline = true
18
+
19
+ [*.js]
20
+ indent_style = space
21
+ indent_size = 2
22
+
23
+ [*.md]
24
+ trim_trailing_whitespace = false
@@ -1,15 +1,12 @@
1
1
  guard :rspec, cmd: "bundle exec rspec" do
2
- spec_dic = "spec/dummy/spec"
2
+ spec_dic = "spec"
3
3
  # RSpec files
4
4
  watch("spec/spec_helper.rb") { spec_dic }
5
5
  watch("spec/rails_helper.rb") { spec_dic }
6
- watch(%r{^spec\/dummy\/spec\/support\/(.+)\.rb$}) { spec_dic }
7
- watch(%r{^spec\/dummy\/spec\/.+_spec\.rb$})
6
+ watch(%r{^spec/support/(.+)\.rb$}) { spec_dic }
7
+ watch(%r{^spec/.+_spec\.rb$})
8
8
  # Engine files
9
- watch(%r{^lib/(.+)\.rb$}) { |m| "spec/dummy/spec/lib/#{m[1]}_spec.rb" }
10
- watch(%r{^app/(.+)\.rb$}) { |m| "spec/dummy/spec/#{m[1]}_spec.rb" }
11
- watch(%r{^app/(.*)(\.erb)$}) { |m| "spec/dummy/spec/#{m[1]}#{m[2]}_spec.rb" }
12
- # Dummy app files
13
- watch(%r{^spec\/dummy\/app/(.+)\.rb$}) { |m| "spec/dummy/spec/#{m[1]}_spec.rb" }
14
- watch(%r{^spec\/dummy\/app/(.*)(\.erb)$}) { |m| "spec/dummy/spec/#{m[1]}#{m[2]}_spec.rb" }
9
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
10
+ watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
11
+ watch(%r{^app/(.*)(\.erb)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
15
12
  end
@@ -1,5 +1,8 @@
1
1
  # <%= config.human_gem_name %>
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/<%= config.gem_name %>.svg)](https://badge.fury.io/rb/<%= config.gem_name %>)
4
+ [![CircleCI](https://circleci.com/gh/platanus/<%= config.gem_name %>.svg?style=shield)](https://app.circleci.com/pipelines/github/platanus/<%= config.gem_name %>)
5
+
3
6
  <%= config.description.blank? ? "TODO" : config.description %>
4
7
 
5
8
  ## Installation
@@ -24,15 +27,55 @@ rails generate <%= @config.gem_name %>:install
24
27
 
25
28
  TODO
26
29
 
30
+ ## Development
31
+
32
+ ### Models and migrations
33
+
34
+ - Create dummy app models with development and testing purposes inside the dummy app `spec/dummy`:
35
+
36
+ `bin/rails g model user`
37
+
38
+ The `User` model will be created in `spec/dummy/app/models`.
39
+ The `user_spec.rb` file needs to be deleted, but it is a good idea to leave the factory.
40
+
41
+ - Create engine related models inside the engine's root path '/':
42
+
43
+ `bin/rails g model job`
44
+
45
+ The `EngineName::Job` model will be created in `app/models/engine_name`.
46
+ A factory will be added to `engine_name/spec/factories/engine_name/jobs.rb`, you must to add the `class` option manually.
47
+
48
+ ```ruby
49
+ FactoryBot.define do
50
+ factory :job, class: "EngineName::Job" do
51
+ # ...
52
+ end
53
+ end
54
+ ```
55
+
56
+ - While developing the engine run migrations in the root path `bin/rails db:migrate`. This will apply the gem and dummy app migrations too.
57
+ - When using in a project, the engine migrations must be copied to it. This can be done by running: `bin/rails engine_name:install:migrations`
58
+
27
59
  ## Testing
28
60
 
29
- To run the specs you need to execute, **in the root path of the gem**, the following command:
61
+ To run the specs you need to execute, in the root path of the engine, the following command:
30
62
 
31
63
  ```bash
32
64
  bundle exec guard
33
65
  ```
34
66
 
35
- You need to put **all your tests** in the `/<%= config.gem_name %>/spec/dummy/spec/` directory.
67
+ You need to put **all your tests** in the `/<%= config.gem_name %>/spec` directory.
68
+
69
+ ## Publishing
70
+
71
+ On master/main branch...
72
+
73
+ 1. Change `VERSION` in `lib/<%= @config.gem_name %>/version.rb`.
74
+ 2. Change `Unreleased` title to current version in `CHANGELOG.md`.
75
+ 3. Run `bundle install`.
76
+ 4. Commit new release. For example: `Releasing v0.1.0`.
77
+ 5. Create tag. For example: `git tag v0.1.0`.
78
+ 6. Push tag. For example: `git push origin v0.1.0`.
36
79
 
37
80
  ## Contributing
38
81
 
@@ -0,0 +1,81 @@
1
+ require "active_support/core_ext/integer/time"
2
+
3
+ Rails.application.configure do
4
+ # Settings specified here will take precedence over those in config/application.rb.
5
+
6
+ # In the development environment your application's code is reloaded any time
7
+ # it changes. This slows down response time but is perfect for development
8
+ # since you don't have to restart the web server when you make code changes.
9
+ config.cache_classes = false
10
+
11
+ # Do not eager load code on boot.
12
+ config.eager_load = false
13
+
14
+ # Show full error reports.
15
+ config.consider_all_requests_local = true
16
+
17
+ # Enable/disable caching. By default caching is disabled.
18
+ # Run rails dev:cache to toggle caching.
19
+ if Rails.root.join('tmp', 'caching-dev.txt').exist?
20
+ config.action_controller.perform_caching = true
21
+ config.action_controller.enable_fragment_cache_logging = true
22
+
23
+ config.cache_store = :memory_store
24
+ config.public_file_server.headers = {
25
+ 'Cache-Control' => "public, max-age=#{2.days.to_i}"
26
+ }
27
+ else
28
+ config.action_controller.perform_caching = false
29
+
30
+ config.cache_store = :null_store
31
+ end
32
+
33
+ # Store uploaded files on the local file system (see config/storage.yml for options).
34
+ config.active_storage.service = :local
35
+
36
+ # Don't care if the mailer can't send.
37
+ config.action_mailer.raise_delivery_errors = false
38
+
39
+ config.action_mailer.perform_caching = false
40
+
41
+ # Print deprecation notices to the Rails logger.
42
+ config.active_support.deprecation = :log
43
+
44
+ # Raise exceptions for disallowed deprecations.
45
+ config.active_support.disallowed_deprecation = :raise
46
+
47
+ # Tell Active Support which deprecation messages to disallow.
48
+ config.active_support.disallowed_deprecation_warnings = []
49
+
50
+ # Raise an error on page load if there are pending migrations.
51
+ config.active_record.migration_error = :page_load
52
+
53
+ # Highlight code that triggered database queries in logs.
54
+ config.active_record.verbose_query_logs = true
55
+
56
+ # Debug mode disables concatenation and preprocessing of assets.
57
+ # This option may cause significant delays in view rendering with a large
58
+ # number of complex assets.
59
+ config.assets.debug = true
60
+
61
+ # Suppress logger output for asset requests.
62
+ config.assets.quiet = true
63
+
64
+ # Raises error for missing translations.
65
+ # config.i18n.raise_on_missing_translations = true
66
+
67
+ # Annotate rendered view with file names.
68
+ # config.action_view.annotate_rendered_view_with_filenames = true
69
+
70
+ # Use an evented file watcher to asynchronously detect changes in source code,
71
+ # routes, locales, etc. This feature depends on the listen gem.
72
+ # config.file_watcher = ActiveSupport::EventedFileUpdateChecker
73
+
74
+ # Uncomment if you wish to allow Action Cable access from any origin.
75
+ # config.action_cable.disable_request_forgery_protection = true
76
+
77
+ config.generators do |g|
78
+ g.test_framework :rspec, fixture: true
79
+ g.fixture_replacement :factory_bot, dir: "#{::<%= config.gem_class %>::Engine.root}/spec/factories"
80
+ end
81
+ end
@@ -4,7 +4,7 @@ module <%= config.gem_class %>
4
4
 
5
5
  config.generators do |g|
6
6
  g.test_framework :rspec, fixture: false
7
- g.fixture_replacement :factory_girl, dir: "spec/factories"
7
+ g.fixture_replacement :factory_bot, dir: "spec/factories"
8
8
  end
9
9
 
10
10
  initializer "initialize" do
@@ -19,11 +19,15 @@ Gem::Specification.new do |s|
19
19
  s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
20
  s.test_files = Dir["spec/**/*"]
21
21
 
22
- s.add_dependency "rails", "~> 4.2", ">= 4.2.0"
22
+ s.add_dependency "rails", ">= <%= Gemaker::MIN_RAILS_VERSION %>"
23
+ s.add_development_dependency "bundler", "~> <%= Gemaker::BUNDLER_VERSION %>"
24
+ s.add_development_dependency "coveralls"
25
+ s.add_development_dependency "factory_bot_rails"
26
+ s.add_development_dependency "guard-rspec"
23
27
  s.add_development_dependency "pry"
24
28
  s.add_development_dependency "pry-rails"
25
- s.add_development_dependency "sqlite3"
26
- s.add_development_dependency "rspec-rails", "~> 3.4.0"
27
- s.add_development_dependency "guard-rspec", "~> 4.7"
28
- s.add_development_dependency "factory_girl_rails", "~> 4.6.0"
29
+ s.add_development_dependency "rspec_junit_formatter"
30
+ s.add_development_dependency "rspec-rails"
31
+ s.add_development_dependency "rubocop", "~> <%= Gemaker::RUBOCOP_VERSION %>"
32
+ s.add_development_dependency "rubocop-rails"
29
33
  end
@@ -0,0 +1,10 @@
1
+ .bundle/
2
+ log/*.log
3
+ pkg/
4
+ spec/dummy/db/*.sqlite3
5
+ spec/dummy/db/*.sqlite3-journal
6
+ spec/dummy/log/*.log
7
+ spec/dummy/tmp/
8
+ spec/dummy/.sass-cache
9
+ coverage/
10
+ Gemfile.lock
@@ -5,7 +5,6 @@ class <%= config.gem_class %>::InstallGenerator < Rails::Generators::Base
5
5
  template "initializer.rb", "config/initializers/<%= config.gem_name %>.rb"
6
6
  end
7
7
 
8
- <% if config.mountable? -%>
9
8
  def mount_routes
10
9
  line = "Rails.application.routes.draw do\n"
11
10
  inject_into_file "config/routes.rb", after: line do <<-"HERE".gsub(/^ {4}/, '')
@@ -13,7 +12,6 @@ class <%= config.gem_class %>::InstallGenerator < Rails::Generators::Base
13
12
  HERE
14
13
  end
15
14
  end
16
- <% end -%>
17
15
 
18
16
  def copy_engine_migrations
19
17
  rake "railties:install:migrations"
@@ -1,17 +1,35 @@
1
+ require 'simplecov'
2
+ require 'coveralls'
3
+
4
+ formatters = [SimpleCov::Formatter::HTMLFormatter, Coveralls::SimpleCov::Formatter]
5
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter::new(formatters)
6
+
7
+ SimpleCov.start do
8
+ add_filter do |src|
9
+ r = [
10
+ src.filename =~ /lib/,
11
+ src.filename =~ /models/,
12
+ src.filename =~ /controllers/
13
+ ].uniq
14
+ r.count == 1 && r.first.nil?
15
+ end
16
+
17
+ add_filter "engine.rb"
18
+ add_filter "spec.rb"
19
+ end
20
+
1
21
  ENV["RAILS_ENV"] ||= "test"
2
22
  require File.expand_path("../../spec/dummy/config/environment", __FILE__)
3
23
  abort("The Rails environment is running in production mode!") if Rails.env.production?
4
24
  require "pry"
5
25
  require "spec_helper"
6
26
  require "rspec/rails"
7
- require "factory_girl_rails"
8
-
9
- ActiveRecord::Migration.maintain_test_schema!
27
+ require "factory_bot_rails"
10
28
 
11
- Dir[::Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
29
+ Dir[::<%= config.gem_class %>::Engine.root.join("spec/support/**/*.rb")].sort.each { |f| require f }
12
30
 
13
31
  RSpec.configure do |config|
14
- config.fixture_path = "#{::Rails.root}/spec/assets"
32
+ config.fixture_path = "#{::<%= config.gem_class %>::Engine.root}/spec/assets"
15
33
  config.use_transactional_fixtures = true
16
34
  config.infer_spec_type_from_file_location!
17
35
  config.filter_rails_from_backtrace!
@@ -19,10 +37,7 @@ RSpec.configure do |config|
19
37
  config.filter_run :focus
20
38
  config.run_all_when_everything_filtered = true
21
39
 
22
- FactoryGirl.definition_file_paths = ["#{::Rails.root}/spec/factories"]
23
- FactoryGirl.find_definitions
24
-
25
- config.include FactoryGirl::Syntax::Methods
40
+ config.include FactoryBot::Syntax::Methods
26
41
  config.include ActionDispatch::TestProcess
27
42
  config.include TestHelpers
28
43
  end
@@ -0,0 +1,503 @@
1
+ require:
2
+ - rubocop-rails
3
+ AllCops:
4
+ Exclude:
5
+ - "vendor/**/*"
6
+ - "db/**/*"
7
+ - "bin/**/*"
8
+ TargetRubyVersion: <%= Gemaker::RUBY_VERSION %>
9
+ Rails:
10
+ Enabled: true
11
+ Layout/ParameterAlignment:
12
+ Description: Align the parameters of a method call if they span more than one line.
13
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-double-indent
14
+ Enabled: true
15
+ EnforcedStyle: with_fixed_indentation
16
+ SupportedStyles:
17
+ - with_first_parameter
18
+ - with_fixed_indentation
19
+ Metrics/BlockLength:
20
+ Enabled: false
21
+ Style/ClassAndModuleChildren:
22
+ Description: Checks style of children classes and modules.
23
+ Enabled: false
24
+ EnforcedStyle: nested
25
+ SupportedStyles:
26
+ - nested
27
+ - compact
28
+ Style/CommentAnnotation:
29
+ Description: Checks formatting of special comments (TODO, FIXME, OPTIMIZE, HACK,
30
+ REVIEW).
31
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#annotate-keywords
32
+ Enabled: false
33
+ Keywords:
34
+ - TODO
35
+ - FIXME
36
+ - OPTIMIZE
37
+ - HACK
38
+ - REVIEW
39
+ Naming/FileName:
40
+ Description: Use snake_case for source file names.
41
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#snake-case-files
42
+ Enabled: false
43
+ Exclude: []
44
+ Style/FormatString:
45
+ Description: Enforce the use of Kernel#sprintf, Kernel#format or String#%.
46
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#sprintf
47
+ Enabled: false
48
+ EnforcedStyle: format
49
+ SupportedStyles:
50
+ - format
51
+ - sprintf
52
+ - percent
53
+ Style/FrozenStringLiteralComment:
54
+ Enabled: false
55
+ Style/GlobalVars:
56
+ Description: Do not introduce global variables.
57
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#instance-vars
58
+ Enabled: false
59
+ AllowedVariables: []
60
+ Style/GuardClause:
61
+ Description: Check for conditionals that can be replaced with guard clauses
62
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals
63
+ Enabled: false
64
+ MinBodyLength: 1
65
+ Style/IfUnlessModifier:
66
+ Description: Favor modifier if/unless usage when you have a single-line body.
67
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier
68
+ Enabled: false
69
+ Style/LambdaCall:
70
+ Description: Use lambda.call(...) instead of lambda.(...).
71
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#proc-call
72
+ Enabled: false
73
+ EnforcedStyle: call
74
+ SupportedStyles:
75
+ - call
76
+ - braces
77
+ Style/Next:
78
+ Description: Use `next` to skip iteration instead of a condition at the end.
79
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals
80
+ Enabled: false
81
+ EnforcedStyle: skip_modifier_ifs
82
+ MinBodyLength: 3
83
+ SupportedStyles:
84
+ - skip_modifier_ifs
85
+ - always
86
+ Layout/MultilineOperationIndentation:
87
+ Description: Checks indentation of binary operations that span more than one line.
88
+ Enabled: true
89
+ EnforcedStyle: indented
90
+ SupportedStyles:
91
+ - aligned
92
+ - indented
93
+ Style/MutableConstant:
94
+ Description: Do not assign mutable objects to constants.
95
+ Enabled: false
96
+ Style/NumericLiterals:
97
+ Description: Add underscores to large numeric literals to improve their readability.
98
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#underscores-in-numerics
99
+ Enabled: false
100
+ MinDigits: 5
101
+ Style/PercentLiteralDelimiters:
102
+ Description: Use `%`-literal delimiters consistently
103
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#percent-literal-braces
104
+ Enabled: false
105
+ PreferredDelimiters:
106
+ "%": "()"
107
+ "%i": "()"
108
+ "%q": "()"
109
+ "%Q": "()"
110
+ "%r": "{}"
111
+ "%s": "()"
112
+ "%w": "()"
113
+ "%W": "()"
114
+ "%x": "()"
115
+ Naming/PredicateName:
116
+ Description: Check the names of predicate methods.
117
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark
118
+ Enabled: true
119
+ NamePrefix:
120
+ - is_
121
+ - has_
122
+ - have_
123
+ ForbiddenPrefixes:
124
+ - is_
125
+ Style/RaiseArgs:
126
+ Description: Checks the arguments passed to raise/fail.
127
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#exception-class-messages
128
+ Enabled: false
129
+ EnforcedStyle: exploded
130
+ SupportedStyles:
131
+ - compact
132
+ - exploded
133
+ Style/SignalException:
134
+ Description: Checks for proper usage of fail and raise.
135
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#fail-method
136
+ Enabled: false
137
+ EnforcedStyle: semantic
138
+ SupportedStyles:
139
+ - only_raise
140
+ - only_fail
141
+ - semantic
142
+ Style/SingleLineMethods:
143
+ Description: Avoid single-line methods.
144
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-single-line-methods
145
+ Enabled: false
146
+ AllowIfMethodIsEmpty: true
147
+ Style/StringLiterals:
148
+ Description: Checks if uses of quotes match the configured preference.
149
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-string-literals
150
+ Enabled: false
151
+ EnforcedStyle: double_quotes
152
+ SupportedStyles:
153
+ - single_quotes
154
+ - double_quotes
155
+ Style/TrailingCommaInArguments:
156
+ Description: Checks for trailing comma in argument lists.
157
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas
158
+ Enabled: true
159
+ Style/TrailingCommaInArrayLiteral:
160
+ Description: Checks for trailing comma in array and hash literals.
161
+ StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-trailing-array-commas
162
+ Enabled: true
163
+ Style/TrailingCommaInHashLiteral:
164
+ Description: Checks for trailing comma in array and hash literals.
165
+ StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-trailing-array-commas
166
+ Enabled: true
167
+ Style/TrivialAccessors:
168
+ Description: Prefer attr_* methods to trivial readers/writers.
169
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#attr_family
170
+ Enabled: false
171
+ ExactNameMatch: false
172
+ AllowPredicates: false
173
+ AllowDSLWriters: false
174
+ AllowedMethods:
175
+ - to_ary
176
+ - to_a
177
+ - to_c
178
+ - to_enum
179
+ - to_h
180
+ - to_hash
181
+ - to_i
182
+ - to_int
183
+ - to_io
184
+ - to_open
185
+ - to_path
186
+ - to_proc
187
+ - to_r
188
+ - to_regexp
189
+ - to_str
190
+ - to_s
191
+ - to_sym
192
+ Style/WhileUntilModifier:
193
+ Description: Favor modifier while/until usage when you have a single-line body.
194
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#while-as-a-modifier
195
+ Enabled: false
196
+ Style/ExponentialNotation:
197
+ Enabled: true
198
+ Style/HashEachMethods:
199
+ Description: Use Hash#each_key and Hash#each_value.
200
+ Enabled: true
201
+ Style/HashTransformKeys:
202
+ Description: Prefer `transform_keys` over `each_with_object` and `map`.
203
+ Enabled: true
204
+ Style/HashTransformValues:
205
+ Description: Prefer `transform_values` over `each_with_object` and `map`.
206
+ Enabled: true
207
+ Metrics/AbcSize:
208
+ Description: A calculated magnitude based on number of assignments, branches, and
209
+ conditions.
210
+ Enabled: true
211
+ Max: 25
212
+ Metrics/BlockNesting:
213
+ Description: Avoid excessive block nesting
214
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#three-is-the-number-thou-shalt-count
215
+ Enabled: true
216
+ Max: 3
217
+ Metrics/ClassLength:
218
+ Description: Avoid classes longer than 100 lines of code.
219
+ Enabled: false
220
+ CountComments: false
221
+ Max: 100
222
+ Metrics/MethodLength:
223
+ Description: Avoid methods longer than 15 lines of code.
224
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#short-methods
225
+ Enabled: true
226
+ CountComments: true
227
+ Max: 15
228
+ Exclude:
229
+ - "spec/**/*"
230
+ Metrics/ParameterLists:
231
+ Description: Avoid long parameter lists.
232
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#too-many-params
233
+ Enabled: false
234
+ Max: 5
235
+ CountKeywordArgs: true
236
+ Lint/AssignmentInCondition:
237
+ Description: Don't use assignment in conditions.
238
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#safe-assignment-in-condition
239
+ Enabled: false
240
+ AllowSafeAssignment: true
241
+ Layout/LineLength:
242
+ Description: Limit lines to 100 characters.
243
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#100-character-limits
244
+ Enabled: true
245
+ Max: 100
246
+ AllowURI: true
247
+ URISchemes:
248
+ - http
249
+ - https
250
+ Layout/EndAlignment:
251
+ Description: Align ends correctly.
252
+ Enabled: true
253
+ EnforcedStyleAlignWith: keyword
254
+ SupportedStylesAlignWith:
255
+ - keyword
256
+ - variable
257
+ Layout/DefEndAlignment:
258
+ Description: Align ends corresponding to defs correctly.
259
+ Enabled: true
260
+ EnforcedStyleAlignWith: start_of_line
261
+ SupportedStylesAlignWith:
262
+ - start_of_line
263
+ - def
264
+ Layout/SpaceAroundMethodCallOperator:
265
+ Description: Checks method call operators to not have spaces around them.
266
+ Enabled: true
267
+ Style/SymbolArray:
268
+ Description: Use %i or %I for arrays of symbols.
269
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#percent-i
270
+ Enabled: false
271
+ Layout/ExtraSpacing:
272
+ Description: Do not use unnecessary spacing.
273
+ Enabled: false
274
+ Naming/AccessorMethodName:
275
+ Description: Check the naming of accessor methods for get_/set_.
276
+ Enabled: false
277
+ Style/Alias:
278
+ Description: Use alias_method instead of alias.
279
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#alias-method
280
+ Enabled: false
281
+ Style/ArrayJoin:
282
+ Description: Use Array#join instead of Array#*.
283
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#array-join
284
+ Enabled: false
285
+ Style/AsciiComments:
286
+ Description: Use only ascii symbols in comments.
287
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#english-comments
288
+ Enabled: false
289
+ Naming/AsciiIdentifiers:
290
+ Description: Use only ascii symbols in identifiers.
291
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#english-identifiers
292
+ Enabled: false
293
+ Style/Attr:
294
+ Description: Checks for uses of Module#attr.
295
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#attr
296
+ Enabled: false
297
+ Style/BlockComments:
298
+ Description: Do not use block comments.
299
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-block-comments
300
+ Enabled: false
301
+ Style/CaseEquality:
302
+ Description: Avoid explicit use of the case equality operator(===).
303
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-case-equality
304
+ Enabled: false
305
+ Style/CharacterLiteral:
306
+ Description: Checks for uses of character literals.
307
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-character-literals
308
+ Enabled: false
309
+ Style/ClassVars:
310
+ Description: Avoid the use of class variables.
311
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-class-vars
312
+ Enabled: false
313
+ Style/ColonMethodCall:
314
+ Description: 'Do not use :: for method call.'
315
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#double-colons
316
+ Enabled: false
317
+ Style/PreferredHashMethods:
318
+ Description: Checks for use of deprecated Hash methods.
319
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#hash-key
320
+ Enabled: false
321
+ Style/Documentation:
322
+ Description: Document classes and non-namespace modules.
323
+ Enabled: false
324
+ Style/DoubleNegation:
325
+ Description: Checks for uses of double negation (!!).
326
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-bang-bang
327
+ Enabled: false
328
+ Style/EachWithObject:
329
+ Description: Prefer `each_with_object` over `inject` or `reduce`.
330
+ Enabled: false
331
+ Style/EmptyElse:
332
+ Description: Avoid empty else-clauses.
333
+ Enabled: true
334
+ Style/EmptyLiteral:
335
+ Description: Prefer literals to Array.new/Hash.new/String.new.
336
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#literal-array-hash
337
+ Enabled: false
338
+ Layout/EndOfLine:
339
+ Description: Use Unix-style line endings.
340
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#crlf
341
+ Enabled: true
342
+ Style/EvenOdd:
343
+ Description: Favor the use of Fixnum#even? && Fixnum#odd?
344
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#predicate-methods
345
+ Enabled: false
346
+ Lint/FlipFlop:
347
+ Description: Checks for flip flops
348
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-flip-flops
349
+ Enabled: false
350
+ Style/IfWithSemicolon:
351
+ Description: Do not use if x; .... Use the ternary operator instead.
352
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-semicolon-ifs
353
+ Enabled: false
354
+ Style/Lambda:
355
+ Description: Use the new lambda literal syntax for single-line blocks.
356
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#lambda-multi-line
357
+ Enabled: false
358
+ Style/LineEndConcatenation:
359
+ Description: Use \ instead of + or << to concatenate two string literals at line
360
+ end.
361
+ Enabled: false
362
+ Style/ModuleFunction:
363
+ Description: Checks for usage of `extend self` in modules.
364
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#module-function
365
+ Enabled: false
366
+ Style/MultilineBlockChain:
367
+ Description: Avoid multi-line chains of blocks.
368
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#single-line-blocks
369
+ Enabled: false
370
+ Layout/MultilineBlockLayout:
371
+ Description: Ensures newlines after multiline block do statements.
372
+ Enabled: false
373
+ Style/NegatedIf:
374
+ Description: Favor unless over if for negative conditions (or control flow or).
375
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#unless-for-negatives
376
+ Enabled: false
377
+ Style/NegatedWhile:
378
+ Description: Favor until over while for negative conditions.
379
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#until-for-negatives
380
+ Enabled: false
381
+ Style/NilComparison:
382
+ Description: Prefer x.nil? to x == nil.
383
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#predicate-methods
384
+ Enabled: false
385
+ Style/OneLineConditional:
386
+ Description: Favor the ternary operator(?:) over if/then/else/end constructs.
387
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#ternary-operator
388
+ Enabled: false
389
+ Naming/BinaryOperatorParameterName:
390
+ Description: When defining binary operators, name the argument other.
391
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#other-arg
392
+ Enabled: false
393
+ Style/PerlBackrefs:
394
+ Description: Avoid Perl-style regex back references.
395
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-perl-regexp-last-matchers
396
+ Enabled: false
397
+ Style/Proc:
398
+ Description: Use proc instead of Proc.new.
399
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#proc
400
+ Enabled: false
401
+ Style/SelfAssignment:
402
+ Description: Checks for places where self-assignment shorthand should have been
403
+ used.
404
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#self-assignment
405
+ Enabled: false
406
+ Layout/SpaceBeforeFirstArg:
407
+ Description: Put a space between a method name and the first argument in a method
408
+ call without parentheses.
409
+ Enabled: true
410
+ Layout/SpaceAroundOperators:
411
+ Description: Use spaces around operators.
412
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#spaces-operators
413
+ Enabled: true
414
+ Layout/SpaceInsideParens:
415
+ Description: No spaces after ( or before ).
416
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-spaces-braces
417
+ Enabled: true
418
+ Style/SpecialGlobalVars:
419
+ Description: Avoid Perl-style global variables.
420
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-cryptic-perlisms
421
+ Enabled: false
422
+ Style/VariableInterpolation:
423
+ Description: Don't interpolate global, instance and class variables directly in
424
+ strings.
425
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#curlies-interpolate
426
+ Enabled: false
427
+ Style/WhenThen:
428
+ Description: Use when x then ... for one-line cases.
429
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#one-line-cases
430
+ Enabled: false
431
+ Lint/AmbiguousOperator:
432
+ Description: Checks for ambiguous operators in the first argument of a method invocation
433
+ without parentheses.
434
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#parens-as-args
435
+ Enabled: false
436
+ Lint/AmbiguousRegexpLiteral:
437
+ Description: Checks for ambiguous regexp literals in the first argument of a method
438
+ invocation without parenthesis.
439
+ Enabled: false
440
+ Layout/BlockAlignment:
441
+ Description: Align block ends correctly.
442
+ Enabled: true
443
+ Layout/ConditionPosition:
444
+ Description: Checks for condition placed in a confusing position relative to the
445
+ keyword.
446
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#same-line-condition
447
+ Enabled: false
448
+ Lint/DeprecatedClassMethods:
449
+ Description: Check for deprecated class method calls.
450
+ Enabled: false
451
+ Lint/ElseLayout:
452
+ Description: Check for odd code arrangement in an else block.
453
+ Enabled: false
454
+ Lint/SuppressedException:
455
+ Description: Don't suppress exception.
456
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#dont-hide-exceptions
457
+ Enabled: false
458
+ Lint/LiteralAsCondition:
459
+ Description: Checks of literals used in conditions.
460
+ Enabled: false
461
+ Lint/LiteralInInterpolation:
462
+ Description: Checks for literals used in interpolation.
463
+ Enabled: false
464
+ Lint/Loop:
465
+ Description: Use Kernel#loop with break rather than begin/end/until or begin/end/while
466
+ for post-loop tests.
467
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#loop-with-break
468
+ Enabled: false
469
+ Lint/ParenthesesAsGroupedExpression:
470
+ Description: Checks for method calls with a space before the opening parenthesis.
471
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#parens-no-spaces
472
+ Enabled: false
473
+ Lint/RequireParentheses:
474
+ Description: Use parentheses in the method call to avoid confusion about precedence.
475
+ Enabled: false
476
+ Lint/UnderscorePrefixedVariableName:
477
+ Description: Do not use prefix `_` for a variable that is used.
478
+ Enabled: false
479
+ Lint/Void:
480
+ Description: Possible use of operator/literal/variable in void context.
481
+ Enabled: false
482
+ Lint/RaiseException:
483
+ Description: Checks for `raise` or `fail` statements which are raising `Exception` class.
484
+ Enabled: true
485
+ Lint/StructNewOverride:
486
+ Description: Disallow overriding the `Struct` built-in methods via `Struct.new`.
487
+ Enabled: true
488
+ Rails/Delegate:
489
+ Description: Prefer delegate method for delegations.
490
+ Enabled: false
491
+ Style/OptionalBooleanParameter:
492
+ Description: 'Use keyword arguments when defining method with boolean argument.'
493
+ Enabled: false
494
+ Lint/MissingSuper:
495
+ Description: >-
496
+ This cop checks for the presence of constructors and lifecycle callbacks
497
+ without calls to `super`'.
498
+ Enabled: false
499
+ Style/RedundantFileExtensionInRequire:
500
+ Description: >-
501
+ Checks for the presence of superfluous `.rb` extension in
502
+ the filename provided to `require` and `require_relative`.
503
+ Enabled: false