chartmogul/chartmogul-ruby

View on GitHub

Showing 15 of 15 total issues

Class Customer has 24 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Customer < APIResource
    set_resource_name 'Customer'
    set_resource_path '/v1/customers'
    set_immutable_keys(%i[attributes custom])

Severity: Minor
Found in lib/chartmogul/customer.rb - About 2 hrs to fix

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

          class Activities < APIResource
            set_resource_name 'Activities'
            set_resource_path '/v1/customers/:customer_uuid/activities'
    
            include Concerns::Entries
    Severity: Minor
    Found in lib/chartmogul/metrics/customers/activity.rb and 1 other location - About 45 mins to fix
    lib/chartmogul/metrics/customers/subscription.rb on lines 27..42

    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 40.

    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 2 locations. Consider refactoring.
    Open

          class Subscriptions < APIResource
            set_resource_name 'Subscriptions'
            set_resource_path '/v1/customers/:customer_uuid/subscriptions'
    
            include Concerns::Entries
    Severity: Minor
    Found in lib/chartmogul/metrics/customers/subscription.rb and 1 other location - About 45 mins to fix
    lib/chartmogul/metrics/customers/activity.rb on lines 23..38

    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 40.

    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 2 locations. Consider refactoring.
    Open

      module Transactions
        class Payment < APIResource
          set_resource_name 'Payment Transaction'
          set_resource_path '/v1/import/invoices/:invoice_uuid/transactions'
    
    
    Severity: Minor
    Found in lib/chartmogul/transactions/payment.rb and 1 other location - About 45 mins to fix
    lib/chartmogul/transactions/refund.rb on lines 4..24

    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 39.

    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 2 locations. Consider refactoring.
    Open

      module Transactions
        class Refund < APIResource
          set_resource_name 'Refund Transaction'
          set_resource_path '/v1/import/invoices/:invoice_uuid/transactions'
    
    
    Severity: Minor
    Found in lib/chartmogul/transactions/refund.rb and 1 other location - About 45 mins to fix
    lib/chartmogul/transactions/payment.rb on lines 4..24

    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 39.

    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 config_accessor has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def config_accessor(attribute, default_value = nil)
          define_method(attribute) do
            attr = config.send(attribute) || global_config.send(attribute) || default_value
            if attr.nil?
              raise ConfigurationError, "Configuration for #{attribute} not set"
    Severity: Minor
    Found in lib/chartmogul/config_attributes.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

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

        def set_transactions(transactions_attributes)
          @transactions = transactions_attributes.map.with_index do |transaction_attributes, index|
            existing_transaction = transactions[index]
    
            if existing_transaction
    Severity: Minor
    Found in lib/chartmogul/invoice.rb and 1 other location - About 20 mins to fix
    lib/chartmogul/invoice.rb on lines 37..45

    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 28.

    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 2 locations. Consider refactoring.
    Open

        def set_line_items(line_items_attributes)
          @line_items = line_items_attributes.map.with_index do |line_item_attributes, index|
            existing_line_item = line_items[index]
    
            if existing_line_item
    Severity: Minor
    Found in lib/chartmogul/invoice.rb and 1 other location - About 20 mins to fix
    lib/chartmogul/invoice.rb on lines 50..58

    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 28.

    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 7 locations. Consider refactoring.
    Open

      module Metrics
        class CustomerCount < ChartMogul::Object
          readonly_attr :date, type: :date
          readonly_attr :customers
          readonly_attr :percentage_change
    Severity: Major
    Found in lib/chartmogul/metrics/customer_count.rb and 6 other locations - About 20 mins to fix
    lib/chartmogul/metrics/arpa.rb on lines 4..18
    lib/chartmogul/metrics/arr.rb on lines 4..18
    lib/chartmogul/metrics/asp.rb on lines 4..18
    lib/chartmogul/metrics/customer_churn_rate.rb on lines 4..18
    lib/chartmogul/metrics/ltv.rb on lines 4..18
    lib/chartmogul/metrics/mrr_churn_rate.rb on lines 4..18

    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 27.

    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 7 locations. Consider refactoring.
    Open

      module Metrics
        class LTV < ChartMogul::Object
          readonly_attr :date, type: :date
          readonly_attr :ltv
          readonly_attr :percentage_change
    Severity: Major
    Found in lib/chartmogul/metrics/ltv.rb and 6 other locations - About 20 mins to fix
    lib/chartmogul/metrics/arpa.rb on lines 4..18
    lib/chartmogul/metrics/arr.rb on lines 4..18
    lib/chartmogul/metrics/asp.rb on lines 4..18
    lib/chartmogul/metrics/customer_churn_rate.rb on lines 4..18
    lib/chartmogul/metrics/customer_count.rb on lines 4..18
    lib/chartmogul/metrics/mrr_churn_rate.rb on lines 4..18

    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 27.

    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 7 locations. Consider refactoring.
    Open

      module Metrics
        class ASP < ChartMogul::Object
          readonly_attr :date, type: :date
          readonly_attr :asp
          readonly_attr :percentage_change
    Severity: Major
    Found in lib/chartmogul/metrics/asp.rb and 6 other locations - About 20 mins to fix
    lib/chartmogul/metrics/arpa.rb on lines 4..18
    lib/chartmogul/metrics/arr.rb on lines 4..18
    lib/chartmogul/metrics/customer_churn_rate.rb on lines 4..18
    lib/chartmogul/metrics/customer_count.rb on lines 4..18
    lib/chartmogul/metrics/ltv.rb on lines 4..18
    lib/chartmogul/metrics/mrr_churn_rate.rb on lines 4..18

    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 27.

    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 7 locations. Consider refactoring.
    Open

      module Metrics
        class MRRChurnRate < ChartMogul::Object
          readonly_attr :date, type: :date
          readonly_attr :mrr_churn_rate
          readonly_attr :percentage_change
    Severity: Major
    Found in lib/chartmogul/metrics/mrr_churn_rate.rb and 6 other locations - About 20 mins to fix
    lib/chartmogul/metrics/arpa.rb on lines 4..18
    lib/chartmogul/metrics/arr.rb on lines 4..18
    lib/chartmogul/metrics/asp.rb on lines 4..18
    lib/chartmogul/metrics/customer_churn_rate.rb on lines 4..18
    lib/chartmogul/metrics/customer_count.rb on lines 4..18
    lib/chartmogul/metrics/ltv.rb on lines 4..18

    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 27.

    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 7 locations. Consider refactoring.
    Open

      module Metrics
        class CustomerChurnRate < ChartMogul::Object
          readonly_attr :date, type: :date
          readonly_attr :customer_churn_rate
          readonly_attr :percentage_change
    Severity: Major
    Found in lib/chartmogul/metrics/customer_churn_rate.rb and 6 other locations - About 20 mins to fix
    lib/chartmogul/metrics/arpa.rb on lines 4..18
    lib/chartmogul/metrics/arr.rb on lines 4..18
    lib/chartmogul/metrics/asp.rb on lines 4..18
    lib/chartmogul/metrics/customer_count.rb on lines 4..18
    lib/chartmogul/metrics/ltv.rb on lines 4..18
    lib/chartmogul/metrics/mrr_churn_rate.rb on lines 4..18

    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 27.

    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 7 locations. Consider refactoring.
    Open

      module Metrics
        class ARR < ChartMogul::Object
          readonly_attr :date, type: :date
          readonly_attr :arr
          readonly_attr :percentage_change
    Severity: Major
    Found in lib/chartmogul/metrics/arr.rb and 6 other locations - About 20 mins to fix
    lib/chartmogul/metrics/arpa.rb on lines 4..18
    lib/chartmogul/metrics/asp.rb on lines 4..18
    lib/chartmogul/metrics/customer_churn_rate.rb on lines 4..18
    lib/chartmogul/metrics/customer_count.rb on lines 4..18
    lib/chartmogul/metrics/ltv.rb on lines 4..18
    lib/chartmogul/metrics/mrr_churn_rate.rb on lines 4..18

    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 27.

    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 7 locations. Consider refactoring.
    Open

      module Metrics
        class ARPA < ChartMogul::Object
          readonly_attr :date, type: :date
          readonly_attr :arpa
          readonly_attr :percentage_change
    Severity: Major
    Found in lib/chartmogul/metrics/arpa.rb and 6 other locations - About 20 mins to fix
    lib/chartmogul/metrics/arr.rb on lines 4..18
    lib/chartmogul/metrics/asp.rb on lines 4..18
    lib/chartmogul/metrics/customer_churn_rate.rb on lines 4..18
    lib/chartmogul/metrics/customer_count.rb on lines 4..18
    lib/chartmogul/metrics/ltv.rb on lines 4..18
    lib/chartmogul/metrics/mrr_churn_rate.rb on lines 4..18

    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 27.

    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