Showing 388 of 388 total issues
Function processForm_generic
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
function processForm_generic(objType) {
var attributesArray =new Array("assembledCollection","provenanceCollection","provenanceCollectionPart","complexSubject","statute","license","copyright","language","unit","rightsHolderPersonal");
fieldId = "";
for (var j in attributesArray) {
- 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 insertRelationshipFields
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def insertRelationshipFields ( solr_doc, prefix, relationships )
facetable = Solrizer::Descriptor.new(:string, :indexed, :multivalued)
# build map: role => [name1,name2]
rels = {}
- 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 insertOtherRightsFields
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def insertOtherRightsFields( solr_doc, prefix, otherRights )
othr = load_otherRights otherRights
if othr != nil
othr_json = {
:id => othr.pid,
- 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 events_to_json
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
def events_to_json( event )
event_array = []
events = load_events event
if events != nil
n = 0
Function showComponent
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.showComponent = function(componentIndex)
{
var componentID = "#component-" + componentIndex;
var container = componentID + " > [data]";
Function processForm_generic
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
function processForm_generic(objType) {
var attributesArray =new Array("assembledCollection","provenanceCollection","provenanceCollectionPart","complexSubject","statute","license","copyright","language","unit","rightsHolderPersonal");
fieldId = "";
for (var j in attributesArray) {
Method serialize
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
def serialize
check_type( graph, rdf_subject, DAMS.ProvenanceCollection )
if(!@unitURI.nil?)
if new?
graph.insert([rdf_subject, DAMS.unit, @unitURI])
Function getDynamicFields
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getDynamicFields(link,type,location,fieldId,typeName,selectedValue,relationship,selectedRole)
{
var q = null;
var fieldName = null;
var typeGet = null;
Similar blocks of code found in 2 locations. Consider refactoring. Open
} else if( isId == false && $("."+id).val().indexOf("Create New") >= 0) {
if(type.indexOf("mads") < 0 && type.indexOf("dams") < 0) {
type = getObjectsPath(type);
}
target_popup(baseURL.replace("get_data","")+type+"/new?parent_class="+id);
- 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 78.
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
if( isId == true && $("#"+id).val().indexOf("Create New") >= 0) {
if(type.indexOf("mads") < 0 && type.indexOf("dams") < 0) {
type = getObjectsPath(type);
}
target_popup(baseURL.replace("get_data","")+type+"/new?parent_id="+id);
- 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 78.
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 insertRelationship
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
def insertRelationship ( solr_doc, prefix, relationships )
# build map: role => [name1,name2]
rels = {}
relationships.map do |relationship|
Method get_simple_subject_id
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def get_simple_subject_id(object)
id = ""
if !object.temporal[0].nil?
id = object.temporal.to_s.gsub(/.*\//,'')[0..9]
elsif !object.topic[0].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 get_simple_subject_type
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def get_simple_subject_type(object)
type = ""
if !object.temporal[0].nil?
type = "MadsTemporal"
elsif !object.topic[0].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 get_simple_subject_value
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def get_simple_subject_value(object)
value = ""
if !object.temporal[0].nil?
value = object.temporal.first.name.first
elsif !object.topic[0].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
Similar blocks of code found in 2 locations. Consider refactoring. Open
if !object.name[0].nil?
id = object.name.to_s.gsub(/.*\//,'')[0..9]
elsif !object.conferenceName[0].nil?
id = object.conferenceName.to_s.gsub(/.*\//,'')[0..9]
elsif !object.corporateName[0].nil?
- 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 80.
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
elsif !object.technique[0].nil?
id = object.technique.to_s.gsub(/.*\//,'')[0..9]
elsif !object.lithology[0].nil?
id = object.lithology.to_s.gsub(/.*\//,'')[0..9]
elsif !object.series[0].nil?
- 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 80.
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
Function getTypeaheadFields
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getTypeaheadFields(linkTag,formType,location,fieldId,typeName,selectedValue,selectedLabel)
{
var q = null;
var fieldName = null;
Method serialize
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
def serialize
check_type( graph, rdf_subject, DAMS.ProvenanceCollectionPart )
if(!@unitURI.nil?)
if new?
graph.insert([rdf_subject, DAMS.unit, @unitURI])
Method insertDateFields
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
def insertDateFields (solr_doc, cid, dates)
date_begin = nil
date_end = nil
date_val = nil
Function getMultiAutoCompleteList
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getMultiAutoCompleteList(fieldName){
var subjectLocal = new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'),
queryTokenizer: Bloodhound.tokenizers.whitespace,