lib/rubocop/cop/cop.rb in rubocop-0.21.0 vs lib/rubocop/cop/cop.rb in rubocop-0.22.0
- old
+ new
@@ -187,17 +187,17 @@
self.class.lint? ? :warning : :convention
end
def custom_severity
severity = cop_config && cop_config['Severity']
- if severity
- if Severity::NAMES.include?(severity.to_sym)
- severity.to_sym
- else
- warn "Warning: Invalid severity '#{severity}'. " +
- "Valid severities are #{Severity::NAMES.join(', ')}."
- .color(:red)
- end
+ return unless severity
+
+ if Severity::NAMES.include?(severity.to_sym)
+ severity.to_sym
+ else
+ warn "Warning: Invalid severity '#{severity}'. " +
+ "Valid severities are #{Severity::NAMES.join(', ')}."
+ .color(:red)
end
end
end
end
end