sabat-rubocop 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +50 -0
- data/.rspec +1 -0
- data/.rubocop.yml +7 -0
- data/.travis.yml +7 -0
- data/.yardopts +2 -0
- data/CHANGELOG.md +268 -0
- data/CONTRIBUTING.md +16 -0
- data/Gemfile +7 -0
- data/LICENSE.txt +20 -0
- data/README.md +324 -0
- data/Rakefile +29 -0
- data/bin/rubocop +22 -0
- data/config/default.yml +58 -0
- data/config/disabled.yml +5 -0
- data/config/enabled.yml +403 -0
- data/lib/rubocop.rb +116 -0
- data/lib/rubocop/cli.rb +407 -0
- data/lib/rubocop/config.rb +250 -0
- data/lib/rubocop/config_store.rb +39 -0
- data/lib/rubocop/cop/cop.rb +138 -0
- data/lib/rubocop/cop/lint/assignment_in_condition.rb +54 -0
- data/lib/rubocop/cop/lint/end_alignment.rb +189 -0
- data/lib/rubocop/cop/lint/end_in_method.rb +30 -0
- data/lib/rubocop/cop/lint/ensure_return.rb +22 -0
- data/lib/rubocop/cop/lint/eval.rb +22 -0
- data/lib/rubocop/cop/lint/handle_exceptions.rb +20 -0
- data/lib/rubocop/cop/lint/literal_in_condition.rb +81 -0
- data/lib/rubocop/cop/lint/loop.rb +29 -0
- data/lib/rubocop/cop/lint/rescue_exception.rb +29 -0
- data/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +34 -0
- data/lib/rubocop/cop/lint/unreachable_code.rb +35 -0
- data/lib/rubocop/cop/lint/unused_local_variable.rb +32 -0
- data/lib/rubocop/cop/lint/void.rb +58 -0
- data/lib/rubocop/cop/offence.rb +136 -0
- data/lib/rubocop/cop/rails/validation.rb +30 -0
- data/lib/rubocop/cop/style/access_control.rb +58 -0
- data/lib/rubocop/cop/style/alias.rb +28 -0
- data/lib/rubocop/cop/style/align_parameters.rb +39 -0
- data/lib/rubocop/cop/style/and_or.rb +45 -0
- data/lib/rubocop/cop/style/ascii_comments.rb +21 -0
- data/lib/rubocop/cop/style/ascii_identifiers.rb +22 -0
- data/lib/rubocop/cop/style/attr.rb +20 -0
- data/lib/rubocop/cop/style/avoid_class_vars.rb +20 -0
- data/lib/rubocop/cop/style/avoid_for.rb +18 -0
- data/lib/rubocop/cop/style/avoid_global_vars.rb +65 -0
- data/lib/rubocop/cop/style/avoid_perl_backrefs.rb +21 -0
- data/lib/rubocop/cop/style/avoid_perlisms.rb +50 -0
- data/lib/rubocop/cop/style/begin_block.rb +18 -0
- data/lib/rubocop/cop/style/block_comments.rb +20 -0
- data/lib/rubocop/cop/style/block_nesting.rb +47 -0
- data/lib/rubocop/cop/style/blocks.rb +27 -0
- data/lib/rubocop/cop/style/case_equality.rb +22 -0
- data/lib/rubocop/cop/style/case_indentation.rb +28 -0
- data/lib/rubocop/cop/style/character_literal.rb +37 -0
- data/lib/rubocop/cop/style/class_and_module_camel_case.rb +33 -0
- data/lib/rubocop/cop/style/class_methods.rb +22 -0
- data/lib/rubocop/cop/style/collection_methods.rb +56 -0
- data/lib/rubocop/cop/style/colon_method_call.rb +29 -0
- data/lib/rubocop/cop/style/constant_name.rb +31 -0
- data/lib/rubocop/cop/style/def_parentheses.rb +70 -0
- data/lib/rubocop/cop/style/documentation.rb +58 -0
- data/lib/rubocop/cop/style/dot_position.rb +25 -0
- data/lib/rubocop/cop/style/empty_line_between_defs.rb +26 -0
- data/lib/rubocop/cop/style/empty_lines.rb +40 -0
- data/lib/rubocop/cop/style/empty_literal.rb +53 -0
- data/lib/rubocop/cop/style/encoding.rb +29 -0
- data/lib/rubocop/cop/style/end_block.rb +18 -0
- data/lib/rubocop/cop/style/end_of_line.rb +23 -0
- data/lib/rubocop/cop/style/favor_join.rb +29 -0
- data/lib/rubocop/cop/style/favor_modifier.rb +118 -0
- data/lib/rubocop/cop/style/favor_sprintf.rb +28 -0
- data/lib/rubocop/cop/style/favor_unless_over_negated_if.rb +54 -0
- data/lib/rubocop/cop/style/hash_syntax.rb +47 -0
- data/lib/rubocop/cop/style/if_then_else.rb +29 -0
- data/lib/rubocop/cop/style/if_with_semicolon.rb +20 -0
- data/lib/rubocop/cop/style/lambda.rb +47 -0
- data/lib/rubocop/cop/style/leading_comment_space.rb +25 -0
- data/lib/rubocop/cop/style/line_continuation.rb +26 -0
- data/lib/rubocop/cop/style/line_length.rb +30 -0
- data/lib/rubocop/cop/style/method_and_variable_snake_case.rb +61 -0
- data/lib/rubocop/cop/style/method_call_parentheses.rb +22 -0
- data/lib/rubocop/cop/style/method_length.rb +57 -0
- data/lib/rubocop/cop/style/multiline_if_then.rb +47 -0
- data/lib/rubocop/cop/style/not.rb +24 -0
- data/lib/rubocop/cop/style/numeric_literals.rb +25 -0
- data/lib/rubocop/cop/style/one_line_conditional.rb +20 -0
- data/lib/rubocop/cop/style/op_method.rb +29 -0
- data/lib/rubocop/cop/style/parameter_lists.rb +42 -0
- data/lib/rubocop/cop/style/parentheses_around_condition.rb +42 -0
- data/lib/rubocop/cop/style/proc.rb +30 -0
- data/lib/rubocop/cop/style/reduce_arguments.rb +34 -0
- data/lib/rubocop/cop/style/regexp_literal.rb +39 -0
- data/lib/rubocop/cop/style/rescue_modifier.rb +55 -0
- data/lib/rubocop/cop/style/semicolon.rb +51 -0
- data/lib/rubocop/cop/style/single_line_methods.rb +48 -0
- data/lib/rubocop/cop/style/space_after_comma_etc.rb +69 -0
- data/lib/rubocop/cop/style/space_after_control_keyword.rb +32 -0
- data/lib/rubocop/cop/style/string_literals.rb +36 -0
- data/lib/rubocop/cop/style/surrounding_space.rb +314 -0
- data/lib/rubocop/cop/style/symbol_array.rb +31 -0
- data/lib/rubocop/cop/style/symbol_name.rb +27 -0
- data/lib/rubocop/cop/style/tab.rb +25 -0
- data/lib/rubocop/cop/style/ternary_operator.rb +49 -0
- data/lib/rubocop/cop/style/trailing_whitespace.rb +24 -0
- data/lib/rubocop/cop/style/trivial_accessors.rb +32 -0
- data/lib/rubocop/cop/style/unless_else.rb +26 -0
- data/lib/rubocop/cop/style/variable_interpolation.rb +32 -0
- data/lib/rubocop/cop/style/when_then.rb +25 -0
- data/lib/rubocop/cop/style/while_until_do.rb +45 -0
- data/lib/rubocop/cop/style/word_array.rb +44 -0
- data/lib/rubocop/cop/util.rb +27 -0
- data/lib/rubocop/cop/variable_inspector.rb +280 -0
- data/lib/rubocop/formatter/base_formatter.rb +119 -0
- data/lib/rubocop/formatter/clang_style_formatter.rb +21 -0
- data/lib/rubocop/formatter/emacs_style_formatter.rb +17 -0
- data/lib/rubocop/formatter/formatter_set.rb +77 -0
- data/lib/rubocop/formatter/json_formatter.rb +76 -0
- data/lib/rubocop/formatter/progress_formatter.rb +63 -0
- data/lib/rubocop/formatter/simple_text_formatter.rb +62 -0
- data/lib/rubocop/version.rb +21 -0
- data/rubocop.gemspec +36 -0
- data/spec/.rubocop.yml +5 -0
- data/spec/project_spec.rb +24 -0
- data/spec/rubocop/cli_spec.rb +906 -0
- data/spec/rubocop/config_spec.rb +470 -0
- data/spec/rubocop/config_store_spec.rb +66 -0
- data/spec/rubocop/cops/cop_spec.rb +38 -0
- data/spec/rubocop/cops/lint/assignment_in_condition_spec.rb +111 -0
- data/spec/rubocop/cops/lint/end_alignment_spec.rb +333 -0
- data/spec/rubocop/cops/lint/end_in_method_spec.rb +35 -0
- data/spec/rubocop/cops/lint/ensure_return_spec.rb +37 -0
- data/spec/rubocop/cops/lint/eval_spec.rb +41 -0
- data/spec/rubocop/cops/lint/handle_exceptions_spec.rb +36 -0
- data/spec/rubocop/cops/lint/literal_in_condition_spec.rb +42 -0
- data/spec/rubocop/cops/lint/loop_spec.rb +33 -0
- data/spec/rubocop/cops/lint/rescue_exception_spec.rb +127 -0
- data/spec/rubocop/cops/lint/shadowing_outer_local_variable_spec.rb +243 -0
- data/spec/rubocop/cops/lint/unreachable_code_spec.rb +69 -0
- data/spec/rubocop/cops/lint/unused_local_variable_spec.rb +497 -0
- data/spec/rubocop/cops/lint/void_spec.rb +63 -0
- data/spec/rubocop/cops/offence_spec.rb +133 -0
- data/spec/rubocop/cops/rails/validation_spec.rb +27 -0
- data/spec/rubocop/cops/style/access_control_spec.rb +142 -0
- data/spec/rubocop/cops/style/alias_spec.rb +47 -0
- data/spec/rubocop/cops/style/align_parameters_spec.rb +199 -0
- data/spec/rubocop/cops/style/and_or_spec.rb +39 -0
- data/spec/rubocop/cops/style/ascii_comments_spec.rb +28 -0
- data/spec/rubocop/cops/style/ascii_identifiers_spec.rb +28 -0
- data/spec/rubocop/cops/style/attr_spec.rb +20 -0
- data/spec/rubocop/cops/style/avoid_class_vars_spec.rb +27 -0
- data/spec/rubocop/cops/style/avoid_for_spec.rb +37 -0
- data/spec/rubocop/cops/style/avoid_global_vars_spec.rb +34 -0
- data/spec/rubocop/cops/style/avoid_perl_backrefs_spec.rb +20 -0
- data/spec/rubocop/cops/style/avoid_perlisms_spec.rb +47 -0
- data/spec/rubocop/cops/style/begin_block_spec.rb +19 -0
- data/spec/rubocop/cops/style/block_comments_spec.rb +27 -0
- data/spec/rubocop/cops/style/block_nesting_spec.rb +159 -0
- data/spec/rubocop/cops/style/blocks_spec.rb +35 -0
- data/spec/rubocop/cops/style/case_equality_spec.rb +18 -0
- data/spec/rubocop/cops/style/case_indentation_spec.rb +88 -0
- data/spec/rubocop/cops/style/character_literal_spec.rb +28 -0
- data/spec/rubocop/cops/style/class_and_module_camel_case_spec.rb +46 -0
- data/spec/rubocop/cops/style/class_methods_spec.rb +51 -0
- data/spec/rubocop/cops/style/collection_methods_spec.rb +41 -0
- data/spec/rubocop/cops/style/colon_method_call_spec.rb +55 -0
- data/spec/rubocop/cops/style/constant_name_spec.rb +56 -0
- data/spec/rubocop/cops/style/def_with_parentheses_spec.rb +40 -0
- data/spec/rubocop/cops/style/def_without_parentheses_spec.rb +34 -0
- data/spec/rubocop/cops/style/documentation_spec.rb +79 -0
- data/spec/rubocop/cops/style/dot_position_spec.rb +30 -0
- data/spec/rubocop/cops/style/empty_line_between_defs_spec.rb +85 -0
- data/spec/rubocop/cops/style/empty_lines_spec.rb +40 -0
- data/spec/rubocop/cops/style/empty_literal_spec.rb +91 -0
- data/spec/rubocop/cops/style/encoding_spec.rb +49 -0
- data/spec/rubocop/cops/style/end_block_spec.rb +19 -0
- data/spec/rubocop/cops/style/end_of_line_spec.rb +25 -0
- data/spec/rubocop/cops/style/favor_join_spec.rb +37 -0
- data/spec/rubocop/cops/style/favor_modifier_spec.rb +160 -0
- data/spec/rubocop/cops/style/favor_sprintf_spec.rb +53 -0
- data/spec/rubocop/cops/style/favor_unless_over_negated_if_spec.rb +64 -0
- data/spec/rubocop/cops/style/favor_until_over_negated_while_spec.rb +47 -0
- data/spec/rubocop/cops/style/hash_syntax_spec.rb +51 -0
- data/spec/rubocop/cops/style/if_with_semicolon_spec.rb +25 -0
- data/spec/rubocop/cops/style/lambda_spec.rb +45 -0
- data/spec/rubocop/cops/style/leading_comment_space_spec.rb +65 -0
- data/spec/rubocop/cops/style/line_continuation_spec.rb +26 -0
- data/spec/rubocop/cops/style/line_length_spec.rb +25 -0
- data/spec/rubocop/cops/style/method_and_variable_snake_case_spec.rb +95 -0
- data/spec/rubocop/cops/style/method_call_parentheses_spec.rb +25 -0
- data/spec/rubocop/cops/style/method_length_spec.rb +151 -0
- data/spec/rubocop/cops/style/multiline_if_then_spec.rb +97 -0
- data/spec/rubocop/cops/style/not_spec.rb +28 -0
- data/spec/rubocop/cops/style/numeric_literals_spec.rb +51 -0
- data/spec/rubocop/cops/style/one_line_conditional_spec.rb +18 -0
- data/spec/rubocop/cops/style/op_method_spec.rb +80 -0
- data/spec/rubocop/cops/style/parameter_lists_spec.rb +49 -0
- data/spec/rubocop/cops/style/parentheses_around_condition_spec.rb +59 -0
- data/spec/rubocop/cops/style/proc_spec.rb +28 -0
- data/spec/rubocop/cops/style/reduce_arguments_spec.rb +59 -0
- data/spec/rubocop/cops/style/regexp_literal_spec.rb +83 -0
- data/spec/rubocop/cops/style/rescue_modifier_spec.rb +122 -0
- data/spec/rubocop/cops/style/semicolon_spec.rb +95 -0
- data/spec/rubocop/cops/style/single_line_methods_spec.rb +54 -0
- data/spec/rubocop/cops/style/space_after_colon_spec.rb +29 -0
- data/spec/rubocop/cops/style/space_after_comma_spec.rb +31 -0
- data/spec/rubocop/cops/style/space_after_control_keyword_spec.rb +69 -0
- data/spec/rubocop/cops/style/space_after_semicolon_spec.rb +24 -0
- data/spec/rubocop/cops/style/space_around_braces_spec.rb +49 -0
- data/spec/rubocop/cops/style/space_around_equals_in_default_parameter_spec.rb +34 -0
- data/spec/rubocop/cops/style/space_around_operators_spec.rb +216 -0
- data/spec/rubocop/cops/style/space_inside_brackets_spec.rb +51 -0
- data/spec/rubocop/cops/style/space_inside_hash_literal_braces_spec.rb +99 -0
- data/spec/rubocop/cops/style/space_inside_parens_spec.rb +33 -0
- data/spec/rubocop/cops/style/string_literals_spec.rb +62 -0
- data/spec/rubocop/cops/style/symbol_array_spec.rb +45 -0
- data/spec/rubocop/cops/style/symbol_name_spec.rb +122 -0
- data/spec/rubocop/cops/style/tab_spec.rb +23 -0
- data/spec/rubocop/cops/style/ternary_operator_spec.rb +42 -0
- data/spec/rubocop/cops/style/trailing_whitespace_spec.rb +29 -0
- data/spec/rubocop/cops/style/trivial_accessors_spec.rb +338 -0
- data/spec/rubocop/cops/style/unless_else_spec.rb +31 -0
- data/spec/rubocop/cops/style/variable_interpolation_spec.rb +53 -0
- data/spec/rubocop/cops/style/when_then_spec.rb +40 -0
- data/spec/rubocop/cops/style/while_until_do_spec.rb +47 -0
- data/spec/rubocop/cops/style/word_array_spec.rb +61 -0
- data/spec/rubocop/cops/variable_inspector_spec.rb +374 -0
- data/spec/rubocop/formatter/base_formatter_spec.rb +190 -0
- data/spec/rubocop/formatter/clang_style_formatter_spec.rb +70 -0
- data/spec/rubocop/formatter/emacs_style_formatter_spec.rb +32 -0
- data/spec/rubocop/formatter/formatter_set_spec.rb +132 -0
- data/spec/rubocop/formatter/json_formatter_spec.rb +142 -0
- data/spec/rubocop/formatter/progress_formatter_spec.rb +196 -0
- data/spec/rubocop/formatter/simple_text_formatter_spec.rb +74 -0
- data/spec/spec_helper.rb +92 -0
- data/spec/support/file_helper.rb +21 -0
- data/spec/support/isolated_environment.rb +27 -0
- data/spec/support/mri_syntax_checker.rb +69 -0
- data/spec/support/shared_examples.rb +33 -0
- metadata +517 -0
data/Rakefile
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
require 'bundler/gem_tasks'
|
6
|
+
begin
|
7
|
+
Bundler.setup(:default, :development)
|
8
|
+
rescue Bundler::BundlerError => e
|
9
|
+
$stderr.puts e.message
|
10
|
+
$stderr.puts 'Run `bundle install` to install missing gems'
|
11
|
+
exit e.status_code
|
12
|
+
end
|
13
|
+
require 'rake'
|
14
|
+
require 'rspec/core'
|
15
|
+
require 'rspec/core/rake_task'
|
16
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
17
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
18
|
+
end
|
19
|
+
|
20
|
+
desc 'Run RSpec with code coverage'
|
21
|
+
task :coverage do
|
22
|
+
ENV['COVERAGE'] = 'true'
|
23
|
+
Rake::Task['spec'].execute
|
24
|
+
end
|
25
|
+
|
26
|
+
task default: :spec
|
27
|
+
|
28
|
+
require 'yard'
|
29
|
+
YARD::Rake::YardocTask.new
|
data/bin/rubocop
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
if RUBY_VERSION >= '1.9.2'
|
5
|
+
$LOAD_PATH.unshift(File.dirname(File.realpath(__FILE__)) + '/../lib')
|
6
|
+
|
7
|
+
require 'rubocop'
|
8
|
+
require 'benchmark'
|
9
|
+
|
10
|
+
cli = Rubocop::CLI.new
|
11
|
+
result = 0
|
12
|
+
|
13
|
+
time = Benchmark.realtime do
|
14
|
+
result = cli.run
|
15
|
+
end
|
16
|
+
|
17
|
+
puts "Finished in #{time} seconds" if cli.options[:debug]
|
18
|
+
exit result
|
19
|
+
else
|
20
|
+
puts 'RuboCop supports only Ruby 1.9.2+'
|
21
|
+
exit(-1)
|
22
|
+
end
|
data/config/default.yml
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
# This is the default configuration file. Enabling and disabling is configured
|
2
|
+
# in separate files. This file adds all other parameters apart from Enabled.
|
3
|
+
|
4
|
+
inherit_from:
|
5
|
+
- enabled.yml
|
6
|
+
- disabled.yml
|
7
|
+
|
8
|
+
# Common configuration.
|
9
|
+
AllCops:
|
10
|
+
# Include gemspec and Rakefile
|
11
|
+
Includes:
|
12
|
+
- '**/*.gemspec'
|
13
|
+
- '**/Rakefile'
|
14
|
+
Excludes: []
|
15
|
+
|
16
|
+
# Limit lines to 79 characters.
|
17
|
+
LineLength:
|
18
|
+
Max: 79
|
19
|
+
|
20
|
+
# Avoid methods longer than 10 lines of code
|
21
|
+
MethodLength:
|
22
|
+
CountComments: false # count full line comments?
|
23
|
+
Max: 10
|
24
|
+
|
25
|
+
# Avoid parameter lists longer than five parameters.
|
26
|
+
ParameterLists:
|
27
|
+
Max: 5
|
28
|
+
CountKeywordArgs: true
|
29
|
+
|
30
|
+
# Don't use semicolons to terminate expressions.
|
31
|
+
Semicolon:
|
32
|
+
# For example; def area(height, width); height * width end
|
33
|
+
AllowAfterParameterListInOneLineMethods: false
|
34
|
+
# For example; def area(height, width) height * width; end
|
35
|
+
AllowBeforeEndInOneLineMethods: true
|
36
|
+
|
37
|
+
# Avoid single-line methods.
|
38
|
+
SingleLineMethods:
|
39
|
+
AllowIfMethodIsEmpty: true
|
40
|
+
|
41
|
+
# Use spaces inside hash literal braces - or don't.
|
42
|
+
SpaceInsideHashLiteralBraces:
|
43
|
+
EnforcedStyleIsWithSpaces: true
|
44
|
+
|
45
|
+
# Symbol literals should use snake_case.
|
46
|
+
SymbolName:
|
47
|
+
AllowCamelCase: true
|
48
|
+
|
49
|
+
# Avoid more than `Max` levels of nesting.
|
50
|
+
BlockNesting:
|
51
|
+
Max: 3
|
52
|
+
|
53
|
+
# Use %r for regular expressions matching more than `MaxSlashes` '/'
|
54
|
+
# characters.
|
55
|
+
# Use %r only for regular expressions matching more than `MaxSlashes` '/'
|
56
|
+
# character.
|
57
|
+
RegexpLiteral:
|
58
|
+
MaxSlashes: 1
|
data/config/disabled.yml
ADDED
data/config/enabled.yml
ADDED
@@ -0,0 +1,403 @@
|
|
1
|
+
# These are all the cops that are enabled in the default configuration.
|
2
|
+
|
3
|
+
# Use UTF-8 as the source file encoding.
|
4
|
+
Encoding:
|
5
|
+
Enabled: true
|
6
|
+
|
7
|
+
# Limit lines to 80 characters.
|
8
|
+
LineLength:
|
9
|
+
Enabled: true
|
10
|
+
|
11
|
+
# Avoid methods longer than 10 lines of code
|
12
|
+
MethodLength:
|
13
|
+
Enabled: true
|
14
|
+
|
15
|
+
# No hard tabs.
|
16
|
+
Tab:
|
17
|
+
Enabled: true
|
18
|
+
|
19
|
+
# Avoid trailing whitespace.
|
20
|
+
TrailingWhitespace:
|
21
|
+
Enabled: true
|
22
|
+
|
23
|
+
# Indent when as deep as case.
|
24
|
+
CaseIndentation:
|
25
|
+
Enabled: true
|
26
|
+
|
27
|
+
# Use empty lines between defs.
|
28
|
+
EmptyLineBetweenDefs:
|
29
|
+
Enabled: true
|
30
|
+
|
31
|
+
# Don't use several empty lines in a row.
|
32
|
+
EmptyLines:
|
33
|
+
Enabled: true
|
34
|
+
|
35
|
+
# Use spaces around operators.
|
36
|
+
SpaceAroundOperators:
|
37
|
+
Enabled: true
|
38
|
+
|
39
|
+
# Use spaces around { and before }.
|
40
|
+
SpaceAroundBraces:
|
41
|
+
Enabled: true
|
42
|
+
|
43
|
+
# No spaces after ( or before ).
|
44
|
+
SpaceInsideParens:
|
45
|
+
Enabled: true
|
46
|
+
|
47
|
+
# No spaces after [ or before ].
|
48
|
+
SpaceInsideBrackets:
|
49
|
+
Enabled: true
|
50
|
+
|
51
|
+
# Use spaces after commas.
|
52
|
+
SpaceAfterComma:
|
53
|
+
Enabled: true
|
54
|
+
|
55
|
+
# Use spaces after semicolons.
|
56
|
+
SpaceAfterSemicolon:
|
57
|
+
Enabled: true
|
58
|
+
|
59
|
+
# Use spaces after colons.
|
60
|
+
SpaceAfterColon:
|
61
|
+
Enabled: true
|
62
|
+
|
63
|
+
# Use spaces after if/elsif/unless/while/until/case/when.
|
64
|
+
SpaceAfterControlKeyword:
|
65
|
+
Enabled: true
|
66
|
+
|
67
|
+
# Prefer symbols instead of strings as hash keys.
|
68
|
+
HashSyntax:
|
69
|
+
Enabled: true
|
70
|
+
|
71
|
+
# Use Unix-style line endings.
|
72
|
+
EndOfLine:
|
73
|
+
Enabled: true
|
74
|
+
|
75
|
+
# Add underscores to large numeric literals to improve their readability.
|
76
|
+
NumericLiterals:
|
77
|
+
Enabled: true
|
78
|
+
|
79
|
+
# Align the parameters of a method call if they span more than one line.
|
80
|
+
AlignParameters:
|
81
|
+
Enabled: true
|
82
|
+
|
83
|
+
# Use def with parentheses when there are arguments.
|
84
|
+
DefWithParentheses:
|
85
|
+
Enabled: true
|
86
|
+
|
87
|
+
# Omit the parentheses when the method doesn't accept any arguments.
|
88
|
+
DefWithoutParentheses:
|
89
|
+
Enabled: true
|
90
|
+
|
91
|
+
# Never use if x; .... Use the ternary operator instead.
|
92
|
+
IfWithSemicolon:
|
93
|
+
Enabled: true
|
94
|
+
|
95
|
+
# Never use then for multi-line if/unless.
|
96
|
+
MultilineIfThen:
|
97
|
+
Enabled: true
|
98
|
+
|
99
|
+
# Favor the ternary operator(?:) over if/then/else/end constructs.
|
100
|
+
OneLineConditional:
|
101
|
+
Enabled: true
|
102
|
+
|
103
|
+
# Avoid using {...} for multi-line blocks (multiline chaining is always ugly).
|
104
|
+
# Prefer {...} over do...end for single-line blocks.
|
105
|
+
Blocks:
|
106
|
+
Enabled: true
|
107
|
+
|
108
|
+
# Avoid parameter lists longer than three or four parameters.
|
109
|
+
ParameterLists:
|
110
|
+
Enabled: true
|
111
|
+
|
112
|
+
# Prefer ' strings when you don't need string interpolation or special symbols.
|
113
|
+
StringLiterals:
|
114
|
+
Enabled: true
|
115
|
+
|
116
|
+
# Avoid multi-line ?: (the ternary operator); use if/unless instead.
|
117
|
+
MultilineTernaryOperator:
|
118
|
+
Enabled: true
|
119
|
+
|
120
|
+
# Use one expression per branch in a ternary operator.
|
121
|
+
NestedTernaryOperator:
|
122
|
+
Enabled: true
|
123
|
+
|
124
|
+
# Never use unless with else. Rewrite these with the positive case first.
|
125
|
+
UnlessElse:
|
126
|
+
Enabled: true
|
127
|
+
|
128
|
+
# Use &&/|| instead of and/or.
|
129
|
+
AndOr:
|
130
|
+
Enabled: true
|
131
|
+
|
132
|
+
# Use when x then ... for one-line cases.
|
133
|
+
WhenThen:
|
134
|
+
Enabled: true
|
135
|
+
|
136
|
+
# Favor modifier if/unless usage when you have a single-line body.
|
137
|
+
IfUnlessModifier:
|
138
|
+
Enabled: true
|
139
|
+
|
140
|
+
# Favor modifier while/until usage when you have a single-line body.
|
141
|
+
WhileUntilModifier:
|
142
|
+
Enabled: true
|
143
|
+
|
144
|
+
# Favor unless over if for negative conditions (or control flow or).
|
145
|
+
FavorUnlessOverNegatedIf:
|
146
|
+
Enabled: true
|
147
|
+
|
148
|
+
# Favor until over while for negative conditions.
|
149
|
+
FavorUntilOverNegatedWhile:
|
150
|
+
Enabled: true
|
151
|
+
|
152
|
+
# Use spaces around the = operator when assigning default values in def params.
|
153
|
+
SpaceAroundEqualsInParameterDefault:
|
154
|
+
Enabled: true
|
155
|
+
|
156
|
+
# Use the new lambda literal syntax for single-line blocks.
|
157
|
+
Lambda:
|
158
|
+
Enabled: true
|
159
|
+
|
160
|
+
# Use proc instead of Proc.new.
|
161
|
+
Proc:
|
162
|
+
Enabled: true
|
163
|
+
|
164
|
+
# Don't use parentheses around the condition of an if/unless/while.
|
165
|
+
ParenthesesAroundCondition:
|
166
|
+
Enabled: true
|
167
|
+
|
168
|
+
# Use snake_case for symbols, methods and variables.
|
169
|
+
MethodAndVariableSnakeCase:
|
170
|
+
Enabled: true
|
171
|
+
|
172
|
+
# Use CamelCase for classes and modules.
|
173
|
+
ClassAndModuleCamelCase:
|
174
|
+
Enabled: true
|
175
|
+
|
176
|
+
# Preferred collection methods.
|
177
|
+
CollectionMethods:
|
178
|
+
Enabled: true
|
179
|
+
|
180
|
+
# Prefer each over for.
|
181
|
+
AvoidFor:
|
182
|
+
Enabled: true
|
183
|
+
|
184
|
+
# Avoid Perl-style global variables.
|
185
|
+
AvoidPerlisms:
|
186
|
+
Enabled: true
|
187
|
+
|
188
|
+
# Avoid Perl-style regex back references.
|
189
|
+
AvoidPerlBackrefs:
|
190
|
+
Enabled: true
|
191
|
+
|
192
|
+
# Avoid the use of class variables.
|
193
|
+
AvoidClassVars:
|
194
|
+
Enabled: true
|
195
|
+
|
196
|
+
# Don't interpolate global, instance and class variables directly in strings.
|
197
|
+
VariableInterpolation:
|
198
|
+
Enabled: true
|
199
|
+
|
200
|
+
# Don't use semicolons to terminate expressions.
|
201
|
+
Semicolon:
|
202
|
+
Enabled: true
|
203
|
+
|
204
|
+
# Use sprintf instead of String#%.
|
205
|
+
FavorSprintf:
|
206
|
+
Enabled: true
|
207
|
+
|
208
|
+
# Use Array#join instead of Array#*.
|
209
|
+
FavorJoin:
|
210
|
+
Enabled: true
|
211
|
+
|
212
|
+
# Use alias_method instead of alias.
|
213
|
+
Alias:
|
214
|
+
Enabled: true
|
215
|
+
|
216
|
+
# Use ! instead of not.
|
217
|
+
Not:
|
218
|
+
Enabled: true
|
219
|
+
|
220
|
+
# Avoid using rescue in its modifier form.
|
221
|
+
RescueModifier:
|
222
|
+
Enabled: true
|
223
|
+
|
224
|
+
# Never use return in an ensure block.
|
225
|
+
EnsureReturn:
|
226
|
+
Enabled: true
|
227
|
+
|
228
|
+
# Don't suppress exception.
|
229
|
+
HandleExceptions:
|
230
|
+
Enabled: true
|
231
|
+
|
232
|
+
# Use only ascii symbols in identifiers.
|
233
|
+
AsciiIdentifiers:
|
234
|
+
Enabled: true
|
235
|
+
|
236
|
+
# Use only ascii symbols in comments.
|
237
|
+
AsciiComments:
|
238
|
+
Enabled: true
|
239
|
+
|
240
|
+
# Do not use block comments.
|
241
|
+
BlockComments:
|
242
|
+
Enabled: true
|
243
|
+
|
244
|
+
# Avoid rescuing the Exception class.
|
245
|
+
RescueException:
|
246
|
+
Enabled: true
|
247
|
+
|
248
|
+
# Prefer literals to Array.new/Hash.new/String.new.
|
249
|
+
EmptyLiteral:
|
250
|
+
Enabled: true
|
251
|
+
|
252
|
+
# When defining binary operators, name the argument other.
|
253
|
+
OpMethod:
|
254
|
+
Enabled: true
|
255
|
+
|
256
|
+
# Name reduce arguments |a, e| (accumulator, element)
|
257
|
+
ReduceArguments:
|
258
|
+
Enabled: true
|
259
|
+
|
260
|
+
# Use %r for regular expressions matching more than `MaxSlashes` '/'
|
261
|
+
# characters.
|
262
|
+
# Use %r only for regular expressions matching more than `MaxSlashes` '/'
|
263
|
+
# character.
|
264
|
+
RegexpLiteral:
|
265
|
+
Enabled: true
|
266
|
+
|
267
|
+
# Use self when defining module/class methods.
|
268
|
+
ClassMethods:
|
269
|
+
Enabled: true
|
270
|
+
|
271
|
+
# Avoid single-line methods.
|
272
|
+
SingleLineMethods:
|
273
|
+
Enabled: true
|
274
|
+
|
275
|
+
# Use %w or %W for arrays of words.
|
276
|
+
WordArray:
|
277
|
+
Enabled: true
|
278
|
+
|
279
|
+
# Use spaces inside hash literal braces - or don't.
|
280
|
+
SpaceInsideHashLiteralBraces:
|
281
|
+
Enabled: true
|
282
|
+
|
283
|
+
# Avoid the use of line continuation (/).
|
284
|
+
LineContinuation:
|
285
|
+
Enabled: true
|
286
|
+
|
287
|
+
# Prefer attr_* methods to trivial readers/writers.
|
288
|
+
TrivialAccessors:
|
289
|
+
Enabled: true
|
290
|
+
|
291
|
+
# Comments should start with a space.
|
292
|
+
LeadingCommentSpace:
|
293
|
+
Enabled: true
|
294
|
+
|
295
|
+
# Do not use :: for method call.
|
296
|
+
ColonMethodCall:
|
297
|
+
Enabled: true
|
298
|
+
|
299
|
+
# Do not introduce global variables.
|
300
|
+
AvoidGlobalVars:
|
301
|
+
Enabled: true
|
302
|
+
|
303
|
+
# The use of eval represents a serious security risk.
|
304
|
+
Eval:
|
305
|
+
Enabled: true
|
306
|
+
|
307
|
+
# Symbol literals should use snake_case.
|
308
|
+
SymbolName:
|
309
|
+
Enabled: true
|
310
|
+
|
311
|
+
# Constants should use SCREAMING_SNAKE_CASE.
|
312
|
+
ConstantName:
|
313
|
+
Enabled: true
|
314
|
+
|
315
|
+
# Indent private/protected as deep as defs and keep blank lines around them.
|
316
|
+
AccessControl:
|
317
|
+
Enabled: true
|
318
|
+
|
319
|
+
# Use Kernel#loop with break rather than begin/end/until or begin/end/while for post-loop tests.
|
320
|
+
Loop:
|
321
|
+
Enabled: true
|
322
|
+
|
323
|
+
# Avoid excessive block nesting
|
324
|
+
BlockNesting:
|
325
|
+
Enabled: true
|
326
|
+
|
327
|
+
# Avoid explicit use of the case equality operator(===).
|
328
|
+
CaseEquality:
|
329
|
+
Enabled: true
|
330
|
+
|
331
|
+
# Document classes and non-namespace modules.
|
332
|
+
Documentation:
|
333
|
+
Enabled: true
|
334
|
+
|
335
|
+
# Do not use parentheses for method calls with no arguments.
|
336
|
+
MethodCallParentheses:
|
337
|
+
Enabled: true
|
338
|
+
|
339
|
+
# Checks for redundant do after while or until.
|
340
|
+
WhileUntilDo:
|
341
|
+
Enabled: true
|
342
|
+
|
343
|
+
# Checks for uses of character literals.
|
344
|
+
CharacterLiteral:
|
345
|
+
Enabled: true
|
346
|
+
|
347
|
+
# Avoid the use of BEGIN blocks.
|
348
|
+
BeginBlock:
|
349
|
+
Enabled: true
|
350
|
+
|
351
|
+
# Avoid the use of END blocks.
|
352
|
+
EndBlock:
|
353
|
+
Enabled: true
|
354
|
+
|
355
|
+
## Warnings
|
356
|
+
|
357
|
+
# Don't use assignment in conditions.
|
358
|
+
AssignmentInCondition:
|
359
|
+
Enabled: true
|
360
|
+
AllowSafeAssignment: true
|
361
|
+
|
362
|
+
# Align ends correctly.
|
363
|
+
EndAlignment:
|
364
|
+
Enabled: true
|
365
|
+
|
366
|
+
# Possible use of operator/literal/variable in void context.
|
367
|
+
Void:
|
368
|
+
Enabled: true
|
369
|
+
|
370
|
+
# Unreachable code.
|
371
|
+
UnreachableCode:
|
372
|
+
Enabled: true
|
373
|
+
|
374
|
+
# Unused local variable.
|
375
|
+
UnusedLocalVariable:
|
376
|
+
Enabled: true
|
377
|
+
|
378
|
+
# Do not use the same name as outer local variable
|
379
|
+
# for block arguments or block local variables.
|
380
|
+
ShadowingOuterLocalVariable:
|
381
|
+
Enabled: true
|
382
|
+
|
383
|
+
# END blocks should not be placed inside method definitions.
|
384
|
+
EndInMethod:
|
385
|
+
Enabled: true
|
386
|
+
|
387
|
+
# Checks of literals used in conditions.
|
388
|
+
LiteralInCondition:
|
389
|
+
Enabled: true
|
390
|
+
|
391
|
+
# Checks the position of the dot in multi-line method calls.
|
392
|
+
DotPosition:
|
393
|
+
Enabled: true
|
394
|
+
|
395
|
+
# Checks for uses of Module#attr.
|
396
|
+
Attr:
|
397
|
+
Enabled: true
|
398
|
+
|
399
|
+
## Rails
|
400
|
+
|
401
|
+
# Use sexy validations.
|
402
|
+
Validation:
|
403
|
+
Enabled: true
|