Showing 700 of 1,230 total issues
Function errorValidator
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
errorValidator(values, field) {
const currentDayIndex = field ? field[1] : null;
const currentSlotIndex = field ? field[3] : null;
const currentSlotProp = field ? field[4] : null;
const currentSlot = field ? values.days[currentDayIndex].working_time_slots[currentSlotIndex] : null;
- 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 render
has 109 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const tintedRGB = tint(this.props.color, TINT_PERCENTAGE);
const listing = this.props.listing;
const imageURL = listing.images.getIn([0, 'square', 'url']);
const image2xURL = listing.images.getIn([0, 'square2x', 'url']);
Class Report
has 34 methods (exceeds 20 allowed). Consider refactoring. Open
class StripeService::Report
private
attr_reader :tx, :exception
Method index
has 107 lines of code (exceeds 25 allowed). Consider refactoring. Open
def index
params = unsafe_params_hash.select{|k, v| v.present? }
redirect_to landing_page_path and return if no_current_user_in_private_clp_enabled_marketplace?
Class ListingsController
has 33 methods (exceeds 20 allowed). Consider refactoring. Open
class ListingsController < ApplicationController
class ListingDeleted < StandardError; end
# Skip auth token check as current jQuery doesn't provide it automatically
skip_before_action :verify_authenticity_token, :only => [:close, :update, :follow, :unfollow]
File landing_page_controller.rb
has 339 lines of code (exceeds 250 allowed). Consider refactoring. Open
class LandingPageController < ActionController::Metal
# Shorthand for accessing CustomLandingPage service namespace
CLP = CustomLandingPage
Function analytics
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
window.ST.analytics = (function(){
var init = function(options) {
$(document).ready(function() {
$(document).trigger('st-analytics:setup', options.analyticsData);
if (options.events) {
- 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 init
has 100 lines of code (exceeds 25 allowed). Consider refactoring. Open
var init = function() {
var socialFieldMap = $(".footer-social-container").map(function(id, entry) {
return {
id: $(entry).data("field-id"),
element: $(entry),
Class StripeApiWrapper
has 32 methods (exceeds 20 allowed). Consider refactoring. Open
class StripeService::API::StripeApiWrapper
DEFAULT_MCC = 5734 # Computer Software Stores
API_2019_12_03 = '2019-12-03'.freeze
API_2019_02_19 = '2019-02-19'.freeze
File test_merchant.rb
has 332 lines of code (exceeds 250 allowed). Consider refactoring. Open
require_relative 'test_api'
module PaypalService
module TestMerchant
Function errorValidator
has 98 lines of code (exceeds 25 allowed). Consider refactoring. Open
errorValidator(values, field) {
const currentDayIndex = field ? field[1] : null;
const currentSlotIndex = field ? field[3] : null;
const currentSlotProp = field ? field[4] : null;
const currentSlot = field ? values.days[currentDayIndex].working_time_slots[currentSlotIndex] : null;
Function thumbnailStripe
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
ST.thumbnailStripe = function(images, opts) {
var container = $("#thumbnail-stripe");
var thumbnailTmpl = _.template($("#image-thumbnail-template").html());
// Options
- 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 render
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
render() {
const { location, marketplace_color1: marketplaceColor1 } = { ...DEFAULT_CONTEXT, ...this.props.marketplace };
const { loggedInUsername } = this.props.user || {};
const isAdmin = !!(this.props.user && this.props.user.isAdmin && loggedInUsername);
- 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 people_controller.rb
has 325 lines of code (exceeds 250 allowed). Consider refactoring. Open
class PeopleController < Devise::RegistrationsController
include ConfigRecaptcha
skip_before_action :verify_authenticity_token, :only => [:create]
skip_before_action :require_no_authentication, :only => [:new]
File entity_utils.rb
has 325 lines of code (exceeds 250 allowed). Consider refactoring. Open
module EntityUtils
module_function
# Define an entity constructor Proc, which returns a Hash
#
Method update_payment_preferences
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def update_payment_preferences
currency = params[:payment_preferences_form]["marketplace_currency"] || @current_community.currency
minimum_commission = @paypal_enabled ? (paypal_minimum_commissions_api.get(currency) || 0) : 0
- 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 payments.rb
has 320 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Payments
extend ActiveSupport::Concern
def payment_index
render 'index', locals: form_locals
Class PersonMailer
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
class PersonMailer < ActionMailer::Base # rubocop:disable Metrics/ClassLength
include MailUtils
# Enable use of method to_date.
require 'active_support/core_ext'
File homepage_controller.rb
has 319 lines of code (exceeds 250 allowed). Consider refactoring. Open
class HomepageController < ApplicationController
before_action :save_current_path, :except => :sign_in
APP_DEFAULT_VIEW_TYPE = "grid".freeze
Method index
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def index
params = unsafe_params_hash.select{|k, v| v.present? }
redirect_to landing_page_path and return if no_current_user_in_private_clp_enabled_marketplace?
- 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"