Showing 11 of 145 total issues
Method validate_params_4
has 326 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.validate_params_4
{
check_allowed_transport_modes: 0,
check_lines_in_groups: 0,
check_line_routes: 0,
File parameters_service.rb
has 550 lines of code (exceeds 250 allowed). Consider refactoring. Open
class ParametersService
def initialize(job)
@job = job
@format = job.format.to_s
@format_convert = job.format_convert.split('_')[1].to_s if job.format_convert.to_s['_']
Method validate_params_3
has 158 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.validate_params_3
{
stop_areas_area: [[-5.2, 42.25], [-5.2, 51.1], [8.23, 51.1], [8.23, 42.25], [-5.2, 42.25]],
inter_stop_area_distance_min: 20,
parent_stop_area_distance_max: 350,
Class Job
has 31 methods (exceeds 20 allowed). Consider refactoring. Open
class Job < ActiveRecord::Base
belongs_to :user
has_many :links, dependent: :destroy
validates :name, presence: true
validates :iev_action, presence: true
Method download_validation_report
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def download_validation_report(default_view)
result, datas, errors = send("#{default_view}_views")
csv = []
datas.each do |el|
t = [el[:name], I18n.t("compliance_check_results.severities.#{el[:status]}"), el[:count_error], el[:count_warning]]
- 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 job.rb
has 251 lines of code (exceeds 250 allowed). Consider refactoring. Open
class JobFormatValidator < ActiveModel::Validator
def validate(record)
if record.format_convert
if record.format_convert.end_with?(record.format)
record.errors[:format_convert] << I18n.t('activerecord.errors.messages.invalid_format_convert')
Method perform
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def perform(*args)
args = args.reduce
@job = Job.find_pending(args[:id]).first
unless @job
retry_job(wait: 10.seconds) if Job.where(id: args[:id]).any?
Method perform
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def perform(*args)
args = args.reduce
@job = Job.find_pending(args[:id]).first
unless @job
retry_job(wait: 10.seconds) if Job.where(id: args[:id]).any?
- 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 a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def perform(job_id)
job = Job.find_waiting(job_id.to_i).first
if job
uri = URI(job.url)
response = nil
- 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 transport_datas_views
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def transport_datas_views(type = nil)
report = IevkitViews::ActionReport.new(referential, @all_links[:action_report], 'action_report', @all_links[:validation_report], search)
if type
datas = []
datas << report.collections('line') if type == 'line'
- 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 job
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def job
@job = Job.find(params[:id])
@job.search = params[:q][:search] if params[:q]
@current_menu = @job.convert_job? ? :convert : :validate
rescue => _e
- 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"