hardpixel/marv

View on GitHub

Showing 15 of 17 total issues

Class Global has 38 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Global

    attr_accessor :config, :path, :servers, :plugins, :themes, :layouts

    def initialize(task, from_command=false)
Severity: Minor
Found in lib/marv/global.rb - About 5 hrs to fix

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

        class Server
    
          attr_accessor :task, :name, :path, :config, :host, :port, :database, :context
    
          # Initialize server config
    Severity: Minor
    Found in lib/marv/server/server.rb - About 3 hrs to fix

      File global.rb has 254 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      module Marv
        class Global
      
          attr_accessor :config, :path, :servers, :plugins, :themes, :layouts
      
      
      Severity: Minor
      Found in lib/marv/global.rb - About 2 hrs to fix

        Method init_sprockets has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def init_sprockets
                if ExecJS::Runtimes.runtimes.none?(&:available?)
                  @task.say_error "No execjs runtime found! Aborting..."
                  abort
                end
        Severity: Minor
        Found in lib/marv/project/builder/assets.rb - About 1 hr to fix

          Method project_contents has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def self.project_contents
                  assets_path = @project.assets_path.gsub(/#{@project.root}\//, '')
                  source_path = @project.source_path.gsub(/#{@project.root}\//, '')
                  config_file = @project.config_file.gsub(/#{@project.root}\//, '')
          
          
          Severity: Minor
          Found in lib/marv/project/guard.rb - About 1 hr to fix

            Method list has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def list(dir='all')
                    servers = Marv::Global.new(self).servers
            
                    if dir == 'all'
                      say_info "Available marv servers:", true
            Severity: Minor
            Found in lib/marv/cli/server.rb - About 1 hr to fix

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

                    def list(dir='all')
                      servers = Marv::Global.new(self).servers
              
                      if dir == 'all'
                        say_info "Available marv servers:", true
              Severity: Minor
              Found in lib/marv/cli/server.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 create_project_dirs has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                    def create_project_dirs
                      ::Dir.glob(::File.join(@layout, '**', '*')).each do |dir|
                        if ::File.directory?(dir)
                          # Get source and target files
                          source_dir = dir.gsub(@layout, '')
              Severity: Minor
              Found in lib/marv/project/create.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 init_sprockets has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                    def init_sprockets
                      if ExecJS::Runtimes.runtimes.none?(&:available?)
                        @task.say_error "No execjs runtime found! Aborting..."
                        abort
                      end
              Severity: Minor
              Found in lib/marv/project/builder/assets.rb - About 45 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 link_target has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                    def link_target
                      target = link_to_server unless link_to_server.nil?
                      target = link_to_folder unless link_to_folder.nil?
                      target = link_global unless link_global.nil?
              
              
              Severity: Minor
              Found in lib/marv/project/actions.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 stop has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                    def stop(message=true)
                      abort_noexist
                      pid_file = ::File.join(@path, 'php.pid')
              
                      begin
              Severity: Minor
              Found in lib/marv/server/actions.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 build_asset_file has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                    def build_asset_file(asset)
                      destination = ::File.join(@project.build_path, asset)
              
                      @task.shell.mute do
                        sprocket = @sprockets.find_asset(asset.last)
              Severity: Minor
              Found in lib/marv/project/builder/assets.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 generate_config has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def generate_config(from_command=false)
                    if from_command
                      ::File.exists?(config_file) ? reconfigure : configure(from_command)
                    else
                      configure unless ::File.exists?(config_file)
              Severity: Minor
              Found in lib/marv/global.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 _prompt has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                    def _prompt(ending_char)
                      proc do |target_self, nest_level, pry|
                        history    = pry.input_ring.size
                        process    = ::Guard.listener.paused? ? _colorize("pause", :yellow) : _colorize("marv", :green)
                        level      = ":#{nest_level}" unless nest_level.zero?
              Severity: Minor
              Found in lib/marv/project/guard/pry.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 stop has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                    def stop(dir)
                      unless dir == 'all'
                        server = Marv::Server::Server.new(self, dir)
                        action = Marv::Server::Actions.new(server)
                        action.stop
              Severity: Minor
              Found in lib/marv/cli/server.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