rubocop 1.3.1 → 1.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/config/default.yml +67 -11
  4. data/lib/rubocop.rb +5 -0
  5. data/lib/rubocop/cli.rb +5 -1
  6. data/lib/rubocop/cli/command/execute_runner.rb +26 -11
  7. data/lib/rubocop/cli/command/suggest_extensions.rb +80 -0
  8. data/lib/rubocop/config_loader.rb +1 -1
  9. data/lib/rubocop/config_loader_resolver.rb +5 -1
  10. data/lib/rubocop/config_obsoletion.rb +21 -3
  11. data/lib/rubocop/config_regeneration.rb +1 -1
  12. data/lib/rubocop/config_validator.rb +8 -1
  13. data/lib/rubocop/cop/autocorrect_logic.rb +21 -6
  14. data/lib/rubocop/cop/correctors/percent_literal_corrector.rb +1 -1
  15. data/lib/rubocop/cop/generator.rb +1 -1
  16. data/lib/rubocop/cop/internal_affairs/useless_message_assertion.rb +1 -1
  17. data/lib/rubocop/cop/layout/empty_line_between_defs.rb +80 -10
  18. data/lib/rubocop/cop/layout/empty_lines_around_arguments.rb +6 -1
  19. data/lib/rubocop/cop/layout/end_of_line.rb +5 -5
  20. data/lib/rubocop/cop/layout/first_argument_indentation.rb +7 -2
  21. data/lib/rubocop/cop/layout/space_around_method_call_operator.rb +1 -1
  22. data/lib/rubocop/cop/lint/ambiguous_regexp_literal.rb +2 -1
  23. data/lib/rubocop/cop/lint/interpolation_check.rb +7 -2
  24. data/lib/rubocop/cop/lint/literal_in_interpolation.rb +1 -1
  25. data/lib/rubocop/cop/lint/missing_super.rb +7 -4
  26. data/lib/rubocop/cop/lint/no_return_in_begin_end_blocks.rb +1 -1
  27. data/lib/rubocop/cop/lint/unexpected_block_arity.rb +85 -0
  28. data/lib/rubocop/cop/lint/unmodified_reduce_accumulator.rb +20 -6
  29. data/lib/rubocop/cop/metrics/abc_size.rb +25 -1
  30. data/lib/rubocop/cop/metrics/block_length.rb +13 -7
  31. data/lib/rubocop/cop/metrics/method_length.rb +7 -2
  32. data/lib/rubocop/cop/metrics/parameter_lists.rb +64 -1
  33. data/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb +20 -10
  34. data/lib/rubocop/cop/metrics/utils/repeated_attribute_discount.rb +146 -0
  35. data/lib/rubocop/cop/metrics/utils/repeated_csend_discount.rb +6 -1
  36. data/lib/rubocop/cop/mixin/configurable_numbering.rb +3 -2
  37. data/lib/rubocop/cop/mixin/enforce_superclass.rb +9 -1
  38. data/lib/rubocop/cop/mixin/ignored_methods.rb +36 -3
  39. data/lib/rubocop/cop/mixin/method_complexity.rb +6 -0
  40. data/lib/rubocop/cop/mixin/multiline_expression_indentation.rb +1 -1
  41. data/lib/rubocop/cop/mixin/visibility_help.rb +1 -3
  42. data/lib/rubocop/cop/naming/variable_number.rb +3 -1
  43. data/lib/rubocop/cop/style/and_or.rb +10 -0
  44. data/lib/rubocop/cop/style/class_and_module_children.rb +8 -3
  45. data/lib/rubocop/cop/style/documentation.rb +12 -1
  46. data/lib/rubocop/cop/style/format_string.rb +8 -3
  47. data/lib/rubocop/cop/style/if_with_semicolon.rb +39 -4
  48. data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +2 -2
  49. data/lib/rubocop/cop/style/method_call_without_args_parentheses.rb +11 -2
  50. data/lib/rubocop/cop/style/numeric_literals.rb +14 -11
  51. data/lib/rubocop/cop/style/redundant_argument.rb +75 -0
  52. data/lib/rubocop/cop/style/redundant_condition.rb +2 -1
  53. data/lib/rubocop/cop/style/redundant_regexp_escape.rb +1 -1
  54. data/lib/rubocop/cop/style/sole_nested_conditional.rb +49 -3
  55. data/lib/rubocop/cop/style/symbol_proc.rb +5 -3
  56. data/lib/rubocop/cop/util.rb +1 -1
  57. data/lib/rubocop/cop/variable_force/branch.rb +1 -1
  58. data/lib/rubocop/cop/variable_force/scope.rb +1 -1
  59. data/lib/rubocop/core_ext/hash.rb +20 -0
  60. data/lib/rubocop/ext/regexp_node.rb +5 -10
  61. data/lib/rubocop/ext/regexp_parser.rb +2 -9
  62. data/lib/rubocop/formatter/disabled_config_formatter.rb +21 -6
  63. data/lib/rubocop/options.rb +5 -0
  64. data/lib/rubocop/rake_task.rb +2 -2
  65. data/lib/rubocop/runner.rb +1 -1
  66. data/lib/rubocop/version.rb +1 -1
  67. metadata +12 -10
  68. data/bin/console +0 -10
  69. data/bin/rubocop-profile +0 -32
  70. data/bin/setup +0 -7
@@ -1,32 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- if ARGV.include?('-h') || ARGV.include?('--help')
5
- puts "Usage: same as main `rubocop` command but gathers profiling info"
6
- puts "Additional option: `--memory` to print memory usage"
7
- exit(0)
8
- end
9
- with_mem = ARGV.delete('--memory')
10
- ARGV.unshift '--cache', 'false' unless ARGV.include?('--cache')
11
-
12
- require 'stackprof'
13
- if with_mem
14
- require 'memory_profiler'
15
- MemoryProfiler.start
16
- end
17
- StackProf.start
18
- start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
19
- begin
20
- load "#{__dir__}/../exe/rubocop"
21
- ensure
22
- delta = Process.clock_gettime(Process::CLOCK_MONOTONIC) - start
23
- puts "Finished in #{delta.round(1)} seconds"
24
- StackProf.stop
25
- if with_mem
26
- puts "Building memory report..."
27
- report = MemoryProfiler.stop
28
- end
29
- Dir.mkdir('tmp') unless File.exist?('tmp')
30
- StackProf.results('tmp/stackprof.dump')
31
- report&.pretty_print(scale_bytes: true)
32
- end
data/bin/setup DELETED
@@ -1,7 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- set -euo pipefail
4
- IFS=$'\n\t'
5
- set -vx
6
-
7
- bundle install