therubymug/keymaker

View on GitHub

Showing 12 of 12 total issues

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

  class Service

    extend MatchMethodMacros

    attr_accessor :config
Severity: Minor
Found in lib/keymaker/service.rb - About 2 hrs to fix

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

      def process_attrs(attrs)
        attrs = attrs.symbolize_keys
        self.class.properties.delete_if{|p| p == :node_id}.each do |property|
          if property == :active_record_id
            process_attr(property, attrs[:id].present? ? attrs[:id] : attrs[:active_record_id])
    Severity: Minor
    Found in lib/keymaker/serialization.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

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

        def submit
          service.put(node_properties_path(opts[:node_id]), node_properties).on_error do |response|
            case response.status
            when (400..499)
              raise ClientError.new(response, response.body)
    Severity: Minor
    Found in lib/keymaker/requests/update_node_properties_request.rb and 2 other locations - About 30 mins to fix
    lib/keymaker/requests/create_relationship_request.rb on lines 12..18
    lib/keymaker/requests/traverse_path_request.rb on lines 11..17

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 33.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

        def submit
          service.post(node_traverse_path(opts[:node_id]), traverse_path_properties).on_error do |response|
            case response.status
            when (400..499)
              raise ClientError.new(response, response.body)
    Severity: Minor
    Found in lib/keymaker/requests/traverse_path_request.rb and 2 other locations - About 30 mins to fix
    lib/keymaker/requests/create_relationship_request.rb on lines 12..18
    lib/keymaker/requests/update_node_properties_request.rb on lines 5..11

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 33.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

        def submit
          service.post(relationships_path_for_node(opts[:node_id]), rel_properties).on_error do |response|
            case response.status
            when (400..499)
              raise ClientError.new(response, response.body)
    Severity: Minor
    Found in lib/keymaker/requests/create_relationship_request.rb and 2 other locations - About 30 mins to fix
    lib/keymaker/requests/traverse_path_request.rb on lines 11..17
    lib/keymaker/requests/update_node_properties_request.rb on lines 5..11

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 33.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

      class ExecuteCypherRequest < Request
        def submit
          service.post(full_cypher_path, opts).on_error do |response|
            case response.status
            when (400..499)
    Severity: Minor
    Found in lib/keymaker/requests/execute_cypher_request.rb and 2 other locations - About 30 mins to fix
    lib/keymaker/requests/batch_request.rb on lines 3..11
    lib/keymaker/requests/execute_gremlin_request.rb on lines 2..9

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 32.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

      class ExecuteGremlinRequest < Request
        def submit
          service.post(full_gremlin_path, opts).on_error do |response|
            case response.status
            when (400..499)
    Severity: Minor
    Found in lib/keymaker/requests/execute_gremlin_request.rb and 2 other locations - About 30 mins to fix
    lib/keymaker/requests/batch_request.rb on lines 3..11
    lib/keymaker/requests/execute_cypher_request.rb on lines 2..9

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 32.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

      class BatchRequest < Request
    
        def submit
          service.post(batch_path, opts).on_error do |response|
            case response.status
    Severity: Minor
    Found in lib/keymaker/requests/batch_request.rb and 2 other locations - About 30 mins to fix
    lib/keymaker/requests/execute_cypher_request.rb on lines 2..9
    lib/keymaker/requests/execute_gremlin_request.rb on lines 2..9

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 32.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 3 locations. Consider refactoring.
    Open

            case response.status
            when 404
              raise ResourceNotFound.new(response, response.body)
            when (400..499)
              raise ClientError.new(response, response.body)
    Severity: Minor
    Found in lib/keymaker/requests/get_node_request.rb and 2 other locations - About 25 mins to fix
    lib/keymaker/requests/add_node_to_index_request.rb on lines 6..12
    lib/keymaker/requests/delete_relationship_request.rb on lines 13..19

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 30.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 3 locations. Consider refactoring.
    Open

            case response.status
            when 404
              raise ResourceNotFound.new(response, response.body)
            when (400..499)
              raise ClientError.new(response, response.body)
    Severity: Minor
    Found in lib/keymaker/requests/add_node_to_index_request.rb and 2 other locations - About 25 mins to fix
    lib/keymaker/requests/delete_relationship_request.rb on lines 13..19
    lib/keymaker/requests/get_node_request.rb on lines 5..11

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 30.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

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

        def traverse_path_properties
          # :order - breadth_first or depth_first
          # :relationships - all, in, or out
          #   e.g. [{"type" => "likes", "direction" => "all}]
          # :uniqueness - node_global, none, relationship_global, node_path, or relationship_path
    Severity: Minor
    Found in lib/keymaker/requests/traverse_path_request.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

    Identical blocks of code found in 3 locations. Consider refactoring.
    Open

            case response.status
            when 404
              raise ResourceNotFound.new(response, response.body)
            when (400..499)
              raise ClientError.new(response, response.body)
    Severity: Minor
    Found in lib/keymaker/requests/delete_relationship_request.rb and 2 other locations - About 25 mins to fix
    lib/keymaker/requests/add_node_to_index_request.rb on lines 6..12
    lib/keymaker/requests/get_node_request.rb on lines 5..11

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 30.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Severity
    Category
    Status
    Source
    Language