CartoDB/cartodb20

View on GitHub
services/user-mover/legacy_functions.rb

Summary

Maintainability
F
1 wk
Test Coverage

File legacy_functions.rb has 2551 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module CartoDB
  module DataMover
    module LegacyFunctions
      # functions taken from https://github.com/postgis/postgis/blob/svn-trunk/utils/postgis_restore.pl.in#L473
      SIGNATURE_RE = /[\d\s;]*(?<type>(?:\S+\s?['class'|'family'|'aggregate'|'domain'|'function'|'cast'|'type']*))\s+(?:[^\s]\s+)?(?<name>[^\(]+)\s*(?:\((?<arguments>.*)\))?/i
Severity: Major
Found in services/user-mover/legacy_functions.rb - About 1 wk to fix

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

          def remove_line?(line)
            arguments, name, type = matches(line)
            return true if type == 'ACL' && legacy_functions.flat_map { |_, v| v[name] }.compact.include?(arguments)
            return false unless legacy_functions[type]
            return false unless legacy_functions[type][name]
    Severity: Minor
    Found in services/user-mover/legacy_functions.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

    There are no issues that match your filters.

    Category
    Status