Showing 181 of 209 total issues
Method update_average_build_time
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def update_average_build_time
if status_changed?
self.started_at = Time.now if status == self.class::BUILD_STARTED
if [self.class::BUILD_ERROR,
self.class::SUCCESS,
- 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 abf_worker_args
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def abf_worker_args
repos = include_repos
include_repos_hash = {}.tap do |h|
Repository.where(id: (repos | (extra_repositories || [])) ).each do |repo|
path, prefix = repo.platform.public_downloads_url(
- 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 create
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def create
unless pull_params
redirect :back
end
to_project = find_destination_project
- 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 render_issues_list
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def render_issues_list
@issues = @issues.preload(:user, :assignee, :labels, :project).without_pull_requests
if params[:status] == 'closed'
@issues = @issues.closed
else
- 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 read_and_write
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
def read_and_write(input, stdin, stdout, stderr, timeout=nil, max=nil)
max = nil if max && max <= 0
@out, @err = '', ''
offset = 0
File diff_helper.rb
has 253 lines of code (exceeds 250 allowed). Consider refactoring. Open
module DiffHelper
include CommitHelper
MAX_LINES_WITHOUT_COLLAPSE = 50
Method shift
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
def shift
$redis.with do |r|
job_shift_sem = Redis::Semaphore.new(:job_shift_lock, redis: r)
job_shift_sem.lock do
shifted_build_lists = r.smembers('abf_worker:shifted_build_lists')
Method new_comment_notifications
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
def new_comment_notifications
return if automatic?
if issue_comment?
commentable.subscribes.each do |subscribe|
Method perform
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
def perform
return if subject.valid? && restart_task
if options['feedback_from_user']
user = User.find options['feedback_from_user']
return if !user.system? && subject.builder != user
Method render_pulls_list
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def render_pulls_list
@pulls = @pulls.includes(issue: [:user, :assignee])
if params[:status] == 'closed'
@pulls = @pulls.closed_or_merged
else
- 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 show
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def show
unless request.xhr?
render('empty') and return if @project.is_empty?
@tree = @tree / @path if @path.present?
@commit = @branch.present? ? @branch.commit() : @project.repo.log(@treeish, @path, max_count: 1).first
- 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 default_encoding!
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def default_encoding!
default_encoding = Encoding.default_internal || Encoding::UTF_8
if ascii_only? # no need to encode if ascii
force_encoding(default_encoding)
else # should encode
- 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 init_variables
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
def init_variables
case params[:range]
when RANGE_TWENTY_FOUR_HOURS
@range_end = Time.now.utc
@range_start = @range_end - 1.day
Method index
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
def index
params[:kind] = params[:kind] == 'pull_requests' ? 'pull_requests' : 'issues'
raise Pundit::NotAuthorizedError if !@project.has_issues? && params[:kind] == 'issues'
params[:filter] = params[:filter].in?(['created', 'assigned']) ? params[:filter] : 'all'
Function Typeahead
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
var Typeahead = function(element, options) {
//deal with scrollBar
var defaultOptions=$.fn.typeahead.defaults;
if(options.scrollBar){
Method perform
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.perform(build_list_id, user_id, project_ids, arch_ids, options)
build_list = BuildList.find(build_list_id)
return if build_list.save_to_platform.personal?
user = User.find(user_id)
Method show_fail_reason
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def show_fail_reason
respond_to do |format|
format.html {
@build_lists = @mass_build.build_lists.where(status: BuildList::BUILD_ERROR).page(params[:page])
data = @build_lists.pluck(:id, :project_id, :arch_id, :fail_reason)
Method build_list
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def build_list
return @build_list if !!@build_list
return nil if @path !~ /\/(release|updates)+\/[\w\-\.\+]+$/
return nil unless repository_name = @path.match(/\/[\w]+\/(release|updates)\//)
repository_name = repository_name[0].gsub(/\/(release|updates)\/$/, '').gsub('/', '')
- 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 perform
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def perform
return if status == STARTED # do nothing when publication started
extra = options['extra']
repository_status = RepositoryStatus.where(id: extra['repository_status_id']).first
begin
Method parse_projects_platforms
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.parse_projects_platforms(advisory, pr)
pr ||= {}
if !pr.is_a?(Hash)
advisory.errors.add(:base, "Projects is not a hash")
return {}