Showing 32 of 32 total issues
Method valid_emoji?
has 113 lines of code (exceeds 25 allowed). Consider refactoring. Open
def valid_emoji?(emoji)
@emoji ||= %w(+1 -1 100 109 1234 8ball abcd abc ab accept aerial_tramway airplane alarm_clock
alien ambulance anchor angel anger angry ant a apple aquarius aries
arrow_backward arrow_double_down arrow_double_up arrow_down arrow_down_small
arrow_forward arrow_heading_down arrow_heading_up arrow_left arrow_lower_left
Class MergeRequest
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
class MergeRequest < ApplicationRecord
belongs_to :author, class_name: 'User'
belongs_to :reviewer, class_name: 'User'
belongs_to :project
Function exports
has 66 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')
Method start_reading_interdiff_file_metadata
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def start_reading_interdiff_file_metadata(line)
new_file_line = line =~ /^(diff -u|---|\+\+\+)/
interdiff_tag = line =~ /^(reverted|unchanged|only in patch2|only in patch1)/
return false if !new_file_line && !interdiff_tag
- 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 path_diff
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def path_diff(from, to)
old_parts = from.split('/')
new_parts = to.split('/')
output = []
old_changed = []
- 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
File diff.rb
has 262 lines of code (exceeds 250 allowed). Consider refactoring. Open
class Diff
# Source can be :git or :interdiff
def initialize(diff, source: :git)
@raw = diff
@files = {}
Method change
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
def change
create_table(:users) do |t|
## Database authenticatable
t.string :name, null: false
t.string :email, null: false, default: ''
Method decode
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def self.decode(data)
data = data.bytes if data.is_a?(String)
it = data.each
len = it.peek
# A..Z
- 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 projects_mr_chart_data
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
def projects_mr_chart_data(project)
period = 20
first_day = period.days.ago
mrs = project.merge_requests.group('DATE(created_at)').where('created_at > ?', first_day).count
Method add_comments
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def add_comments(author, patch, comments, blockers)
return if comments.nil?
blockers ||= {}
- 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 projects_merge_request_chart
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def projects_merge_request_chart(project, role, title)
query = project.merge_requests.joins(role).accepted.limit(100)
.select('users.name')
.order('merge_requests.created_at DESC').to_sql
db = ActiveRecord::Base.connection
Function show_comment_box
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
function show_comment_box(event) {
var tr = $(event.target).parents('tr')[0];
event.preventDefault();
if ($(tr).next().hasClass('comments')) {
Method path_diff
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def path_diff(from, to)
old_parts = from.split('/')
new_parts = to.split('/')
output = []
old_changed = []
Method run
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def run
check_dirty_working_copy!
patches = options[:mr].map { |mr| api.merge_request(mr) }
- 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 update
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def update
@patch = merge_request.patches.find_by(id: params[:patch_id]) or raise 'Invalid patch'
@mr.solve_issues_by_location(current_user, @patch, params[:solved].keys) if params[:solved].present?
@mr.add_comments(current_user, @patch, params[:comments], params[:blockers])
- 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 run
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def run
return show_help if ARGV == ['--help']
return show_version if ARGV == ['--version']
# Due to a bad decision in the past this entire gem modifies the ARGV
- 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
Function handle_history_radios
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function handle_history_radios(radio) {
var name = radio.name;
var value = radio.value;
var disableTo = null;
- 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 decode
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.decode(data)
data = data.bytes if data.is_a?(String)
it = data.each
len = it.peek
# A..Z
Function show_comment_box
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function show_comment_box(event) {
var tr = $(event.target).parents('tr')[0];
event.preventDefault();
if ($(tr).next().hasClass('comments')) {
- 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 start_reading_interdiff_file_metadata
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def start_reading_interdiff_file_metadata(line)
new_file_line = line =~ /^(diff -u|---|\+\+\+)/
interdiff_tag = line =~ /^(reverted|unchanged|only in patch2|only in patch1)/
return false if !new_file_line && !interdiff_tag