Showing 8 of 8 total issues
Class Pivotal
has 39 methods (exceeds 20 allowed). Consider refactoring. Open
class Pivotal < Base
include PivoFlow::State
def run
PivotalTracker::Client.token = @options["api-token"]
Method parse_argv
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_argv(args)
@options = {}
opt_parser = OptionParser.new do |opts|
opts.banner = "\nPivoFlow ver. #{PivoFlow::VERSION}\nUsage: pf <COMMAND> [OPTIONS]\n"
Method show_story
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def show_story story_id
story = find_story(story_id)
show_info story
ask_for = story.current_state == "finished" ? "deliver" : "start"
proceed = ask_question "Do you want to #{ask_for} this story?"
- 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
Avoid too many return
statements within this method. Open
return 0
Method install_git_hook
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def install_git_hook
puts "Installing prepare-commit-msg hook..."
FileUtils.mkdir_p(File.dirname(@pf_git_hook_path))
FileUtils.cp(@pf_git_hook_local_path, @pf_git_hook_path, preserve: true)
puts "File copied..."
- 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 story_color
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def story_color story
if users_story?(story)
case story.story_type
when "feature" then :green
when "bug" then :red
- 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 show_info
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def show_info story=nil
story = story || current_story
if story.nil?
puts "No story, no worry..."
return 1
- 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 current_story
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def current_story force = false
if (@options[:current_story] && !force)
@options[:current_story]
else
@options[:current_story] = user_stories.count.zero? ? nil : user_stories.first
- 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"