Showing 14 of 1,441 total issues
File project_spec.rb
has 437 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'rails_helper'
RSpec.describe Project, type: :model do
before(:each) do
@project = FactoryGirl.build(:project)
File statistics_spec.rb
has 342 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'rails_helper'
RSpec.describe 'Statistics API', type: :request do
before(:each) do
@auth_token = ApplicationController.generate_auth_token
Class ProjectsController
has 29 methods (exceeds 20 allowed). Consider refactoring. Open
class ProjectsController < ApplicationController
include ServiceRoles
before_action :authenticate_user,
only: [:index, :show]
File annotation_documents_spec.rb
has 306 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'rails_helper'
RSpec.configure do |config|
config.include AnnotationDocumentHelper
end
File raw_datum_spec.rb
has 279 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'rails_helper'
RSpec.describe RawDatum, type: :model do
before(:each) do
@raw_datum = FactoryGirl.build(:raw_datum)
File service_spec.rb
has 264 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'rails_helper'
RSpec.configure do |c|
c.include ServiceHelper
end
Method merge_annotation_documents
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def merge_annotation_documents
record_count = error_count = 0
@project.merge_data.each do |merge_datum|
response = merge_request merge_datum
if response.kind_of? Net::HTTPSuccess
- 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 9 (exceeds 5 allowed). Consider refactoring. Open
def create
ActiveRecord::Base.transaction do
raw_data = []
raw_data_params.each do |rd_params|
@raw_datum = raw_datum_from_params(rd_params)
- 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 new_service_flash_text
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def new_service_flash_text(uri)
if @service
@service.validate
url_error = @service.errors.details[:url].first
flash_text = I18n.t('services.searching.already-taken-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
Avoid too many return
statements within this method. Open
return action_label(token) if is_action?(token)
Method process_zip_archive
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.process_zip_archive(project, zip, temp_dir)
require 'zip'
batch_result = { success: [], error: [] }
Zip::File.open(zip) do |zipfile|
zipfile.each do |file|
- 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 batch_process
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.batch_process(project, data)
return { error: [], success: [] } unless data || data == []
data_size = data.size
data_first = data.first.tempfile
if data_size == 1 && valid_zip?(data_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 process_iteration_data
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def process_iteration_data(raw_data)
@annotation_documents = false
iterate_service = @project.iterate_service
response = json_post_request iterate_service.url,
process_iteration_data_response_hash(raw_data)
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
def create
ActionController::Parameters.permit_all_parameters = true
annotation_documents = []
annotation_documents_params.each do |ad_params|
@annotation_document = AnnotationDocument.new(ad_params)
- 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"