Showing 350 of 350 total issues
Method performance_information
has 141 lines of code (exceeds 25 allowed). Consider refactoring. Open
def performance_information
performance_information_hash = {}
case document_format
when :format1
Method procedure_information
has 137 lines of code (exceeds 25 allowed). Consider refactoring. Open
def procedure_information
procedure_information_hash = {}
case document_format
when :format1
Method set_up_relation
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
def set_up_relation
dataset_description.relations(true).each do |relation|
left_association = (relation.relationship_dataset_description.identifier < dataset_description.identifier)
if relation.respond_to?(:morph) && relation.morph?
- 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_predicates_from_tokens
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
def create_predicates_from_tokens(tokens)
# puts "==> predicate from tokens #{tokens}"
tokens.each { |token|
# puts "--- token '#{token}'"
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
$('a[href$=/expand]').live('click', function(){
$(this).attr('href', $(this).attr('href').replace('expand', 'collapse'));
$(this).text('Collapse');
target = $(this).attr('href').replace('#/', '').replace('/expand', '').replace('/collapse', '');
$("#"+target).slideDown();
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 137.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
$('a[href$=/collapse]').live('click', function(){
$(this).attr('href', $(this).attr('href').replace('collapse', 'expand'));
$(this).text('Expand');
target = $(this).attr('href').replace('#/', '').replace('/expand', '').replace('/collapse', '');
$("#"+target).slideUp();
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 137.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method customer_information
has 121 lines of code (exceeds 25 allowed). Consider refactoring. Open
def customer_information
customer_information_hash = {}
case document_format
when :format1
Consider simplifying this complex logical expression. Open
if ( event.pageX == null && event.clientX != null ) {
var doc = document.documentElement,
body = document.body;
event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
Method suppliers_information
has 115 lines of code (exceeds 25 allowed). Consider refactoring. Open
def suppliers_information(document)
suppliers = []
case document_type(document)
when :standard
Method header_procedure_and_project_information
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def header_procedure_and_project_information
header_procedure_and_project_information_hash = {}
main_element = document.xpath("//div[@class='oznamenie']")
case document_format
- 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 Sizzle
has 108 lines of code (exceeds 25 allowed). Consider refactoring. Open
var Sizzle = function( selector, context, results, seed ) {
results = results || [];
context = context || document;
var origContext = context;
File vvo_extraction.rb
has 334 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'fileutils'
module Etl
class VvoExtraction < Etl::Extraction
include Etl::Shared::VvoIncludes
Method show
has 97 lines of code (exceeds 25 allowed). Consider refactoring. Open
def show
@dataset_description = DatasetDescription.find(params[:id])
@field_descriptions = @dataset_description.visible_field_descriptions.includes(:data_format)
@dataset_class = @dataset_description.dataset_model
@title = @dataset_description.title
Method page_entries_info_custom
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def page_entries_info_custom(collection, options = {})
model = options[:model]
model = collection.first.class unless model or collection.empty?
model ||= 'entry'
model_key = if model.respond_to? :model_name
- 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 remove
has 92 lines of code (exceeds 25 allowed). Consider refactoring. Open
remove: function( elem, types, handler, pos ) {
// don't do events on text and comment nodes
if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
return;
}
Method additional_information
has 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
def additional_information
additional_information_hash = {}
case document_format
when :format1
Function _mouseDrag
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
_mouseDrag: function(event) {
//Compute the helpers position
this.position = this._generatePosition(event);
this.positionAbs = this._convertPositionTo("absolute");
Method define_index_for_dataset
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def self.define_index_for_dataset(dataset_description)
reference = dataset_description.dataset_model.name.underscore
ThinkingSphinx::Index.define(reference, with: :active_record) do
indexes :_record_id
indexes :record_status
- 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 24 (exceeds 5 allowed). Consider refactoring. Open
def perform
document_ids = {
notice: [],
performance: []
}
- 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 add
has 83 lines of code (exceeds 25 allowed). Consider refactoring. Open
add: function( elem, types, handler, data ) {
if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
return;
}