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.
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
- Read upRead up
- Exclude checks
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
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
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
- Read upRead up
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)
- Read upRead up
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`.
- Read upRead up
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!") \
- Read upRead up
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"