henrylawson/photish

View on GitHub

Showing 10 of 10 total issues

Assignment Branch Condition size for create_package is too high. [32.28/20]
Open

def create_package(target, os_type)
  package_dir = package_dir_of(target)
  sh "rm -rf #{package_dir}"
  sh "mkdir -p #{package_dir}/lib/app"
  sh "cp -rf lib #{package_dir}/lib/app/"
Severity: Minor
Found in tasks/build.rake by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Assignment Branch Condition size for create_rpm is too high. [21.02/20]
Open

def create_rpm(binary_dir, architecture, package_architecture)
  package_dir = package_dir_of(package_architecture)
  sh "fpm " + "-s tar " +
              "-t rpm " +
              "--rpm-os linux " +
Severity: Minor
Found in tasks/package.rake by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

        def initialize(color, severity, datetime, progname, msg)
Severity: Minor
Found in lib/photish/log/formatter.rb - About 35 mins to fix

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

          def process_next_image(image_queue)
            image = image_queue.pop
            convert(image) if regenerate?(image)
          rescue Errno::ENOENT
            log.warn "Image not found #{image.path}"
    Severity: Minor
    Found in lib/photish/render/image.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

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

      def self.is_for?(type)
        [
          Photish::Plugin::Type::Collection,
          Photish::Plugin::Type::Album,
          Photish::Plugin::Type::Photo,
    Severity: Minor
    Found in lib/photish/assets/example/site/_plugins/footer_links.rb and 1 other location - About 15 mins to fix
    lib/photish/assets/example/site/_plugins/yell_loud.rb on lines 2..9

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

    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

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

      def self.is_for?(type)
        [
          Photish::Plugin::Type::Collection,
          Photish::Plugin::Type::Album,
          Photish::Plugin::Type::Photo,
    Severity: Minor
    Found in lib/photish/assets/example/site/_plugins/yell_loud.rb and 1 other location - About 15 mins to fix
    lib/photish/assets/example/site/_plugins/footer_links.rb on lines 2..9

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

    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

    Useless assignment to variable - allowed_push_host.
    Open

          allowed_push_host = nil
    Severity: Minor
    Found in tasks/release.rake by rubocop

    This cop checks for every useless assignment to local variable in every scope. The basic idea for this cop was from the warning of ruby -cw:

    assigned but unused variable - foo

    Currently this cop has advanced logic that detects unreferenced reassignments and properly handles varied cases such as branch, loop, rescue, ensure, etc.

    Example:

    # bad
    
    def some_method
      some_var = 1
      do_something
    end

    Example:

    # good
    
    def some_method
      some_var = 1
      do_something(some_var)
    end

    Method Photish::Rake::Task#options= is defined at both lib/photish/rake/task.rb:8 and lib/photish/rake/task.rb:17.
    Open

          def options=(opts)
    Severity: Minor
    Found in lib/photish/rake/task.rb by rubocop

    This cop checks for duplicated instance (or singleton) method definitions.

    Example:

    # bad
    
    def duplicated
      1
    end
    
    def duplicated
      2
    end

    Example:

    # bad
    
    def duplicated
      1
    end
    
    alias duplicated other_duplicated

    Example:

    # good
    
    def duplicated
      1
    end
    
    def other_duplicated
      2
    end

    Method Photish::Gallery::Image#base_url_name is defined at both lib/photish/gallery/image.rb:41 and lib/photish/gallery/image.rb:47.
    Open

          def base_url_name
    Severity: Minor
    Found in lib/photish/gallery/image.rb by rubocop

    This cop checks for duplicated instance (or singleton) method definitions.

    Example:

    # bad
    
    def duplicated
      1
    end
    
    def duplicated
      2
    end

    Example:

    # bad
    
    def duplicated
      1
    end
    
    alias duplicated other_duplicated

    Example:

    # good
    
    def duplicated
      1
    end
    
    def other_duplicated
      2
    end

    Use tr instead of gsub.
    Open

              CGI.escape(word.downcase.gsub(' ', '-')) if word

    This cop identifies places where gsub can be replaced by tr or delete.

    Example:

    # bad
    'abc'.gsub('b', 'd')
    'abc'.gsub('a', '')
    'abc'.gsub(/a/, 'd')
    'abc'.gsub!('a', 'd')
    
    # good
    'abc'.gsub(/.*/, 'a')
    'abc'.gsub(/a+/, 'd')
    'abc'.tr('b', 'd')
    'a b c'.delete(' ')
    Severity
    Category
    Status
    Source
    Language