koppen/mite.cmd

View on GitHub

Showing 6 of 6 total issues

Class Application has 27 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Application
    TIME_FORMAT = /^(\d+(\.\d+)?:?\+?)|(\d+:\d+\+?)|\+$/
    FLIRTS = [
      'I like your hairstyle.', 'What a nice console you have.', 'My favorite color is red on black, monospaced.',
      "What a lovely operation system this #{`uname`} is.", 'What about dinner tonight?', 'Your keystrokes are tingling.'
Severity: Minor
Found in lib/mite_cmd/application.rb - About 3 hrs to fix

    Method colorize has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

      def colorize(options={})
        return '' if self == ''
        options = {:color => options} if options.is_a?(Symbol)
        options[:color] = :default unless options[:color]
        if options[:color] != :default && options[:color].to_s =~ /^(light|bright)/
    Severity: Minor
    Found in lib/string_ext.rb - About 2 hrs 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 inspect has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

      def inspect
        output = []
        output << formatted_time.colorize(tracking? ? :lightyellow : :lightred)
        output << formatted_revenue.colorize(:lightgreen) if revenue
        output << "\tdoing #{service.name}" if service
    Severity: Minor
    Found in lib/mite_ext.rb - About 1 hr 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 try_to_setup_bash_completion has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def try_to_setup_bash_completion
          bash_code = "\n\n#{MiteCmd::BASH_COMPLETION}"
    
          ['~/.bash_completion', '~/.bash_profile', '~/.bash_login', '~/.bashrc'].each do |file|
            bash_config_file = File.expand_path file
    Severity: Minor
    Found in lib/mite_cmd/application.rb - About 35 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 formatted_time has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def formatted_time
        minutes = tracking? ? tracker.minutes : self.minutes
        if minutes > 59
          h = minutes/60
          m = minutes-h*60
    Severity: Minor
    Found in lib/mite_ext.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_time_entry has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def create_time_entry(arguments)
          attributes = {}
          if time_string = arguments.select { |a| a =~ TIME_FORMAT }.first
            attributes[:minutes] = parse_minutes(time_string)
            start_tracker = (time_string =~ /\+$/)
    Severity: Minor
    Found in lib/mite_cmd/application.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