framgia-rails-init 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: aeb200c652f07e7aa9d0e17a8890f43b537e5f20
4
+ data.tar.gz: 94ed2ae30158624f6f29f2a25b3816cd8c5ecd74
5
+ SHA512:
6
+ metadata.gz: aec88b65c222586c43f7c4f69009f4f0d245f27c12d71fd9813f6860d2bbf65c8066e2ff8920e6ca85d59eef694b405bcbb34ece0471884a0908fe2f1e3c4b8f
7
+ data.tar.gz: 3e425720b17ffd3f5d343c858d0b85f1050e4ee5f6dc15b7bc0144723d4195de66d703a1ef76861fcd34d2f34e92161ddff87d7da7d284d42a184e44a3875be9
@@ -0,0 +1,13 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
13
+ /.idea/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.4.0
5
+ before_install: gem install bundler -v 1.15.1
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at ohmygodvt95@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Ohmygodvt95
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,43 @@
1
+ # Rails::Init
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/rails/init`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'framgia-rails-init'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install rails-init
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/rails-init. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
40
+
41
+ ## Code of Conduct
42
+
43
+ Everyone interacting in the Rails::Init project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/rails-init/blob/master/CODE_OF_CONDUCT.md).
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "rails/init"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "rails/init"
4
+
5
+ RailsInit.process
@@ -0,0 +1,60 @@
1
+ require "rails/init/version"
2
+
3
+ class RailsInit
4
+ TEMPLATE = File.expand_path "../../../templates", __FILE__
5
+
6
+ def self.process
7
+ system "echo", "-e", "\e[92m*** Start framgia-rails-init by Framgia convention"
8
+ @current_project = `pwd`
9
+ @current_project = @current_project.gsub /\n/, ""
10
+
11
+ clear_gemfile
12
+ clear_application_erb
13
+ cp_file
14
+
15
+ system "echo", "-e", "\e[92m=> Your project was successfully beautified!"
16
+ rescue => e
17
+ system "echo", "-e", "\e[91m#{e.message}"
18
+ system "echo", "-e", "\e[91m(!) Make sure you're in the right place!"
19
+ end
20
+
21
+ private_class_method
22
+ def self.clear_gemfile
23
+ content = File.read @current_project + "/Gemfile"
24
+ content = content.gsub /\#\s.*\s*/, ""
25
+ content = content.gsub /'/, '"'
26
+ content = content.gsub /\s*^group/, "\n\ngroup"
27
+ content = content.gsub /\s*^\s+^gem/, "\n\ngem"
28
+ File.open @current_project + "/Gemfile", "w" do |file|
29
+ file.puts content
30
+ system "echo", "-e", "\e[00m- Clear Gemfile"
31
+ end
32
+ end
33
+
34
+ def self.clear_application_erb
35
+ content = File.read @current_project + "/app/views/layouts/application.html.erb"
36
+ content = content.gsub /'/, '"'
37
+ File.open @current_project + "/app/views/layouts/application.html.erb", "w" do |file|
38
+ file.puts content
39
+ system "echo", "-e", "\e[00m- Beautified /app/views/layouts/application.html.erb"
40
+ end
41
+ end
42
+
43
+ def self.cp_file
44
+ copy_file "#{@current_project}/config/database.yml",
45
+ "config/database.yml.example"
46
+ copy_file "#{@current_project}/config/secrets.yml",
47
+ "config/secrets.yml.example"
48
+
49
+ Dir.entries("#{TEMPLATE}").select do |filename|
50
+ if filename.length > 5
51
+ copy_file "#{TEMPLATE}/#{filename}", filename
52
+ end
53
+ end
54
+ end
55
+
56
+ def self.copy_file a, b
57
+ `cp #{a} #{@current_project}/#{b}`
58
+ system "echo", "-e", "\e[00m- Copy ~> #{b}"
59
+ end
60
+ end
@@ -0,0 +1,5 @@
1
+ module Rails
2
+ module Init
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,36 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "rails/init/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "framgia-rails-init"
8
+ spec.version = Rails::Init::VERSION
9
+ spec.authors = ["Ohmygodvt95"]
10
+ spec.email = ["ohmygodvt95@gmail.com"]
11
+
12
+ spec.summary = %q{Init rails basic project by framgia rails convention.}
13
+ spec.description = %q{Init rails basic project by framgia rails convention..}
14
+ spec.homepage = "https://github.com/ohmygodvt95/framgia-rails-init"
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
19
+ # if spec.respond_to?(:metadata)
20
+ # spec.metadata["allowed_push_host"] = "http://rubygems.org"
21
+ # else
22
+ # raise "RubyGems 2.0 or newer is required to protect against " \
23
+ # "public gem pushes."
24
+ # end
25
+
26
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
27
+ f.match(%r{^(test|spec|features)/})
28
+ end
29
+ spec.bindir = "exe"
30
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
+ spec.require_paths = ["lib"]
32
+
33
+ spec.add_development_dependency "bundler", "~> 1.15"
34
+ spec.add_development_dependency "rake", "~> 10.0"
35
+ spec.add_development_dependency "rspec", "~> 3.0"
36
+ end
@@ -0,0 +1,4 @@
1
+ **/*{.,-}min.js
2
+ **/application.js
3
+ **/cable.js
4
+ **/jquery.bgswitcher.js
@@ -0,0 +1,29 @@
1
+ {
2
+ "env": {
3
+ "browser": true,
4
+ "jquery": true
5
+ },
6
+ "globals": {
7
+ "window": true
8
+ },
9
+
10
+ "extends": "eslint:recommended",
11
+ "rules": {
12
+ "indent": [
13
+ "error",
14
+ 2
15
+ ],
16
+ "linebreak-style": [
17
+ "error",
18
+ "unix"
19
+ ],
20
+ "quotes": [
21
+ "error",
22
+ "single"
23
+ ],
24
+ "semi": [
25
+ "error",
26
+ "always"
27
+ ]
28
+ }
29
+ }
@@ -0,0 +1,18 @@
1
+ project_type: ruby
2
+ test:
3
+ bundle-audit:
4
+ command: bundle-audit check --update | tee .framgia-ci-reports/bundle-audit.txt
5
+ rspec:
6
+ command: bundle exec rspec --format html --out .framgia-ci-reports/rspec.html spec/
7
+ brakeman:
8
+ command: bundle exec brakeman -o .framgia-ci-reports/brakeman.html -o .framgia-ci-reports/brakeman.json
9
+ reek:
10
+ command: bundle exec reek -c config.reek --format html > .framgia-ci-reports/reek.html app/
11
+ rubocop:
12
+ command: bundle exec rubocop --require rubocop/formatter/checkstyle_formatter --format RuboCop::Formatter::CheckstyleFormatter --no-color --rails --out .framgia-ci-reports/rubocop.xml app/ lib/
13
+ scss-lint:
14
+ command: bundle exec scss-lint --require=scss_lint_reporter_checkstyle --format=Checkstyle --out=.framgia-ci-reports/scss-lint.xml app/assets/stylesheets/
15
+ eslint:
16
+ command: eslint --format=checkstyle --output-file=.framgia-ci-reports/eslint.xml app/
17
+ rails_best_practices:
18
+ command: bundle exec rails_best_practices -c rails_best_practices.yml --format html --exclude "app/models/application_record.rb,app/models/group_user.rb,app/helpers/session_helper/rb,app/controllers/**" --output-file .framgia-ci-reports/rails_best_practices.html app/
@@ -0,0 +1,34 @@
1
+ *.rbc
2
+ *.sassc
3
+ .sass-cache
4
+ capybara-*.html
5
+ .rspec
6
+ .rvmrc
7
+ /.bundle
8
+ /vendor/bundle
9
+ /log/*
10
+ /tmp/*
11
+ /test/*
12
+ /db/*.sqlite3
13
+ /public/system/*
14
+ /coverage/
15
+ /spec/tmp/*
16
+ **.orig
17
+ rerun.txt
18
+ pickle-email-*.html
19
+ .project
20
+ /config/database.yml
21
+ /config/secrets.yml
22
+ /public/uploads
23
+ config/settings.local.yml
24
+ config/settings/*.local.yml
25
+ config/settings/test.yml
26
+ config/environments/*.local.yml
27
+ .DS_Store
28
+ /.idea
29
+ .byebug_history
30
+ .framgia-ci-reports
31
+ /app/views/layouts/test.html.erb
32
+ /.framgia-ci-reports/*
33
+ .framgia-ci-result.temp.yml
34
+ /config/rails_best_practices.yml
@@ -0,0 +1,548 @@
1
+ # This is rubocop configuration file for Framgia's coding style. Enabling and disabling is configured
2
+ # in separate files. This file adds all other parameters apart from Enabled.
3
+
4
+ # Put the following files into the same directory as this file.
5
+ inherit_from:
6
+ - .rubocop_enabled.yml
7
+ - .rubocop_disabled.yml
8
+
9
+ # Common configuration.
10
+ Rails:
11
+ Enabled: true
12
+
13
+ Metrics/BlockLength:
14
+ Exclude:
15
+ - Rakefile
16
+ - spec/**/**/*.rb
17
+
18
+ AllCops:
19
+ TargetRubyVersion: 2.2
20
+ Exclude:
21
+ - db/schema.rb
22
+ - lib/tasks/**/*.rake
23
+ - test/**
24
+ - config/initializers/**
25
+ - config/environments/**
26
+ - db/migrate/**
27
+ - spec/controllers/**
28
+ - spec/**
29
+ - app/models/**
30
+ # Indent private/protected/public as deep as method definitions
31
+ Layout/AccessModifierIndentation:
32
+ EnforcedStyle: indent
33
+ SupportedStyles:
34
+ - outdent
35
+ - indent
36
+
37
+ # Align the elements of a hash literal if they span more than one line.
38
+ Layout/AlignHash:
39
+ # Alignment of entries using hash rocket as separator. Valid values are:
40
+ #
41
+ # key - left alignment of keys
42
+ # 'a' => 2
43
+ # 'bb' => 3
44
+ # separator - alignment of hash rockets, keys are right aligned
45
+ # 'a' => 2
46
+ # 'bb' => 3
47
+ # table - left alignment of keys, hash rockets, and values
48
+ # 'a' => 2
49
+ # 'bb' => 3
50
+ EnforcedHashRocketStyle: key
51
+ # Alignment of entries using colon as separator. Valid values are:
52
+ #
53
+ # key - left alignment of keys
54
+ # a: 0
55
+ # bb: 1
56
+ # separator - alignment of colons, keys are right aligned
57
+ # a: 0
58
+ # bb: 1
59
+ # table - left alignment of keys and values
60
+ # a: 0
61
+ # bb: 1
62
+ EnforcedColonStyle: key
63
+ # Select whether hashes that are the last argument in a method call should be
64
+ # inspected? Valid values are:
65
+ #
66
+ # always_inspect - Inspect both implicit and explicit hashes.
67
+ # Registers an offense for:
68
+ # function(a: 1,
69
+ # b: 2)
70
+ # Registers an offense for:
71
+ # function({a: 1,
72
+ # b: 2})
73
+ # always_ignore - Ignore both implicit and explicit hashes.
74
+ # Accepts:
75
+ # function(a: 1,
76
+ # b: 2)
77
+ # Accepts:
78
+ # function({a: 1,
79
+ # b: 2})
80
+ # ignore_implicit - Ignore only implicit hashes.
81
+ # Accepts:
82
+ # function(a: 1,
83
+ # b: 2)
84
+ # Registers an offense for:
85
+ # function({a: 1,
86
+ # b: 2})
87
+ # ignore_explicit - Ignore only explicit hashes.
88
+ # Accepts:
89
+ # function({a: 1,
90
+ # b: 2})
91
+ # Registers an offense for:
92
+ # function(a: 1,
93
+ # b: 2)
94
+ EnforcedLastArgumentHashStyle: ignore_implicit
95
+ SupportedLastArgumentHashStyles:
96
+ - always_inspect
97
+ - always_ignore
98
+ - ignore_implicit
99
+ - ignore_explicit
100
+
101
+ Layout/AlignParameters:
102
+ # Alignment of parameters in multi-line method calls.
103
+ #
104
+ # The `with_first_parameter` style aligns the following lines along the same column
105
+ # as the first parameter.
106
+ #
107
+ # method_call(a,
108
+ # b)
109
+ #
110
+ # The `with_fixed_indentation` style aligns the following lines with one
111
+ # level of indentation relative to the start of the line with the method call.
112
+ #
113
+ # method_call(a,
114
+ # b)
115
+ EnforcedStyle: with_fixed_indentation
116
+ SupportedStyles:
117
+ - with_first_parameter
118
+ - with_fixed_indentation
119
+
120
+ Metrics/BlockNesting:
121
+ Max: 3
122
+
123
+ Style/BracesAroundHashParameters:
124
+ EnforcedStyle: no_braces
125
+ SupportedStyles:
126
+ - braces
127
+ - no_braces
128
+
129
+ # Indentation of `when`.
130
+ Layout/CaseIndentation:
131
+ EnforcedStyle: case
132
+ SupportedStyles:
133
+ - case
134
+ - end
135
+ IndentOneStep: false
136
+
137
+ Style/ClassAndModuleChildren:
138
+ # Checks the style of children definitions at classes and modules.
139
+ #
140
+ # Basically there are two different styles:
141
+ #
142
+ # `nested` - have each child on a separate line
143
+ # class Foo
144
+ # class Bar
145
+ # end
146
+ # end
147
+ #
148
+ # `compact` - combine definitions as much as possible
149
+ # class Foo::Bar
150
+ # end
151
+ #
152
+ # The compact style is only forced, for classes / modules with one child.
153
+ EnforcedStyle: nested
154
+ SupportedStyles:
155
+ - nested
156
+ - compact
157
+
158
+ Style/ClassCheck:
159
+ EnforcedStyle: is_a?
160
+ SupportedStyles:
161
+ - is_a?
162
+ - kind_of?
163
+
164
+ Metrics/ClassLength:
165
+ CountComments: false # count full line comments?
166
+ Max: 100
167
+
168
+ # Align with the style guide.
169
+ Style/CollectionMethods:
170
+ # Mapping from undesired method to desired_method
171
+ # e.g. to use `detect` over `find`:
172
+ #
173
+ # CollectionMethods:
174
+ # PreferredMethods:
175
+ # find: detect
176
+ PreferredMethods:
177
+ collect: 'map'
178
+ collect!: 'map!'
179
+ inject: 'reduce'
180
+ detect: 'find'
181
+ find_all: 'select'
182
+
183
+ # Checks formatting of special comments
184
+ Style/CommentAnnotation:
185
+ Keywords:
186
+ - TODO
187
+ - FIXME
188
+ - OPTIMIZE
189
+ - HACK
190
+ - REVIEW
191
+
192
+ # Avoid complex methods.
193
+ Metrics/CyclomaticComplexity:
194
+ Max: 6
195
+
196
+ # Multi-line method chaining should be done with leading dots.
197
+ Layout/DotPosition:
198
+ EnforcedStyle: leading
199
+ SupportedStyles:
200
+ - leading
201
+ - trailing
202
+
203
+ # Use empty lines between defs.
204
+ Layout/EmptyLineBetweenDefs:
205
+ # If true, this parameter means that single line method definitions don't
206
+ # need an empty line between them.
207
+ AllowAdjacentOneLineDefs: false
208
+
209
+ Layout/EmptyLinesAroundBlockBody:
210
+ EnforcedStyle: no_empty_lines
211
+ SupportedStyles:
212
+ - no_empty_lines
213
+
214
+ Layout/EmptyLinesAroundClassBody:
215
+ EnforcedStyle: no_empty_lines
216
+ SupportedStyles:
217
+ - no_empty_lines
218
+
219
+ Layout/EmptyLinesAroundModuleBody:
220
+ EnforcedStyle: no_empty_lines
221
+ SupportedStyles:
222
+ - no_empty_lines
223
+
224
+ # Checks whether the source file has a utf-8 encoding comment or not
225
+ Style/Encoding:
226
+ EnforcedStyle: when_needed
227
+ SupportedStyles:
228
+ - when_needed
229
+ - always
230
+
231
+ Style/FileName:
232
+ Exclude:
233
+ - '**/Rakefile'
234
+ - '**/Gemfile'
235
+ - '**/Capfile'
236
+
237
+ # Checks use of for or each in multiline loops.
238
+ Style/For:
239
+ EnforcedStyle: each
240
+ SupportedStyles:
241
+ - for
242
+ - each
243
+
244
+ # Enforce the method used for string formatting.
245
+ Style/FormatString:
246
+ EnforcedStyle: format
247
+ SupportedStyles:
248
+ - format
249
+ - sprintf
250
+ - percent
251
+
252
+ # Built-in global variables are allowed by default.
253
+ Style/GlobalVars:
254
+ AllowedVariables: []
255
+
256
+ # `MinBodyLength` defines the number of lines of the a body of an if / unless
257
+ # needs to have to trigger this cop
258
+ Style/GuardClause:
259
+ MinBodyLength: 1
260
+
261
+ Style/HashSyntax:
262
+ EnforcedStyle: ruby19
263
+ SupportedStyles:
264
+ - ruby19
265
+ - hash_rockets
266
+
267
+ Style/IfUnlessModifier:
268
+ MaxLineLength: 80
269
+
270
+ # Checks the indentation of the first key in a hash literal.
271
+ Layout/IndentHash:
272
+ # The value `special_inside_parentheses` means that hash literals with braces
273
+ # that have their opening brace on the same line as a surrounding opening
274
+ # round parenthesis, shall have their first key indented relative to the
275
+ # first position inside the parenthesis.
276
+ # The value `consistent` means that the indentation of the first key shall
277
+ # always be relative to the first position of the line where the opening
278
+ # brace is.
279
+ EnforcedStyle: special_inside_parentheses
280
+ SupportedStyles:
281
+ - special_inside_parentheses
282
+ - consistent
283
+
284
+ Style/LambdaCall:
285
+ EnforcedStyle: call
286
+ SupportedStyles:
287
+ - call
288
+ - braces
289
+
290
+ Metrics/LineLength:
291
+ Max: 80
292
+ AllowURI: true
293
+ Exclude:
294
+ - config/routes.rb
295
+
296
+
297
+ Style/Next:
298
+ # With `always` all conditions at the end of an iteration needs to be
299
+ # replace by next - with `skip_modifier_ifs` the modifier if like this one
300
+ # are ignored: [1, 2].each { |a| return 'yes' if a == 1 }
301
+ EnforcedStyle: skip_modifier_ifs
302
+ SupportedStyles:
303
+ - skip_modifier_ifs
304
+ - always
305
+
306
+ Style/NonNilCheck:
307
+ # With `IncludeSemanticChanges` set to `true`, this cop reports offenses for
308
+ # `!x.nil?` and autocorrects that and `x != nil` to solely `x`, which is
309
+ # **usually** OK, but might change behavior.
310
+ #
311
+ # With `IncludeSemanticChanges` set to `false`, this cop does not report
312
+ # offenses for `!x.nil?` and does no changes that might change behavior.
313
+ IncludeSemanticChanges: false
314
+
315
+ Style/MethodDefParentheses:
316
+ EnforcedStyle: require_no_parentheses
317
+ SupportedStyles:
318
+ - require_parentheses
319
+ - require_no_parentheses
320
+
321
+ Metrics/MethodLength:
322
+ CountComments: false # count full line comments?
323
+ Max: 10
324
+
325
+ Metrics/BlockLength:
326
+ CountComments: false # count full line comments?
327
+ Max: 25
328
+ Exclude:
329
+ - config/**/*.rb
330
+
331
+ Style/MethodName:
332
+ EnforcedStyle: snake_case
333
+ SupportedStyles:
334
+ - snake_case
335
+ - camelCase
336
+
337
+ Style/NumericLiterals:
338
+ MinDigits: 5
339
+
340
+ Metrics/ParameterLists:
341
+ Max: 5
342
+ CountKeywordArgs: true
343
+
344
+ # Allow safe assignment in conditions.
345
+ Style/ParenthesesAroundCondition:
346
+ AllowSafeAssignment: true
347
+
348
+ Style/PercentLiteralDelimiters:
349
+ PreferredDelimiters:
350
+ '%': ()
351
+ '%i': ()
352
+ '%q': ()
353
+ '%Q': ()
354
+ '%r': '{}'
355
+ '%s': ()
356
+ '%w': ()
357
+ '%W': ()
358
+ '%x': ()
359
+
360
+ Style/PredicateName:
361
+ NamePrefixBlacklist:
362
+ - get_
363
+
364
+ Style/RaiseArgs:
365
+ EnforcedStyle: exploded
366
+ SupportedStyles:
367
+ - compact # raise Exception.new(msg)
368
+ - exploded # raise Exception, msg
369
+
370
+
371
+ Style/RedundantReturn:
372
+ # When true allows code like `return x, y`.
373
+ AllowMultipleReturnValues: false
374
+
375
+ Style/Semicolon:
376
+ # Allow ; to separate several expressions on the same line.
377
+ AllowAsExpressionSeparator: false
378
+
379
+ Style/SignalException:
380
+ EnforcedStyle: only_raise
381
+ SupportedStyles:
382
+ - only_raise
383
+ - only_fail
384
+ - semantic
385
+
386
+
387
+ Style/SingleLineBlockParams:
388
+ Methods:
389
+ - reduce:
390
+ - a
391
+ - e
392
+ - inject:
393
+ - a
394
+ - e
395
+
396
+ Style/SingleLineMethods:
397
+ AllowIfMethodIsEmpty: true
398
+
399
+ Style/StringLiterals:
400
+ EnforcedStyle: double_quotes
401
+ SupportedStyles:
402
+ - single_quotes
403
+ - double_quotes
404
+
405
+ Layout/SpaceAroundEqualsInParameterDefault:
406
+ EnforcedStyle: space
407
+ SupportedStyles:
408
+ - space
409
+ - no_space
410
+
411
+ Layout/SpaceBeforeBlockBraces:
412
+ EnforcedStyle: no_space
413
+ SupportedStyles:
414
+ - space
415
+ - no_space
416
+
417
+ Layout/SpaceInsideBlockBraces:
418
+ EnforcedStyle: no_space
419
+ SupportedStyles:
420
+ - space
421
+ - no_space
422
+ # Valid values are: space, no_space
423
+ EnforcedStyleForEmptyBraces: no_space
424
+ # Space between { and |. Overrides EnforcedStyle if there is a conflict.
425
+ SpaceBeforeBlockParameters: false
426
+
427
+ Layout/SpaceInsideHashLiteralBraces:
428
+ EnforcedStyle: no_space
429
+ EnforcedStyleForEmptyBraces: no_space
430
+ SupportedStyles:
431
+ - space
432
+ - no_space
433
+
434
+ Layout/TrailingBlankLines:
435
+ EnforcedStyle: final_newline
436
+ SupportedStyles:
437
+ - final_newline
438
+ - final_blank_line
439
+
440
+ Style/TrailingCommaInLiteral:
441
+ # If EnforcedStyleForMultiline is comma, the cop allows a comma after the
442
+ # last item of a list, but only for lists where each item is on its own line.
443
+ EnforcedStyleForMultiline: no_comma
444
+ SupportedStyles:
445
+ - comma
446
+ - no_comma
447
+
448
+ # TrivialAccessors doesn't require exact name matches and doesn't allow
449
+ # predicated methods by default.
450
+ Style/TrivialAccessors:
451
+ ExactNameMatch: false
452
+ AllowPredicates: false
453
+ # Allows trivial writers that don't end in an equal sign. e.g.
454
+ #
455
+ # def on_exception(action)
456
+ # @on_exception=action
457
+ # end
458
+ # on_exception :restart
459
+ #
460
+ # Commonly used in DSLs
461
+ AllowDSLWriters: false
462
+ Whitelist:
463
+ - to_ary
464
+ - to_a
465
+ - to_c
466
+ - to_enum
467
+ - to_h
468
+ - to_hash
469
+ - to_i
470
+ - to_int
471
+ - to_io
472
+ - to_open
473
+ - to_path
474
+ - to_proc
475
+ - to_r
476
+ - to_regexp
477
+ - to_str
478
+ - to_s
479
+ - to_sym
480
+
481
+ Style/VariableName:
482
+ EnforcedStyle: snake_case
483
+ SupportedStyles:
484
+ - snake_case
485
+ - camelCase
486
+
487
+ Style/WhileUntilModifier:
488
+ MaxLineLength: 80
489
+
490
+ Style/WordArray:
491
+ MinSize: 0
492
+
493
+ ##################### Lint ##################################
494
+
495
+ # Allow safe assignment in conditions.
496
+ Lint/AssignmentInCondition:
497
+ AllowSafeAssignment: true
498
+
499
+ # Align ends correctly.
500
+ Lint/EndAlignment:
501
+ # The value `keyword` means that `end` should be aligned with the matching
502
+ # keyword (if, while, etc.).
503
+ # The value `variable` means that in assignments, `end` should be aligned
504
+ # with the start of the variable on the left hand side of `=`. In all other
505
+ # situations, `end` should still be aligned with the keyword.
506
+ EnforcedStyleAlignWith: keyword
507
+ SupportedStyles:
508
+ - keyword
509
+ - variable
510
+
511
+ Lint/DefEndAlignment:
512
+ # The value `def` means that `end` should be aligned with the def keyword.
513
+ # The value `start_of_line` means that `end` should be aligned with method
514
+ # calls like `private`, `public`, etc, if present in front of the `def`
515
+ # keyword on the same line.
516
+ EnforcedStyleAlignWith: start_of_line
517
+ SupportedStyles:
518
+ - start_of_line
519
+ - def
520
+
521
+ ##################### Rails ##################################
522
+
523
+ Rails/ActionFilter:
524
+ EnforcedStyle: action
525
+ SupportedStyles:
526
+ - action
527
+ - filter
528
+ Include:
529
+ - app/controllers/**/*.rb
530
+
531
+ Rails/HasAndBelongsToMany:
532
+ Include:
533
+ - app/models/**/*.rb
534
+
535
+ Rails/ReadWriteAttribute:
536
+ Include:
537
+ - app/models/**/*.rb
538
+
539
+ Rails/ScopeArgs:
540
+ Include:
541
+ - app/models/**/*.rb
542
+
543
+ Rails/Validation:
544
+ Include:
545
+ - app/models/**/*.rb
546
+
547
+ Layout/MultilineMethodCallIndentation:
548
+ EnforcedStyle: indented