Showing 98 of 1,254 total issues
File jsonform.js
has 2407 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* Copyright (c) 2012 Joshfire - MIT license */
/**
* @fileoverview Core of the JSON Form client-side library.
*
* Generates an HTML form from a structured data model and a layout description.
Method convert_params_for_graphql
has a Cognitive Complexity of 164 (exceeds 5 allowed). Consider refactoring. Open
def convert_params_for_graphql
# Check recursively if any addresses data is given.
# If not, we do not want to submit the params, because the name is required by the model,
# which will result in a validation error.
if @tour_params["addresses"].present?
- 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 convert_params_for_graphql
has a Cognitive Complexity of 85 (exceeds 5 allowed). Consider refactoring. Open
def convert_params_for_graphql
# Convert has_many categories
if @event_params["categories"].present?
categories = []
@event_params["categories"].each do |_key, category|
- 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 convert_params_for_graphql
has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring. Open
def convert_params_for_graphql
# Convert has_many categories
if @construction_params["categories"].present?
categories = []
@construction_params["categories"].each do |_key, category|
- 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 convert_params_for_graphql
has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring. Open
def convert_params_for_graphql
# Convert has_many contacts
if @job_params["contacts"].present?
contacts = []
@job_params["contacts"].each do |_key, contact|
- 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 convert_params_for_graphql
has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring. Open
def convert_params_for_graphql
# Convert has_many content_blocks(which has_many media_contents)
content_block_params = @offer_params["content_blocks"]
return unless content_block_params.present?
- 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 buildFromLayout
has 167 lines of code (exceeds 25 allowed). Consider refactoring. Open
formTree.prototype.buildFromLayout = function (formElement, context) {
var schemaElement = null;
var node = new formNode();
var view = null;
var key = null;
Function computeInitialValues
has 162 lines of code (exceeds 25 allowed). Consider refactoring. Open
formNode.prototype.computeInitialValues = function (values, ignoreDefaultValues) {
var self = this;
var node = null;
var nbChildren = 1;
var i = 0;
Method edit
has 159 lines of code (exceeds 25 allowed). Consider refactoring. Open
def edit
results = @smart_village.query <<~GRAPHQL
query {
eventRecord(
id: #{params[:id]}
Function split
has 153 lines of code (exceeds 25 allowed). Consider refactoring. Open
var split = function (jsonform, keys, options) {
options = options || {};
keys = keys || [];
if (!jsonform || !jsonform.form) {
return {
Method convert_params_for_graphql
has 152 lines of code (exceeds 25 allowed). Consider refactoring. Open
def convert_params_for_graphql
# Check recursively if any addresses data is given.
# If not, we do not want to submit the params, because the name is required by the model,
# which will result in a validation error.
if @tour_params["addresses"].present?
Method convert_params_for_graphql
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
def convert_params_for_graphql
# Convert has_many categories
if @deadline_params["categories"].present?
categories = []
@deadline_params["categories"].each do |_key, category|
- 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 tours_controller.rb
has 406 lines of code (exceeds 250 allowed). Consider refactoring. Open
class ToursController < ApplicationController
before_action :verify_current_user
before_action { verify_current_user_role("role_tour") }
before_action :init_graphql_client
before_action :load_category_list, only: [:edit, :new, :create]
Method index
has 130 lines of code (exceeds 25 allowed). Consider refactoring. Open
def index
if helpers.visible_in_role?("role_news_item")
news_results = @smart_village.query <<~GRAPHQL
query {
newsItems {
File events_controller.rb
has 371 lines of code (exceeds 250 allowed). Consider refactoring. Open
class EventsController < ApplicationController
before_action :verify_current_user
before_action { verify_current_user_role("role_event_record") }
before_action :init_graphql_client
before_action :load_category_list, only: [:edit, :new, :create]
Method perform
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def perform
@tour_data.each do |tour_data_line|
@waste_types.each do |waste_type_key, _waste_type|
next if @tour_assignment[waste_type_key].blank?
next if @address_assignment[waste_type_key].blank?
- 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 onInsert
has 117 lines of code (exceeds 25 allowed). Consider refactoring. Open
'onInsert': function (evt, node) {
var $nodeid = $(node.el).find('#' + escapeSelector(node.id));
var boundaries = node.getArrayBoundaries();
var moveNodeTo = function (fromIdx, toIdx) {
Method edit
has 105 lines of code (exceeds 25 allowed). Consider refactoring. Open
def edit
results = @smart_village.query <<~GRAPHQL
query {
tour(
id: #{params[:id]}
Method set_defaults_and_types
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def set_defaults_and_types(entry)
# set default values
entry["color"] = entry["color"].presence || "#ffffff" if entry.keys.include?("color")
if entry.keys.include?("temperature")
- 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 onInsert
has 91 lines of code (exceeds 25 allowed). Consider refactoring. Open
'onInsert': function (evt, node) {
var $nodeid = $(node.el).find('#' + escapeSelector(node.id));
var boundaries = node.getArrayBoundaries();
// Switch two nodes in an array