Method has too many lines. [39/30] Open
def issue_detail_template
%{<%= bold(issue.key) + ' in ' + issue.project.name %>
<%= bold(issue.summary) %>
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Method issue_detail_template
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def issue_detail_template
%{<%= bold(issue.key) + ' in ' + issue.project.name %>
<%= bold(issue.summary) %>
Method colorize_priority
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def colorize_priority(priority, opts = {})
return '' unless priority.respond_to? :name
name = priority.name
infos = if name =~ /high|major|critic/i
[:red, '⬆']
- 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 colorize_issue_stastus
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def colorize_issue_stastus(status)
category = status.statusCategory['name'] rescue nil
category ||= status.name
title = "#{status.name}"
- 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 issue_estimate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def issue_estimate(issue)
field = Client::Field.story_points
story_points = issue.try(field.key) if field.respond_to? :key
return ['Story Points', story_points] if story_points
- 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
Prefer to_s
over string interpolation. Open
title = "#{status.name}"
- Read upRead up
- Exclude checks
This cop checks for strings that are just an interpolated expression.
Example:
# bad
"#{@var}"
# good
@var.to_s
# good if @var is already a String
@var
Line is too long. [149/100] Open
Sprint: <%= colorize_sprint_state(issue.try(:sprint).try(:state)) %> <%= issue.try(:sprint).try(:id) %>. <%= issue.try(:sprint).try(:name) %>
- Exclude checks
Line is too long. [105/100] Open
* <%= bold(subtask.key) %> <%= colorize_issue_stastus(subtask.status) %> <%= subtask.summary %>
- Exclude checks
Prefer single-quoted strings when you don't need string interpolation or special symbols. Open
"""
- Read upRead up
- Exclude checks
Checks if uses of quotes match the configured preference.
Example: EnforcedStyle: single_quotes (default)
# bad
"No special symbols"
"No string interpolation"
"Just text"
# good
'No special symbols'
'No string interpolation'
'Just text'
"Wait! What's #{this}!"
Example: EnforcedStyle: double_quotes
# bad
'Just some text'
'No special chars or interpolation'
# good
"Just some text"
"No special chars or interpolation"
"Every string in #{project} uses double_quotes"
Line is too long. [177/100] Open
Type: <%= colorize_issue_type(issue.issuetype) %>\s\sStatus: <%= colorize_issue_stastus(issue.status) %>\s\sPriority: <%= colorize_priority(issue.priority, title: true) %>
- Exclude checks
Parenthesize the param rows.split("\n").map { |r| [r] }
to make sure that the block will be associated with the rows.split("\n").map
method call. Open
table = TTY::Table.new nil, rows.split("\n").map { |r| [r] }
- Read upRead up
- Exclude checks
This cop checks for ambiguous block association with method when param passed without parentheses.
Example:
# bad
some_method a { |val| puts val }
Example:
# good
# With parentheses, there's no ambiguity.
some_method(a) { |val| puts val }
# good
# Operator methods require no disambiguation
foo == bar { |b| b.baz }
# good
# Lambda arguments require no disambiguation
foo = ->(bar) { bar.baz }
Line is too long. [114/100] Open
* <%= bold(epic_issue.key) %> <%= colorize_issue_stastus(epic_issue.status) %> <%= epic_issue.summary %>
- Exclude checks
Prefer single-quoted strings when you don't need string interpolation or special symbols. Open
"""
- Read upRead up
- Exclude checks
Checks if uses of quotes match the configured preference.
Example: EnforcedStyle: single_quotes (default)
# bad
"No special symbols"
"No string interpolation"
"Just text"
# good
'No special symbols'
'No string interpolation'
'Just text'
"Wait! What's #{this}!"
Example: EnforcedStyle: double_quotes
# bad
'Just some text'
'No special chars or interpolation'
# good
"Just some text"
"No special chars or interpolation"
"Every string in #{project} uses double_quotes"