Skip to content

Instantly share code, notes, and snippets.

@thash
Last active August 29, 2015 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thash/1230d1e4a9e9158b41cf to your computer and use it in GitHub Desktop.
Save thash/1230d1e4a9e9158b41cf to your computer and use it in GitHub Desktop.
Style/SpaceAroundOperators:
Enabled: false
Style/BlockDelimiters:
Enabled: false
inherit_from:
- .rubocop_todo.yml
# This configuration was generated by `rubocop --auto-gen-config`
# on 2015-07-24 12:18:10 +0900 using RuboCop version 0.32.1.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.
# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, ProceduralMethods, FunctionalMethods, IgnoredMethods.
Style/BlockDelimiters:
Enabled: false
# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: MultiSpaceAllowedForOperators.
Style/SpaceAroundOperators:
Enabled: false
$ bundle exec rubocop --auto-gen-config
Inspecting 1 file
C
Offenses:
first.rb:1:21: C: Prefer {...} over do...end for single-line blocks.
[1, 2, 3, 4, 5].map do |i| puts i ** i end
^^
first.rb:1:35: C: Space around operator ** detected.
[1, 2, 3, 4, 5].map do |i| puts i ** i end
^^
1 file inspected, 2 offenses detected
Created .rubocop_todo.yml.
Run `rubocop --config .rubocop_todo.yml`, or
add inherit_from: .rubocop_todo.yml in a .rubocop.yml file.
$ cat first.rb
[1, 2, 3, 4, 5].map do |i| puts i ** i end
$ cat > .rubocop.yml
Style/SpaceAroundOperators:
Enabled: false
Style/BlockDelimiters:
Enabled: false
^C
$ bundle exec rubocop first.rb
Inspecting 1 file
.
1 file inspected, no offenses detected
first.rb:1:21: C: Prefer {...} over do...end for single-line blocks.
[1, 2, 3, 4, 5].map do |i| puts i ** i end
^^
first.rb:1:35: C: Space around operator ** detected.
[1, 2, 3, 4, 5].map do |i| puts i ** i end
^^
[1, 2, 3, 4, 5].map do |i| puts i ** i end
$ ruby first.rb
1
4
27
256
3125
$ bundle exec rubocop first.rb
Inspecting 1 file
C
Offenses:
first.rb:1:21: C: Prefer {...} over do...end for single-line blocks.
[1, 2, 3, 4, 5].map do |i| puts i ** i end
^^
first.rb:1:35: C: Space around operator ** detected.
[1, 2, 3, 4, 5].map do |i| puts i ** i end
^^
1 file inspected, 2 offenses detected
[1, 2, 3, 4, 5].map { |i| puts i**i }
$ bundle exec rubocop first_fixed.rb
Inspecting 1 file
.
1 file inspected, no offenses detected
source 'https://rubygems.org'
gem 'rubocop'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment