Showing 10 of 18 total issues
Function exports
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(api) {
var validEnv = ['development', 'test', 'production']
var currentEnv = api.env()
var isDevelopmentEnv = api.env('development')
var isProductionEnv = api.env('production')
Class TipService
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class Image::TipService < Base::ImageService
option :fragments
option :tips
WIDTH = 500
Method add_body
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
def add_body(comp) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
draw = Magick::Draw.new
draw.font = FONT_FILE
draw.gravity = Magick::NorthWestGravity
Class Help
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class Commands::Help < Commands::Base
def call
ChatResponse.new(mode: :private, text: send("#{team.platform}_text"))
end
Method add_body_text
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
def add_body_text(comp)
body_width = WIDTH - 100
body_height = 57
text_width = body_width + 1
text_height = body_height + 1
Method add_body_text
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def add_body_text(comp)
body_width = WIDTH - 100
body_height = 57
text_width = body_width + 1
text_height = body_height + 1
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method add_from_or_channel_text
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def add_from_or_channel_text(comp)
# Channel
if config[:show_channel]
channel_name = "#{CHAN_PREFIX}#{first_tip.from_channel_name}"
Method base_text
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def base_text # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
ary = [stats_title]
ary << rank_fragment
ary << level_fragment if team.enable_levels?
ary << points_received_fragment
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method add_body
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def add_body(comp) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
draw = Magick::Draw.new
draw.font = FONT_FILE
draw.gravity = Magick::NorthWestGravity
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method group_label
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def group_label(tip)
return 'Everyone' if tip.to_everyone
if (chan = tip.to_channel_name).present?
str = "##{chan}"
return tip.to_here? ? "#{str} [here]" : str
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"