lanej/zendesk2

View on GitHub

Showing 17 of 52 total issues

Method mock has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def mock
    user_id = cistern.serial_id

    user = params.fetch('user')
    organization_id = user['organization_id']
Severity: Minor
Found in lib/zendesk2/create_user.rb - About 2 hrs to fix

    Method mock has 47 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def mock
        comment = params.fetch('ticket').delete('comment')
    
        body = find!(:tickets, ticket_id).merge!(ticket_params)
    
    
    Severity: Minor
    Found in lib/zendesk2/update_ticket.rb - About 1 hr to fix

      Method mock has 44 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def mock
          create_params = view_params
      
          if Zendesk2.blank?(create_params['title'])
            error!(:invalid, details: { 'base' => [{ 'title' => 'Title: cannot be blank' }] })
      Severity: Minor
      Found in lib/zendesk2/create_view.rb - About 1 hr to fix

        Method mock has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def mock
            identity = cistern.serial_id
        
            locale = params['locale'] ||= 'en-us'
            position = data[:help_center_sections].values.select { |a| a['category_id'] == category_id }.size
        Severity: Minor
        Found in lib/zendesk2/help_center/create_help_center_section.rb - About 1 hr to fix

          Method mock has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def mock
              body = find!(:views, view_id)
          
              update_params = view_params
          
          
          Severity: Minor
          Found in lib/zendesk2/update_view.rb - About 1 hr to fix

            Method mock has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

              def mock
                terms = Hash[query.split(' ').map { |t| t.split(':') }]
                terms.delete('type') # context already provided
            
                collection = searchable_collection(terms)
            Severity: Minor
            Found in lib/zendesk2/search_user.rb - About 1 hr 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

            Method data has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def self.data
                @data ||= Hash.new do |h, k|
                  h[k] = {
                    brands: {},
                    categories: {},
            Severity: Minor
            Found in lib/zendesk2/mock.rb - About 1 hr to fix

              Method initialize has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                def initialize(options = {})
                  url = options[:url] || Zendesk2.defaults[:url]
              
                  @url = (URI.parse(url).to_s if url)
              
              
              Severity: Minor
              Found in lib/zendesk2/real.rb - About 1 hr 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

              Method mock has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def mock
                  identity = cistern.serial_id
              
                  locale = params['locale'] ||= 'en-us'
                  position = data[:help_center_articles].values.select { |a| a['section_id'] == section_id }.size
              Severity: Minor
              Found in lib/zendesk2/help_center/create_help_center_article.rb - About 1 hr to fix

                Method page has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def page(collection, options = {})
                    url_params = options[:params] || params
                    page_params = page_params!(params)
                
                    page_size  = (page_params.delete('per_page') || 50).to_i
                Severity: Minor
                Found in lib/zendesk2/request.rb - About 1 hr to fix

                  Method mock has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def mock
                      comment = params.fetch('ticket').delete('comment')
                  
                      body = find!(:tickets, ticket_id).merge!(ticket_params)
                  
                  
                  Severity: Minor
                  Found in lib/zendesk2/update_ticket.rb - About 45 mins 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

                  Method mock has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def mock
                      terms = Hash[query.split(' ').map { |t| t.split(':') }]
                      terms.delete('type') # context already provided
                  
                      collection = data[:organizations].values
                  Severity: Minor
                  Found in lib/zendesk2/search_organization.rb - About 45 mins 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

                  Method page has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def page(collection, options = {})
                      url_params = options[:params] || params
                      page_params = page_params!(params)
                  
                      page_size  = (page_params.delete('per_page') || 50).to_i
                  Severity: Minor
                  Found in lib/zendesk2/request.rb - About 35 mins 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

                  Method search_by_string has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def search_by_string(terms)
                      additional_terms = []
                      additional_terms = ["type:#{self.class.search_type}"] if self.class.search_type
                      additional_terms += self.class.scopes.inject([]) do |r, k|
                        val = public_send(k)
                  Severity: Minor
                  Found in lib/zendesk2/searchable.rb - About 35 mins 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

                  Method mock has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def mock(_params = {})
                      view = find!(:views, view_id)
                  
                      operators = Array(view['conditions']['all']).map do |c|
                        operator = 'is' == c.fetch('operator') ? :eql? : :!=
                  Severity: Minor
                  Found in lib/zendesk2/get_view_tickets.rb - About 35 mins 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

                  Method mock has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def mock
                      update_params = user_params
                  
                      email = update_params['email']
                  
                  
                  Severity: Minor
                  Found in lib/zendesk2/update_user.rb - About 25 mins 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

                  Method translation_params has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def translation_params
                      new_params = Cistern::Hash.slice(params, :outdated, :draft)
                  
                      # Extract locales and dedup "locale"
                      locales = params['locales'] || []
                  Severity: Minor
                  Found in lib/zendesk2/help_center/get_help_center_translations.rb - About 25 mins 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

                  Severity
                  Category
                  Status
                  Source
                  Language