3scale/porta

View on GitHub

Showing 307 of 5,715 total issues

Method path_to has 493 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def path_to(page_name, *args) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
    case page_name

    # Public
    when /the home\s?page/
Severity: Major
Found in features/support/paths.rb - About 2 days to fix

    File routes.rb has 885 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'routing_constraints'
    require 'prometheus_exporter_port'
    
    # rubocop:disable Metrics/BlockLength
    
    
    Severity: Major
    Found in config/routes.rb - About 2 days to fix

      Method up has 357 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def self.up
          create_table "attachment_versions", :force => true do |t|
            t.integer  "attachment_id"
            t.integer  "version"
            t.string   "file_path"
      Severity: Major
      Found in db/migrate/20100125103539_browser_cms_tables.rb - About 1 day to fix

        Method down has 339 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def self.down
            change_column :account_group_memberships, :id, :integer
            change_column :account_group_memberships, :account_id, :integer
            change_column :account_group_memberships, :group_id, :integer
            change_column :account_group_memberships, :tenant_id, :integer
        Severity: Major
        Found in db/migrate/20120117134623_increase_ids_to64_bit.rb - About 1 day to fix

          Method up has 339 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def self.up
              change_column :account_group_memberships, :id, "bigint auto_increment"
              change_column :account_group_memberships, :account_id, "bigint"
              change_column :account_group_memberships, :group_id, "bigint"
              change_column :account_group_memberships, :tenant_id, "bigint"
          Severity: Major
          Found in db/migrate/20120117134623_increase_ids_to64_bit.rb - About 1 day to fix

            File 20120117134623_increase_ids_to64_bit.rb has 684 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            class IncreaseIdsTo64Bit < ActiveRecord::Migration
              def self.up
                change_column :account_group_memberships, :id, "bigint auto_increment"
                change_column :account_group_memberships, :account_id, "bigint"
                change_column :account_group_memberships, :group_id, "bigint"
            Severity: Major
            Found in db/migrate/20120117134623_increase_ids_to64_bit.rb - About 1 day to fix

              File 20121018100514_removing_bcms_tables.rb has 632 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              class RemovingBcmsTables < ActiveRecord::Migration
                def self.up
                  drop_table :account_group_memberships
                  drop_table :app_exhibits
                  drop_table :assets
              Severity: Major
              Found in db/migrate/20121018100514_removing_bcms_tables.rb - About 1 day to fix

                Function Modernizr has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring.
                Open

                ;window.Modernizr=function(a,b,c){function u(a){i.cssText=a}function v(a,b){return u(prefixes.join(a+";")+(b||""))}function w(a,b){return typeof a===b}function x(a,b){return!!~(""+a).indexOf(b)}function y(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:w(f,"function")?f.bind(d||b):f}return!1}function z(){e.input=function(c){for(var d=0,e=c.length;d<e;d++)o[c[d]]=c[d]in j;return o.list&&(o.list=!!b.createElement("datalist")&&!!a.HTMLDataListElement),o}("autocomplete autofocus list placeholder max min multiple pattern required step".split(" ")),e.inputtypes=function(a){for(var d=0,e,g,h,i=a.length;d<i;d++)j.setAttribute("type",g=a[d]),e=j.type!=="text",e&&(j.value=k,j.style.cssText="position:absolute;visibility:hidden;",/^range$/.test(g)&&j.style.WebkitAppearance!==c?(f.appendChild(j),h=b.defaultView,e=h.getComputedStyle&&h.getComputedStyle(j,null).WebkitAppearance!=="textfield"&&j.offsetHeight!==0,f.removeChild(j)):/^(search|tel)$/.test(g)||(/^(url|email)$/.test(g)?e=j.checkValidity&&j.checkValidity()===!1:e=j.value!=k)),n[a[d]]=!!e;return n}("search tel url email datetime date month week time datetime-local number range color".split(" "))}var d="2.6.2",e={},f=b.documentElement,g="modernizr",h=b.createElement(g),i=h.style,j=b.createElement("input"),k=":)",l={}.toString,m={},n={},o={},p=[],q=p.slice,r,s={}.hasOwnProperty,t;!w(s,"undefined")&&!w(s.call,"undefined")?t=function(a,b){return s.call(a,b)}:t=function(a,b){return b in a&&w(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=q.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(q.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(q.call(arguments)))};return e});for(var A in m)t(m,A)&&(r=A.toLowerCase(),e[r]=m[A](),p.push((e[r]?"":"no-")+r));return e.input||z(),e.addTest=function(a,b){if(typeof a=="object")for(var d in a)t(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof enableClasses!="undefined"&&enableClasses&&(f.className+=" "+(b?"":"no-")+a),e[a]=b}return e},u(""),h=j=null,e._version=d,e}(this,this.document);
                Severity: Minor
                Found in app/assets/javascripts/provider.js - About 1 day 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

                Class Service has 64 methods (exceeds 20 allowed). Consider refactoring.
                Open

                class Service < ApplicationRecord # rubocop:disable Metrics/ClassLength
                  include Searchable
                  include Backend::ModelExtensions::Service
                  include Logic::Contracting::Service
                  include Logic::PlanChanges::Service
                Severity: Major
                Found in app/models/service.rb - About 1 day to fix

                  Class User has 63 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  class User < ApplicationRecord
                    include Symbolize
                  
                    include Fields::Fields
                    required_fields_are :username, :email
                  Severity: Major
                  Found in app/models/user.rb - About 1 day to fix

                    Class Proxy has 59 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                    class Proxy < ApplicationRecord # rubocop:disable Metrics/ClassLength
                      include AfterCommitQueue
                      include BackendApiLogic::ProxyExtension
                      prepend BackendApiLogic::RoutingPolicy
                      include GatewaySettings::ProxyExtension
                    Severity: Major
                    Found in app/models/proxy.rb - About 1 day to fix

                      File proxy.rb has 510 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      require 'ipaddr'
                      require 'resolv'
                      
                      class Proxy < ApplicationRecord # rubocop:disable Metrics/ClassLength
                        include AfterCommitQueue
                      Severity: Major
                      Found in app/models/proxy.rb - About 1 day to fix

                        File paths.rb has 502 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        World(Module.new do
                          break unless defined?(DeveloperPortal)
                        
                          include System::UrlHelpers.cms_url_helpers
                        
                        
                        Severity: Major
                        Found in features/support/paths.rb - About 1 day to fix

                          Class Invoice has 56 methods (exceeds 20 allowed). Consider refactoring.
                          Open

                          class Invoice < ApplicationRecord
                            %I[due_on period issued_on last_charging_retry].each do |attr|
                              attribute attr, :date
                            end
                          
                          
                          Severity: Major
                          Found in app/models/invoice.rb - About 1 day to fix

                            Class Account has 56 methods (exceeds 20 allowed). Consider refactoring.
                            Open

                            class Account < ApplicationRecord
                              attribute :credit_card_expires_on, :date
                              self.ignored_columns = %i[proxy_configs_file_name proxy_configs_content_type proxy_configs_file_size
                                                        proxy_configs_updated_at proxy_configs_conf_file_name proxy_configs_conf_content_type
                                                        proxy_configs_conf_file_size proxy_configs_conf_updated_at]
                            Severity: Major
                            Found in app/models/account.rb - About 1 day to fix

                              Method provider_request has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
                              Open

                                def provider_request
                                  return unless provider?
                              
                                  hourly(&:group)
                              
                              
                              Severity: Minor
                              Found in lib/tracking_notifications.rb - About 7 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

                              Class Cinstance has 52 methods (exceeds 20 allowed). Consider refactoring.
                              Open

                              class Cinstance < Contract
                                include SaveDestroyForServiceAssociation
                                # Maximum number of cinstances permitted between provider and buyer
                                MAX = 10
                              
                              
                              Severity: Major
                              Found in app/models/cinstance.rb - About 7 hrs to fix

                                Class Plan has 52 methods (exceeds 20 allowed). Consider refactoring.
                                Open

                                class Plan < ApplicationRecord
                                  include Searchable
                                  class PeriodRangeCalculationError < StandardError; end
                                  include Symbolize
                                
                                
                                Severity: Major
                                Found in app/models/plan.rb - About 7 hrs to fix

                                  File service.rb has 440 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  require 'backend_client'
                                  
                                  class Service < ApplicationRecord # rubocop:disable Metrics/ClassLength
                                    include Searchable
                                    include Backend::ModelExtensions::Service
                                  Severity: Minor
                                  Found in app/models/service.rb - About 6 hrs to fix

                                    File invoice.rb has 426 lines of code (exceeds 250 allowed). Consider refactoring.
                                    Open

                                    class Invoice < ApplicationRecord
                                      %I[due_on period issued_on last_charging_retry].each do |attr|
                                        attribute attr, :date
                                      end
                                    
                                    
                                    Severity: Minor
                                    Found in app/models/invoice.rb - About 6 hrs to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language