themejuice/tj

View on GitHub

Showing 21 of 21 total issues

Method init_project has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def init_project
        @project.use_defaults     = @opts.fetch("use_defaults")     { false }
        @project.bare             = @opts.fetch("bare")             { false }
        @project.skip_repo        = @opts.fetch("skip_repo")        { false }
        @project.skip_db          = @opts.fetch("skip_db")          { false }
Severity: Minor
Found in lib/theme-juice/commands/create.rb - About 1 hr to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

      module Tasks
        class VMRestart < Task
    
          def initialize(opts = {})
            super
    Severity: Major
    Found in lib/theme-juice/tasks/vm_restart.rb and 1 other location - About 1 hr to fix
    lib/theme-juice/tasks/vm_provision.rb on lines 4..37

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 61.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

      module Tasks
        class VMProvision < Task
    
          def initialize(opts = {})
            super
    Severity: Major
    Found in lib/theme-juice/tasks/vm_provision.rb and 1 other location - About 1 hr to fix
    lib/theme-juice/tasks/vm_restart.rb on lines 4..37

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 61.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Method initialize has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def initialize(opts = {})
            super
    
            init_project
    
    
    Severity: Minor
    Found in lib/theme-juice/commands/create.rb - About 1 hr to fix

      Method command has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def command(cmd, *args)
            return if @project.no_config
      
            args.map { |arg|
              arg.reject! { |a| /^-/ =~ a } if arg.is_a?(Array) }
      Severity: Minor
      Found in lib/theme-juice/config.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 read_key has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def read_key
            $stdin.noecho do |io|
              io.raw!
      
              key = io.getc.chr
      Severity: Minor
      Found in lib/theme-juice/io.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 run_inside_vm has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

            def run_inside_vm(command, config = {}, &block)
              inside @env.vm_path do
                if command.is_a? Array
                  yield command if block_given?
                  _run %Q[vagrant ssh -c "#{command.join(" && ")}"], config
      Severity: Minor
      Found in lib/theme-juice/util.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 modify_wp_config_settings has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

            def modify_wp_config_settings(settings)
              if @using_wp_config_sample
                @io.log "Creating wp-config file from sample"
              else
                return unless @io.agree? "Do you want to modify your current wp-config settings?"
      Severity: Minor
      Found in lib/theme-juice/tasks/wp_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 execute has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

            def execute
              return if !@project.wp_config_modify || @project.no_wp || @project.no_db
      
              unless wp_config_is_setup?
                @io.say "Could not find wp-config file to modify", {
      Severity: Minor
      Found in lib/theme-juice/tasks/wp_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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

              execute :wp, :db, :import, "#{fetch(:tmp_dir)}/#{fetch(:vm_db)}"
              execute :rm, "#{fetch(:tmp_dir)}/#{fetch(:vm_db)}"
              execute :wp, "search-replace", fetch(:vm_url), fetch(:stage_url), fetch(:wpcli_args) || "--skip-columns=guid --all-tables"
            end
      Severity: Minor
      Found in lib/theme-juice/tasks/capistrano/db.rb and 1 other location - About 35 mins to fix
      lib/theme-juice/tasks/capistrano/db.rb on lines 82..85

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 34.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

              execute :wp, :db, :import, "#{fetch(:vm_backup_dir)}/#{fetch(:remote_db)}"
              execute :rm, "#{fetch(:vm_backup_dir)}/#{fetch(:remote_db)}"
              execute :wp, "search-replace", fetch(:stage_url), fetch(:vm_url), fetch(:wpcli_args) || "--skip-columns=guid --all-tables"
            end
      Severity: Minor
      Found in lib/theme-juice/tasks/capistrano/db.rb and 1 other location - About 35 mins to fix
      lib/theme-juice/tasks/capistrano/db.rb on lines 53..56

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 34.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Method update_box has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def update_box
              return unless box_is_installed?
      
              @io.log "Updating Vagrant box"
              @util.inside @env.vm_path do
      Severity: Minor
      Found in lib/theme-juice/tasks/vm_update_box.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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def initialize(opts = {})
              super
      
              init_project
      
      
      Severity: Minor
      Found in lib/theme-juice/commands/delete.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 url has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def url
              url =
                begin
                  raise NoMethodError unless @config.exist?
                  @io.say "Inferred project url '#{@config.project.url}' from existing config...", {
      Severity: Minor
      Found in lib/theme-juice/commands/create.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 invoke_capistrano has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def invoke_capistrano
              @io.log "Invoking Capistrano"
      
              @env.cap.invoke "load:defaults"
              @env.cap.invoke "load:settings"
      Severity: Minor
      Found in lib/theme-juice/tasks/invoke.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 name has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def name
              name =
                begin
                  raise NoMethodError unless @config.exist?
                  @io.say "Inferred project name '#{@config.project.name}' from existing config...", {
      Severity: Minor
      Found in lib/theme-juice/commands/create.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 configure_required_settings has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def configure_required_settings
              begin
                set :application, @config.project.name
              rescue NoMethodError
                @io.notice "Deprecation Notice: 'config.deployment.application.name' has been deprecated! Please use 'config.project.name' instead."
      Severity: Minor
      Found in lib/theme-juice/tasks/settings.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 run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def run(command, config = {}, &block)
              if command.is_a? Array
                yield command if block_given?
                _run command.join(" && "), config
              else
      Severity: Minor
      Found in lib/theme-juice/util.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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def initialize(opts = {})
              super
      
              init_project
      
      
      Severity: Minor
      Found in lib/theme-juice/commands/create.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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

                execute :tar, "--no-overwrite-dir -zxf", "#{fetch(:vm_tmp_dir)}/#{fetch(:dir_archive)}", "#{args[:dir]}/"
                execute :rm, "#{fetch(:vm_tmp_dir)}/#{fetch(:dir_archive)}"
      Severity: Minor
      Found in lib/theme-juice/tasks/capistrano/dir.rb and 1 other location - About 20 mins to fix
      lib/theme-juice/tasks/capistrano/dir.rb on lines 42..43

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 28.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Severity
      Category
      Status
      Source
      Language