koraktor/gallerist

View on GitHub

Showing 604 of 604 total issues

File hammer.js has 1509 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*! Hammer.JS - v2.0.7 - 2016-04-22
 * http://hammerjs.github.io/
 *
 * Copyright (c) 2016 Jorik Tangelder;
 * Licensed under the MIT license */
Severity: Major
Found in assets/javascript/hammer.js - About 4 days to fix

    Block has too many lines. [139/25]
    Open

    describe Gallerist::Library do
    
      let :library do
        db_path = '/some/library.photoslibrary/Database/Library.apdb'
        allow(File).to receive(:realpath).and_return db_path
    Severity: Minor
    Found in spec/gallerist/library_spec.rb by rubocop

    This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

    Class has too many lines. [101/100]
    Open

    class Gallerist::App < Sinatra::Base
    
      autoload :BaseExtensions, 'gallerist/app/base_extensions'
      autoload :Configuration, 'gallerist/app/configuration'
      autoload :Helpers, 'gallerist/app/helpers'
    Severity: Minor
    Found in lib/gallerist/app.rb by rubocop

    This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Assignment Branch Condition size for registered is too high. [54.46/15]
    Open

      def self.registered(_)
        configure do
          set :logging, ENV['VERBOSE'] ? ::Logger::WARN : ::Logger::INFO
    
          tempdir = Dir.mktmpdir('gallerist')
    Severity: Minor
    Found in lib/gallerist/app/configuration.rb 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 setup_library is too high. [48.35/15]
    Open

      def setup_library
        library = Gallerist::Library.new settings.library_path
        settings.set :library, library
    
        logger.info "Loading library from \"#{library.path}\""
    Severity: Minor
    Found in lib/gallerist/app/utilities.rb 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

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

        if (metadata.persons.length) {
          metadata.persons.forEach(function(person, index) {
            if (index) {
              persons.append(', ')
            }
    Severity: Major
    Found in assets/javascript/main.js and 1 other location - About 4 hrs to fix
    assets/javascript/main.js on lines 241..251

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

    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

        if (metadata.tags.length) {
          metadata.tags.forEach(function(tag, index) {
            if (index) {
              tags.append(', ')
            }
    Severity: Major
    Found in assets/javascript/main.js and 1 other location - About 4 hrs to fix
    assets/javascript/main.js on lines 229..239

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

    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 has too many lines. [34/10]
    Open

      def setup_library
        library = Gallerist::Library.new settings.library_path
        settings.set :library, library
    
        logger.info "Loading library from \"#{library.path}\""
    Severity: Minor
    Found in lib/gallerist/app/utilities.rb by rubocop

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Method has too many lines. [31/10]
    Open

      def self.registered(_)
        configure do
          set :logging, ENV['VERBOSE'] ? ::Logger::WARN : ::Logger::INFO
    
          tempdir = Dir.mktmpdir('gallerist')
    Severity: Minor
    Found in lib/gallerist/app/configuration.rb by rubocop

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

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

        init: function() {
            this.evEl && addEventListeners(this.element, this.evEl, this.domHandler);
            this.evTarget && addEventListeners(this.target, this.evTarget, this.domHandler);
            this.evWin && addEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);
        },
    Severity: Major
    Found in assets/javascript/hammer.js and 1 other location - About 3 hrs to fix
    assets/javascript/hammer.js on lines 457..461

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

    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

        destroy: function() {
            this.evEl && removeEventListeners(this.element, this.evEl, this.domHandler);
            this.evTarget && removeEventListeners(this.target, this.evTarget, this.domHandler);
            this.evWin && removeEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);
        }
    Severity: Major
    Found in assets/javascript/hammer.js and 1 other location - About 3 hrs to fix
    assets/javascript/hammer.js on lines 448..452

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

    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 has too many lines. [24/10]
    Open

      def navbar_for(obj)
        @navbar = []
        navbar_item library.name, '/'
    
        case obj
    Severity: Minor
    Found in lib/gallerist/app/utilities.rb by rubocop

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Assignment Branch Condition size for widget_for is too high. [26.19/15]
    Open

      def widget_for(obj)
        classes = %w{label label-primary}
    
        case obj
        when Gallerist::Person
    Severity: Minor
    Found in lib/gallerist/app/helpers.rb 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

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

      photoModal.find('.modal-next').click(function() {
        var currentUrl = $('#photo-modal').data('current-url');
        pauseVideo();
        $("a[href='" + currentUrl + "']").parent().next().find('a.thumbnail').click();
      });
    Severity: Major
    Found in assets/javascript/main.js and 1 other location - About 2 hrs to fix
    assets/javascript/main.js on lines 153..157

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

    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

      photoModal.find('.modal-prev').click(function() {
        var currentUrl = $('#photo-modal').data('current-url');
        pauseVideo();
        $("a[href='" + currentUrl + "']").parent().prev().find('a.thumbnail').click();
      });
    Severity: Major
    Found in assets/javascript/main.js and 1 other location - About 2 hrs to fix
    assets/javascript/main.js on lines 147..151

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

    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 has too many lines. [20/10]
    Open

      def widget_for(obj)
        classes = %w{label label-primary}
    
        case obj
        when Gallerist::Person
    Severity: Minor
    Found in lib/gallerist/app/helpers.rb by rubocop

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Block has too many lines. [55/25]
    Open

    describe MultiTag do
    
      let(:library) { double }
      let(:tag_names) { %w{tag-1 tag2} }
    
    
    Severity: Minor
    Found in spec/gallerist/multi_tag_spec.rb by rubocop

    This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

    Method has too many lines. [17/10]
    Open

      def self.prepare
        return if @logging_prepared
    
        if Gallerist.options[:log_dir]
          @log_dir = File.expand_path Gallerist.options[:log_dir]
    Severity: Minor
    Found in lib/gallerist/logging.rb by rubocop

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Cyclomatic complexity for navbar_for is too high. [10/6]
    Open

      def navbar_for(obj)
        @navbar = []
        navbar_item library.name, '/'
    
        case obj
    Severity: Minor
    Found in lib/gallerist/app/utilities.rb by rubocop

    This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

    An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

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

    function stateStr(state) {
        if (state & STATE_CANCELLED) {
            return 'cancel';
        } else if (state & STATE_ENDED) {
            return 'end';
    Severity: Major
    Found in assets/javascript/hammer.js and 1 other location - About 2 hrs to fix
    assets/javascript/hammer.js on lines 1653..1664

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

    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