crispgm/caravan

View on GitHub

Showing 3 of 32 total issues

Method start has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def start(merged_conf)
      src_path = merged_conf["src"]
      target_path = merged_conf["dst"]
      deploy_mode = merged_conf["deploy_mode"]
      ignores = merged_conf["exclude"]
Severity: Minor
Found in lib/caravan.rb - About 1 hr to fix

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

          def merge(options, conf, spec = Caravan::Config.default_spec_name)
            merged_conf = if conf.nil?
                            Caravan::Message.warn("Fail to load conf. Use default instead.")
                            default_spec_name = Caravan::Config.default_spec_name
                            Caravan::Config.default_conf[default_spec_name]
    Severity: Minor
    Found in lib/caravan/config.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 create_listener has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def create_listener(deployer, src_path)
          Listen.to(src_path) do |modified, added, removed|
            # rubocop:disable Lint/NonLocalExitFromIterator
            return unless deployer.handle_change(modified, added, removed)
            return unless deployer.before_deploy
    Severity: Minor
    Found in lib/caravan.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