koppen/mite.cmd

View on GitHub
lib/mite_cmd/application.rb

Summary

Maintainability
B
4 hrs
Test Coverage

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 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 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

    There are no issues that match your filters.

    Category
    Status