koraktor/gallerist

View on GitHub

Showing 604 of 604 total issues

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

function directionStr(direction) {
    if (direction == DIRECTION_DOWN) {
        return 'down';
    } else if (direction == DIRECTION_UP) {
        return 'up';
Severity: Major
Found in assets/javascript/hammer.js and 1 other location - About 2 hrs to fix
assets/javascript/hammer.js on lines 1635..1646

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

Assignment Branch Condition size for navbar_for is too high. [17.52/15]
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 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 image_path is too high. [17.58/15]
Open

  def image_path
    if model_resource && !video?
      uuid = model_resource.uuid
      first, second = uuid[0].ord.to_s, uuid[1].ord.to_s

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 prepare is too high. [17.15/15]
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 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 image_path is too high. [16.31/15]
Open

  def image_path
    if model_resource
      id_hex = model_resource.id.to_s 16
      id_prefix = (model_resource.id >> 8).to_s(16).rjust 2, '0'
      file_name = 'fullsizeoutput_%s.%s' % [ id_hex, model_resource.file_ext ]

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

  def __extend
    self.table_name = 'RKPerson'

    has_many :faces, primary_key: 'modelId', foreign_key: 'personId'
    has_one :key_face, class_name: Gallerist::Face.to_s, primary_key: 'representativeFaceId', foreign_key: 'modelId'

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. [11/10]
Open

  def url_for(obj)
    case obj
    when Gallerist::Album
      "/albums/#{obj.id}"
    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.

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

  def __extend
    self.table_name = 'RKDetectedFace'

    alias_attribute :source_height, :height
    alias_attribute :source_width, :width

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.

Function getTouches has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function getTouches(ev, type) {
    var allTouches = toArray(ev.touches);
    var targetIds = this.targetIds;

    // when there is only one touch, the process can be simplified
Severity: Minor
Found in assets/javascript/hammer.js - About 1 hr to fix

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

                } else {
                    direction = (y === 0) ? DIRECTION_NONE : (y < 0) ? DIRECTION_UP : DIRECTION_DOWN;
                    hasMoved = y != this.pY;
                    distance = Math.abs(input.deltaY);
                }
    Severity: Major
    Found in assets/javascript/hammer.js and 1 other location - About 1 hr to fix
    assets/javascript/hammer.js on lines 1788..1792

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

    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

      context 'for a iPhoto library' do
    
        before do
          library.instance_variable_set :@app_id, 'com.apple.iPhoto'
          library.instance_variable_set :@legacy, true
    Severity: Major
    Found in spec/gallerist/library_spec.rb and 1 other location - About 1 hr to fix
    spec/gallerist/library_spec.rb on lines 124..147

    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

      context 'for a legacy Photos library' do
    
        before do
          library.instance_variable_set :@app_id, 'com.apple.Photos'
          library.instance_variable_set :@legacy, true
    Severity: Major
    Found in spec/gallerist/library_spec.rb and 1 other location - About 1 hr to fix
    spec/gallerist/library_spec.rb on lines 96..119

    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

                if (options.direction & DIRECTION_HORIZONTAL) {
                    direction = (x === 0) ? DIRECTION_NONE : (x < 0) ? DIRECTION_LEFT : DIRECTION_RIGHT;
                    hasMoved = x != this.pX;
                    distance = Math.abs(input.deltaX);
                } else {
    Severity: Major
    Found in assets/javascript/hammer.js and 1 other location - About 1 hr to fix
    assets/javascript/hammer.js on lines 1792..1796

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

    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

    Function process has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        process: function(input) {
            var options = this.options;
    
            var validPointers = input.pointers.length === options.pointers;
            var validMovement = input.distance < options.threshold;
    Severity: Minor
    Found in assets/javascript/hammer.js - About 1 hr to fix

      Function computeInputData has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function computeInputData(manager, input) {
          var session = manager.session;
          var pointers = input.pointers;
          var pointersLength = pointers.length;
      
      
      Severity: Minor
      Found in assets/javascript/hammer.js - About 1 hr to fix

        Method setup_library has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        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 - About 1 hr to fix

          Method registered has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          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 - About 1 hr to fix

            Function PEhandler has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                handler: function PEhandler(ev) {
                    var store = this.store;
                    var removePointer = false;
            
                    var eventTypeNormalized = ev.type.toLowerCase().replace('ms', '');
            Severity: Minor
            Found in assets/javascript/hammer.js - About 1 hr to fix

              Function preventDefaults has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  preventDefaults: function(input) {
                      var srcEvent = input.srcEvent;
                      var direction = input.offsetDirection;
              
                      // if the touch action did prevented once this session
              Severity: Minor
              Found in assets/javascript/hammer.js - About 1 hr to fix

                Function recognize has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    recognize: function(inputData) {
                        var session = this.session;
                        if (session.stopped) {
                            return;
                        }
                Severity: Minor
                Found in assets/javascript/hammer.js - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language