tmuxinator/tmuxinator

View on GitHub
lib/tmuxinator/cli.rb

Summary

Maintainability
C
1 day
Test Coverage

File cli.rb has 348 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require "open3"

module Tmuxinator
  class Cli < Thor
    # By default, Thor returns exit(0) when an error occurs.
Severity: Minor
Found in lib/tmuxinator/cli.rb - About 4 hrs to fix

    Complex method Tmuxinator::Cli#new_project_with_session (59.3)
    Open

          def new_project_with_session(name, session)
            if Tmuxinator::Config.version < 1.6
              raise "Creating projects from sessions is unsupported\
                for tmux version 1.5 or lower."
            end
    Severity: Minor
    Found in lib/tmuxinator/cli.rb by flog

    Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

    You can read more about ABC metrics or the flog tool

    Class Cli has 26 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class Cli < Thor
        # By default, Thor returns exit(0) when an error occurs.
        # Please see: https://github.com/tmuxinator/tmuxinator/issues/192
        def self.exit_on_failure?
          true
    Severity: Minor
    Found in lib/tmuxinator/cli.rb - About 3 hrs to fix

      Method new_project_with_session has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def new_project_with_session(name, session)
              if Tmuxinator::Config.version < 1.6
                raise "Creating projects from sessions is unsupported\
                  for tmux version 1.5 or lower."
              end
      Severity: Minor
      Found in lib/tmuxinator/cli.rb - About 1 hr to fix

        Method new_project_with_session has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

              def new_project_with_session(name, session)
                if Tmuxinator::Config.version < 1.6
                  raise "Creating projects from sessions is unsupported\
                    for tmux version 1.5 or lower."
                end
        Severity: Minor
        Found in lib/tmuxinator/cli.rb - About 55 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 delete has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def delete(*projects)
              projects.each do |project|
                if Tmuxinator::Config.exist?(name: project)
                  config = Tmuxinator::Config.project(project)
        
        
        Severity: Minor
        Found in lib/tmuxinator/cli.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

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

              def create_project(project_options = {})
                # Strings provided to --attach are coerced into booleans by Thor.
                # "f" and "false" will result in `:attach` being `false` and any other
                # string or the empty flag will result in `:attach` being `true`.
                # If the flag is not present, `:attach` will be `nil`.
        Severity: Minor
        Found in lib/tmuxinator/cli.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

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

            def copy(existing, new)
              existing_config_path = Tmuxinator::Config.project(existing)
              new_config_path = Tmuxinator::Config.project(new)
        
              exit!("Project #{existing} doesn't exist!") \
        Severity: Minor
        Found in lib/tmuxinator/cli.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

        There are no issues that match your filters.

        Category
        Status