Showing 7 of 22 total issues

Method parser has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def parser # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
      OptionParser.new do |opts|
        opts.banner = banner_usages + "\nOptions:"

        opts.on('-m', '--machine MACHINE', 'Target Vagrant machine(s).',
Severity: Minor
Found in lib/avsh/argument_parser.rb - About 1 hr to fix

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

        def collect_folders_by_machine
          if @machine_synced_folders.empty?
            { 'default' => default_synced_folders }
          else
            folders = @machine_synced_folders.map do |name, synced_folders|
    Severity: Minor
    Found in lib/avsh/parsed_config.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 match_machines! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def match_machines!(search_string)
          machines =
            if (pattern = search_string[%r{^/(.+?)/$}, 1])
              match_machines_by_regexp(pattern)
            elsif search_string.include? ','
    Severity: Minor
    Found in lib/avsh/parsed_config.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 find has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def find(host_directory)
          start_directory = File.expand_path(@vagrant_cwd || host_directory)
          cur_directory = start_directory
          filenames = filenames_to_check
    
    
    Severity: Minor
    Found in lib/avsh/vagrantfile_finder.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 merge_with_defaults has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def merge_with_defaults(synced_folders)
          default_synced_folders.tap do |merged|
            synced_folders.each do |guest_path, opts|
              if opts[:disabled]
                merged.delete(guest_path)
    Severity: Minor
    Found in lib/avsh/parsed_config.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 match has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def match(host_directory, machine_search_string = nil)
          real_host_directory = File.expand_path(host_directory)
          synced_folders_by_machine = @vagrant_config.collect_folders_by_machine
    
          if machine_search_string
    Severity: Minor
    Found in lib/avsh/machine_guest_dir_matcher.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 execute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def execute(command, guest_directory = nil, interactive = true,
                    user_ssh_options = '')
          if command.empty?
            # No command, so run a login shell
            command = 'exec $SHELL -l'
    Severity: Minor
    Found in lib/avsh/ssh_command_executor.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