sharetribe/sharetribe

View on GitHub

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
Severity: Minor
Found in app/services/seo_service.rb - About 3 hrs to fix

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,
Severity: Major
Found in app/assets/javascripts/admin2/sortable.js - About 3 hrs to fix

    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
    Severity: Minor
    Found in app/models/listing.rb - About 3 hrs to fix

      File payment_settings_presenter.rb has 309 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      class Person::PaymentSettingsPresenter
        include Person::PaymentSettingsCommon
      
        private
      
      
      Severity: Minor
      Found in app/presenters/person/payment_settings_presenter.rb - About 3 hrs to fix

        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'])
        Severity: Minor
        Found in app/controllers/people_controller.rb - About 3 hrs to fix

        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';
        Severity: Minor
        Found in client/app/assets/styles/variables.js - About 3 hrs to fix

          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';
          Severity: Minor
          Found in client/app/components/sections/Topbar/Topbar.js - About 3 hrs to fix

            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",
            Severity: Major
            Found in app/view_utils/listing_shape_templates.rb - About 3 hrs to fix

              Class Payments has 27 methods (exceeds 20 allowed). Consider refactoring.
              Open

                class Payments
              
                  # Include with_success for wrapping requests and responses
                  include RequestWrapper
              
              
              Severity: Minor
              Found in app/services/paypal_service/api/payments.rb - About 3 hrs to fix

                Class SectionPresenter has 27 methods (exceeds 20 allowed). Consider refactoring.
                Open

                  class SectionPresenter
                    private
                
                    attr_reader :service
                
                
                Severity: Minor
                Found in app/services/custom_landing_page/section_presenter.rb - About 3 hrs to fix

                  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;
                  Severity: Major
                  Found in app/assets/javascripts/stripe_form3.js - About 3 hrs to fix

                    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,
                    Severity: Major
                    Found in app/assets/javascripts/admin2/sortable.js - About 3 hrs to fix

                      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);
                          });
                      Severity: Major
                      Found in app/assets/javascripts/datepicker.js - About 3 hrs to fix

                        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'];
                        Severity: Major
                        Found in client/app/components/composites/SearchBar/SearchBar.js - About 3 hrs to fix

                          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]
                          
                          
                          Severity: Minor
                          Found in app/controllers/admin/communities_controller.rb - About 3 hrs to fix

                            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(
                            Severity: Minor
                            Found in app/services/paypal_service/store/paypal_account.rb - About 3 hrs to fix

                              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,
                              Severity: Minor
                              Found in app/assets/javascripts/admin2/categories.js - About 3 hrs to fix

                              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);
                              Severity: Minor
                              Found in app/assets/javascripts/admin2/landing_pages.js - About 3 hrs to fix

                                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?
                                Severity: Minor
                                Found in app/services/inbox_service.rb - About 3 hrs to fix

                                  Function _prepareDragStart has 76 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      _prepareDragStart: function _prepareDragStart(
                                      /** Event */
                                      evt,
                                      /** Touch */
                                      touch,
                                  Severity: Major
                                  Found in app/assets/javascripts/admin2/sortable.js - About 3 hrs to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language