diff --git a/.rubocop.yml b/.rubocop.yml index 6500f653..74f9706b 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -122,6 +122,10 @@ Style/TrailingBlankLines: Style/TrailingWhitespace: Enabled: true +# Checks for uses of double negation (!!) to convert something to a boolean value. +Style/DoubleNegation: + Enabled: true + AllCops: Include: - '**/Rakefile' diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index da6d3bb2..72d3fb23 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -246,11 +246,6 @@ Style/Documentation: Style/DotPosition: Enabled: false -# Offense count: 5 -Style/DoubleNegation: - Exclude: - - 'app/models/conference.rb' - # Offense count: 1 # Cop supports --auto-correct. Style/ElseAlignment: diff --git a/app/models/conference.rb b/app/models/conference.rb index 0f586b57..fbb225ff 100644 --- a/app/models/conference.rb +++ b/app/models/conference.rb @@ -838,7 +838,7 @@ class Conference < ActiveRecord::Base # * +True+ -> If conference has a venue object. # * +False+ -> IF conference has no venue object. def venue_set? - !!venue + venue.present? end ## @@ -848,7 +848,7 @@ class Conference < ActiveRecord::Base # * +True+ -> If conference has a cfp object. # * +False+ -> If conference has no cfp object. def cfp_set? - !!program.cfp + program.cfp.present? end ## @@ -858,7 +858,7 @@ class Conference < ActiveRecord::Base # * +True+ -> If conference has a start and a end date. # * +False+ -> If conference has no start or end date. def registration_date_set? - !!registration_period && !!registration_period.start_date && !!registration_period.end_date + registration_period.present? && registration_period.start_date.present? && registration_period.end_date.present? end # Calculates the distribution from events.