SICSoftwareGmbH/acts_as_removable

View on GitHub

Showing 2 of 2 total issues

Method acts_as_removable has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def acts_as_removable(options = {})
      _acts_as_removable_options.merge!(options)

      scope :removed, lambda {
        where(all.table[_acts_as_removable_options[:column_name]].not_eq(nil).to_sql)
Severity: Minor
Found in lib/acts_as_removable.rb - About 1 hr to fix

    Method _update_remove_attribute has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

            def _update_remove_attribute(callback, value, with_bang = false, options = {})
              self.class.transaction do
                run_callbacks callback.to_sym do
                  send("#{self.class._acts_as_removable_options[:column_name]}=", value)
    
    
    Severity: Minor
    Found in lib/acts_as_removable.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

    Severity
    Category
    Status
    Source
    Language