Showing 52 of 52 total issues
Method new
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def new
repository = Grit::Repo.new(params[:repository_path])
diff = repository.diff(
repository.commit(params[:rev_to]), repository.commit(params[:rev]), params[:path]
- 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 tab
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def tab(tab_key)
@content = @tabs_data[tab_key]
content_tag :div, id: "tabs-#{@index}-#{@tab_index}" do
html = if tab_key == 'Request'
- 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 row
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def row
content = content_tag :td, class: 'first' do
check_box_tag "data[]", "#{object[:class].name};#{object['id']}", false, id: "#{object[:class].name.tableize}-#{object['id']}"
end
- 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_by_action?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def group_by_action?
group_by_action = false
@body.each do |line|
if line.match('Processing by') && line.match('#') && line.match(' as ') && line.split(' ').length == 5
- 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
Avoid too many return
statements within this method. Open
parse_request(line) and return
Avoid too many return
statements within this method. Open
parse_write(line) and return
Avoid too many return
statements within this method. Open
parse_read(line) and return
Avoid too many return
statements within this method. Open
return if @action.blank?
Avoid too many return
statements within this method. Open
parse_action(line) and return
Method try_two_times
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def try_two_times(message = '')
tries ||= 1
logger.info "#{Time.now.strftime('%H:%M:%S')} #{message} (try ##{tries})"
- 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 parse_read
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def parse_read(line)
reg_exp_begin = '\[([0-9]+)m( {2}|)(SELECT.+)'
#[1m[36mCommunity Load (0.5ms)[0m [1mSELECT `communities`.* FROM `communities` WHERE `communities`.`id` = 2 LIMIT 1[0m
reg_exp1 = "#{reg_exp_begin}(\\[)"
- 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 request_tab
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def request_tab
clean_params = request.filtered_parameters.clone
clean_params.delete("action")
clean_params.delete("controller")
- 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"