Showing 8 of 13 total issues
File works_controller_behavior.rb
has 389 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
require 'iiif_manifest'
module Hyrax
module WorksControllerBehavior
extend ActiveSupport::Concern
File accordion.js
has 357 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
// TO DO: Remove console.log statements
// wait for page to load (ruby seems to act weird if we don't)
document.addEventListener('DOMContentLoaded', function (event) {
// get accordion elements
Function formSetup
has 99 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function formSetup() {
//fields
var parTitle = document.getElementsByClassName("form-group string optional publication_parent_title");
var confName = document.getElementsByClassName("form-group string optional publication_conference_name");
var isbn = document.getElementsByClassName("form-group string optional publication_isbn");
Function validateForm
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function validateForm() {
Function validateForm
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
Open
function validateForm() {
- 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 to_solr
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Open
def to_solr
super.tap do |solr_doc|
solr_doc['alternate_ids_ssim'] = find_alternate_ids
solr_doc['preservation_events_tesim'] = resource&.preservation_events&.map(&:preservation_event_terms)
- 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 function. Open
Open
return false;
Avoid too many return
statements within this function. Open
Open
return true;