Showing 700 of 1,230 total issues
Method eval_single
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def eval_single(variable, locale = I18n.locale)
case variable
when MARKETPLACE_NAME
@community.name(locale)
when MARKETPLACE_DESCRIPTION
- 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 AutoScrollPlugin
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
function AutoScrollPlugin() {
function AutoScroll() {
this.defaults = {
scroll: true,
scrollSensitivity: 30,
Class Listing
has 29 methods (exceeds 20 allowed). Consider refactoring. Open
class Listing < ApplicationRecord
include ApplicationHelper
include ActionView::Helpers::TranslationHelper
include Rails.application.routes.url_helpers
File payment_settings_presenter.rb
has 309 lines of code (exceeds 250 allowed). Consider refactoring. Open
class Person::PaymentSettingsPresenter
include Person::PaymentSettingsCommon
private
Method create
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def create
domain = @current_community ? @current_community.full_url : "#{request.protocol}#{request.host_with_port}"
error_redirect_path = domain + sign_up_path
unless validate_recaptcha(params['g-recaptcha-response'])
- 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 variables.js
has 302 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* eslint-env node */
/* eslint-disable no-magic-numbers */
const fontSizeTiny = '11px';
const fontSizeSmaller = '12px';
const fontSizeSmall = '13px';
File Topbar.js
has 302 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { Component } from 'react';
import PropTypes from 'prop-types';
import r, { div } from 'r-dom';
import classNames from 'classnames';
import * as placesUtils from '../../../utils/places';
Method all
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
def all
[
{
label: "admin.listing_shapes.templates.selling_products",
name_tr_key: "admin.transaction_types.sell",
Class Payments
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
class Payments
# Include with_success for wrapping requests and responses
include RequestWrapper
Class SectionPresenter
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
class SectionPresenter
private
attr_reader :service
Function prepareData
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
var prepareData = function(options) {
var country = getValue('address_country'),
firstName = getValue('first_name'),
lastName = getValue('last_name'),
address, person;
Function autoScroll
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
var autoScroll = throttle(function (evt, options, rootEl, isFallback) {
// Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=505521
if (!options.scroll) return;
var x = (evt.touches ? evt.touches[0] : evt).clientX,
y = (evt.touches ? evt.touches[0] : evt).clientY,
Function setupPerHour
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
var setupPerHour = function(options) {
var dateInput = $('#start-on');
var disabledDates = options.blocked_dates.map(function(d) {
return new Date(d * 1000);
});
Function render
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { mode, keywordPlaceholder, locationPlaceholder, keywordQuery, locationQuery } = this.props;
// Custom color support disabled for now until further discussion.
// const bgColor = customColor || variables['--SearchBar_mobileBackgroundColor'];
File communities_controller.rb
has 296 lines of code (exceeds 250 allowed). Consider refactoring. Open
class Admin::CommunitiesController < Admin::AdminBaseController
include CommunitiesHelper
before_action :ensure_white_label_plan, only: [:create_sender_address]
File paypal_account.rb
has 296 lines of code (exceeds 250 allowed). Consider refactoring. Open
module PaypalService::Store::PaypalAccount
PaypalAccountModel = ::PaypalAccount
OrderPermissionModel = ::OrderPermission
PaypalAccountCreate = EntityUtils.define_builder(
Function sortArray
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
function sortArray(nestedSortables) {
for (var i = 0; i < nestedSortables.length; i++) {
new Sortable(nestedSortables[i], {
group: 'nested',
animation: 250,
- 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 landing_pages.js
has 294 lines of code (exceeds 250 allowed). Consider refactoring. Open
function readURL(input, render_img) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function(e) {
render_img.attr('src', e.target.result);
File inbox_service.rb
has 294 lines of code (exceeds 250 allowed). Consider refactoring. Open
module InboxService
module_function
def last_activity_type(inbox_item)
if inbox_item[:last_transition_at].nil?
Function _prepareDragStart
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
_prepareDragStart: function _prepareDragStart(
/** Event */
evt,
/** Touch */
touch,