Showing 44 of 58 total issues
Function parse
has a Cognitive Complexity of 93 (exceeds 5 allowed). Consider refactoring. Open
def parse(input_filename, output_filename, drop_index_filename):
"Feed it a file, and it'll output a fixed one"
# State storage
if input_filename == "-":
- 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
Class Converter
has 65 methods (exceeds 20 allowed). Consider refactoring. Open
class Converter
def on_0(s) reset() end
def on_1(s) enable(STYLE_SWITCHES[:bold]) end
def on_3(s) enable(STYLE_SWITCHES[:italic]) end
def on_4(s) enable(STYLE_SWITCHES[:underline]) end
Class Commit
has 35 methods (exceeds 20 allowed). Consider refactoring. Open
class Commit < ActiveRecord::Base
belongs_to :project
has_many :builds, dependent: :destroy
has_many :trigger_requests, dependent: :destroy
Class Build
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
class Build < ActiveRecord::Base
LAZY_ATTRIBUTES = ['trace']
belongs_to :commit
belongs_to :project
Class Project
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class Project < ActiveRecord::Base
include ProjectStatus
has_many :commits, ->() { order('CASE WHEN commits.committed_at IS NULL THEN 0 ELSE 1 END', :committed_at, :id) }, dependent: :destroy
has_many :builds, through: :commits, dependent: :destroy
Method nav_link
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def nav_link(options = {}, &block)
if path = options.delete(:path)
if path.respond_to?(:each)
c = path.map { |p| p.split('#').first }
a = path.map { |p| p.split('#').last }
- 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 validate_job!
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def validate_job!(name, job)
job.keys.each do |key|
unless ALLOWED_JOB_KEYS.include? key
raise ValidationError, "#{name}: unknown parameter #{key}"
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 remove_old
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def remove_old
# delete backups
$progress.print "Deleting old backups ... "
keep_time = GitlabCi.config.backup.keep_time.to_i
- 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 process?
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def process?(only_params, except_params, ref, tag)
return true if only_params.nil? && except_params.nil?
if only_params
return true if tag && only_params.include?("tags")
- 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 handle_sequence
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def handle_sequence(s)
indicator = s[1]
commands = s[2].split ';'
terminator = s[3]
- 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 <=>
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def <=>(other)
return unless other.is_a? VersionInfo
return unless valid? && other.valid?
if other.major < @major
- 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 execute
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def execute(project, params)
before_sha = params[:before]
sha = params[:checkout_sha] || params[:after]
origin_ref = params[:ref]
Function parse
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse(input_filename, output_filename, drop_index_filename):
"Feed it a file, and it'll output a fixed one"
# State storage
if input_filename == "-":
Method unpack
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def unpack
Dir.chdir(GitlabCi.config.backup.path)
# check for existing backups in the backup dir
file_list = Dir.glob("*_gitlab_ci_backup.tar").each.map { |f| f.split(/_/).first.to_i }
- 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 validate!
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def validate!
unless validate_array_of_strings(@before_script)
raise ValidationError, "before_script should be an array of strings"
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 validate_job!
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def validate_job!(name, job)
job.keys.each do |key|
unless ALLOWED_JOB_KEYS.include? key
raise ValidationError, "#{name}: unknown parameter #{key}"
end
Method unpack
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def unpack
Dir.chdir(GitlabCi.config.backup.path)
# check for existing backups in the backup dir
file_list = Dir.glob("*_gitlab_ci_backup.tar").each.map { |f| f.split(/_/).first.to_i }
Method convert_to_postgresql
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def convert_to_postgresql
mysql_dump_gz = db_file_name + '.mysql'
psql_dump_gz = db_file_name + '.psql'
drop_indexes_sql = File.join(db_dir, 'drop_indexes.sql')
Method attachments
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def attachments
fields = []
if commit.matrix?
commit.builds_without_retry.each do |build|
- 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 authenticate_public_page!
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def authenticate_public_page!
unless project.public
unless current_user
redirect_to(new_user_sessions_path(state: generate_oauth_state(request.fullpath))) and return
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"