Showing 700 of 1,230 total issues
File listings_controller.rb
has 393 lines of code (exceeds 250 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 form.js
has 390 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { Form, StyledSelect, FormField, Checkbox } from 'react-form';
import merge from 'lodash.merge';
import { t } from '../../../utils/i18n';
Function utils
has 132 lines of code (exceeds 25 allowed). Consider refactoring. Open
ST.utils = (function(_) {
function findNextIndex(arr, fn) {
if(arr.length < 2) {
return -1;
Function thumbnailStripe
has 132 lines of code (exceeds 25 allowed). Consider refactoring. Open
ST.thumbnailStripe = function(images, opts) {
var container = $("#thumbnail-stripe");
var thumbnailTmpl = _.template($("#image-thumbnail-template").html());
// Options
Method get_conversation_statuses
has 132 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_conversation_statuses(conversation, is_author)
statuses = if conversation.listing && !conversation.status.eql?("free")
status_hash = {
paid: -> { {
both: [
File preauthorize_transactions_controller.rb
has 383 lines of code (exceeds 250 allowed). Consider refactoring. Open
class PreauthorizeTransactionsController < ApplicationController
before_action do |controller|
controller.ensure_logged_in t("layouts.notifications.you_must_log_in_to_do_a_transaction")
end
File listing_presenter.rb
has 382 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'fast-polylines'
require 'base64'
class ListingPresenter < MemoisticPresenter
include ListingAvailabilityManage
Function analytics
has 128 lines of code (exceeds 25 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) {
File payments.rb
has 380 lines of code (exceeds 250 allowed). Consider refactoring. Open
module PaypalService::API
class Payments
# Include with_success for wrapping requests and responses
Method price_break_down_locals
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
def price_break_down_locals(tx, conversation)
if tx.payment_process == :none && tx.unit_price.cents == 0 || conversation.starting_page == Conversation::LISTING
nil
else
localized_unit_type = tx.unit_type.present? ? ListingViewUtils.translate_unit(tx.unit_type, tx.unit_tr_key) : 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
Function _onDrop
has 122 lines of code (exceeds 25 allowed). Consider refactoring. Open
_onDrop: function _onDrop(
/**Event*/
evt) {
var el = this.el,
options = this.options; // Get the index of the dragged element within its parent
Function drop
has 121 lines of code (exceeds 25 allowed). Consider refactoring. Open
drop: function drop(_ref12) {
var evt = _ref12.originalEvent,
rootEl = _ref12.rootEl,
parentEl = _ref12.parentEl,
sortable = _ref12.sortable,
Function init
has 120 lines of code (exceeds 25 allowed). Consider refactoring. Open
var init = function(options) {
BANK_RULES = options.bank_rules;
window.ST.stripe_test_api_mode = options.stripe_test_mode;
stripeApi = Stripe(options.api_publishable_key);
add_validators();
Function AnimationStateManager
has 119 lines of code (exceeds 25 allowed). Consider refactoring. Open
function AnimationStateManager() {
var animationStates = [],
animationCallbackId;
return {
captureAnimationState: function captureAnimationState() {
Class Transaction
has 36 methods (exceeds 20 allowed). Consider refactoring. Open
class Transaction < ApplicationRecord
include ExportTransaction
include Testimonials
# While initiated is technically not a finished state it also
Function initializeListingShapeForm
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
window.ST.initializeListingShapeForm = function(formId) {
$(formId).validate({
errorPlacement: function(error, element) {
if (element.hasClass("js-custom-unit-kind-radio")) {
error.appendTo($(".js-custom-unit-kind-container"));
- 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 initialize_new_listing_form
has 114 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.initialize_new_listing_form = function(
fileDefaultText,
fileBtnText,
locale,
share_type_message,
Function GuideStatusPage
has 113 lines of code (exceeds 25 allowed). Consider refactoring. Open
const GuideStatusPage = (props) => {
const handleClick = function handleClick(e, page, path) {
e.preventDefault();
props.changePage(page, path);
Function initializeLocationSearch
has 113 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.initializeLocationSearch = function initializeLocationSearch(selectors) {
var searchInput = document.querySelector(selectors.search);
var statusInput = document.querySelector(selectors.status);
var coordinateInput = document.querySelector(selectors.coordinate);
var boundingboxInput = document.querySelector(selectors.boundingbox);
Function initializeListingShapeForm
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
window.ST.initializeListingShapeForm = function(formId) {
$(formId).validate({
errorPlacement: function(error, element) {
if (element.hasClass("js-custom-unit-kind-radio")) {
error.appendTo($(".js-custom-unit-kind-container"));
- 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"