Skip to content

Commit

Permalink
Exempt entire files from Style/AccessorGrouping
Browse files Browse the repository at this point in the history
because disabling the cop for elected lines creates a
Style/EmptyLinesAroundAttributeAccessor offense.
See rubocop/rubocop#10693
  • Loading branch information
JoeCohen committed Jun 5, 2022
1 parent 290bb9a commit 11376a7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
10 changes: 10 additions & 0 deletions .rubocop.yml
Expand Up @@ -223,6 +223,16 @@ Rails/WhereExists:
# Enable with default EnforcedStyle: grouped; saves lines in some classes
Style/AccessorGrouping:
Enabled: true
# Exclude files that individually comment accessors
# else Rubocop concatenates the accessors and comments on a single line.
# Disabling Style/AccessorGrouping around the accessors doesn't
# work in this context because Rubocop v1.30.0 generates a
# Style/EmptyLinesAroundAttributeAccessor offense
# See https://github.com/rubocop/rubocop/issues/10693
Exclude:
- "app/classes/country_counter.rb"
- "app/classes/gmaps.rb"


# (0.88) pending cop
Style/ArrayCoercion:
Expand Down
3 changes: 0 additions & 3 deletions app/classes/country_counter.rb
Expand Up @@ -8,12 +8,9 @@
################################################################################

class CountryCounter
# Disable cop to allow comments on each accessor in a separate line
# rubocop:disable Style/AccessorGrouping
attr_accessor :known_by_count # known countries with observations
attr_accessor :unknown_by_count # known countries without observations
attr_accessor :missing # other locations with observations
# rubocop:enable Style/AccessorGrouping

def initialize
@counts = {}
Expand Down
13 changes: 2 additions & 11 deletions app/classes/gmaps.rb
Expand Up @@ -103,8 +103,6 @@ def self.header(args)
</script>".html_safe
end

# Disable cop to allow comments on each accessor in a separate line
# rubocop:disable Style/AccessorGrouping
attr_accessor :name # name of map div & global variable for Map object
attr_accessor :lat # center & zoom \
attr_accessor :long # | option one for positioning map
Expand All @@ -116,7 +114,6 @@ def self.header(args)
attr_accessor :large # is this a "large" map? (versus "small")
attr_accessor :events # array of [overlay_obj, event_type, javascript]
attr_accessor :overlays # array of markers and polylines to overlay on map
# rubocop:enable Style/AccessorGrouping

def initialize(name)
self.name = name
Expand Down Expand Up @@ -251,16 +248,13 @@ def events_code

# represent a GoogleMaps marker object, e.g., a balloon-pin
class GMarker
# Disable cop to allow comments on each accessor in a separate line
# rubocop:disable Style/AccessorGrouping
attr_accessor :var # name of global variable to assign it to if any
attr_accessor :lat # latitude
attr_accessor :long # longitude
attr_accessor :title # roll-over text
attr_accessor :draggable # is this draggable?
attr_accessor :info_window # content of "info window" to pop up
# if user clicks on marker
# rubocop:enable Style/AccessorGrouping
# content of "info window" to pop up if user clicks on marker
attr_accessor :info_window

def initialize(lat_long, opts)
self.var = nil
Expand Down Expand Up @@ -295,14 +289,11 @@ def create_and_initialize_code

# represent a GoogleMaps Polyline object, e.g., a rectangle
class GPolyline
# Disable cop to allow comments on each accessor in a separate line
# rubocop:disable Style/AccessorGrouping
attr_accessor :var # name of global variable to assign it to if any
attr_accessor :points # array of [lat, long]
attr_accessor :color # css-format color string
attr_accessor :weight # width of line in pixels
attr_accessor :opacity # from 0.0 to 1.0
# rubocop:enable Style/AccessorGrouping

def initialize(points, color, weight, opacity)
self.var = nil
Expand Down

0 comments on commit 11376a7

Please sign in to comment.