volontariat/voluntary_ranking

View on GitHub

Showing 117 of 117 total issues

Method up has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def up
    Product::Ranking.create(name: 'Ranking', text: 'Ranking')
    
    create_table :rankings, force:  true do |t|
      t.string :adjective # best

    Function findMany has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      findMany: function(type, idsOrReferencesOrOpaque, record, relationship) {
        // 1. Determine which of the client ids need to be loaded
        // 2. Create a new ManyArray whose content is ALL of the clientIds
        // 3. Decrement the ManyArray's counter by the number of loaded clientIds
        // 4. Put the ManyArray into our bookkeeping data structure, keyed on
    Severity: Minor
    Found in ember-data.js - About 1 hr to fix

      Function inverseFor has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        inverseFor: function(name) {
          var inverseType = this.typeForRelationship(name);
      
          if (!inverseType) { return null; }
      
      
      Severity: Minor
      Found in ember-data.js - About 1 hr to fix

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

            if (typeof type === 'string') {
              if (type.indexOf(".") === -1) {
                type = store.modelFor(type);
              } else {
                type = get(Ember.lookup, type);
        Severity: Major
        Found in ember-data.js and 1 other location - About 1 hr to fix
        ember-data.js on lines 5137..5143

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

        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 find_or_create_by_params has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

          def self.find_or_create_by_params(params)
            attributes = (params[:user_ranking_item] || params[:ranking_item] || params).clone
            attributes.symbolize_keys! unless params.is_a?(ActiveSupport::HashWithIndifferentAccess)
            
            if attributes[:ranking_id].present? then Ranking.find(attributes[:ranking_id])
        Severity: Minor
        Found in app/models/ranking.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

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

            if (typeof type === 'string') {
              if (type.indexOf(".") === -1) {
                type = store.modelFor(type);
              } else {
                type = get(Ember.lookup, type);
        Severity: Major
        Found in ember-data.js and 1 other location - About 1 hr to fix
        ember-data.js on lines 5255..5261

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

        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 sync has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        DS.RelationshipChangeAdd.prototype.sync = function() {
          var secondRecordName = this.getSecondRecordName(),
              firstRecordName = this.getFirstRecordName(),
              firstRecord = this.getFirstRecord(),
              secondRecord = this.getSecondRecord();
        Severity: Minor
        Found in ember-data.js - About 1 hr to fix

          Function sync has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          DS.RelationshipChangeRemove.prototype.sync = function() {
            var secondRecordName = this.getSecondRecordName(),
                firstRecordName = this.getFirstRecordName(),
                firstRecord = this.getFirstRecord(),
                secondRecord = this.getSecondRecord();
          Severity: Minor
          Found in ember-data.js - About 1 hr to fix

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

              recordBelongsToDidChange: function(dirtySet, child, relationship) {
                var adapter = this.adapterForType(child.constructor);
            
                if (adapter.dirtyRecordsForBelongsToChange) {
                  adapter.dirtyRecordsForBelongsToChange(dirtySet, child, relationship);
            Severity: Major
            Found in ember-data.js and 1 other location - About 1 hr to fix
            ember-data.js on lines 3017..3026

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

            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 (relationship.kind === 'belongsTo') {
                    this._addBelongsTo(data, record, name, relationship);
                  } else if (relationship.kind === 'hasMany') {
                    this._addHasMany(data, record, name, relationship);
                  }
            Severity: Major
            Found in ember-data.js and 1 other location - About 1 hr to fix
            ember-data.js on lines 84..88

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

            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

              recordHasManyDidChange: function(dirtySet, parent, relationship) {
                var adapter = this.adapterForType(parent.constructor);
            
                if (adapter.dirtyRecordsForHasManyChange) {
                  adapter.dirtyRecordsForHasManyChange(dirtySet, parent, relationship);
            Severity: Major
            Found in ember-data.js and 1 other location - About 1 hr to fix
            ember-data.js on lines 3006..3015

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

            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 ajax has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              ajax: function(url, type, hash) {
                var adapter = this;
            
                return new Ember.RSVP.Promise(function(resolve, reject) {
                  hash = hash || {};
            Severity: Minor
            Found in ember-data.js - About 1 hr to fix

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

                    if (relationship.kind === 'belongsTo') {
                      this.deserializeRecordId(data, key, type, value);
                    } else if (relationship.kind === 'hasMany') {
                      this.deserializeRecordIds(data, key, type, value);
                    }
              Severity: Major
              Found in ember-data.js and 1 other location - About 1 hr to fix
              ember-data.js on lines 6497..6501

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

              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 set_candidature_defaults has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                def set_candidature_defaults(attributes)
                  attributes[:user_id] ||= @me.id unless attributes[:user] || attributes[:user_id] || !@me
                  attributes[:vacancy_id] ||= Vacancy.last.id unless attributes[:vacancy_id] || Vacancy.all.none?
                  attributes[:offeror_id] ||= Vacancy.find(attributes[:vacancy_id]).project.user_id if attributes[:vacancy_id]
                end
              Severity: Minor
              Found in dummy/features/step_definitions/candidature_steps.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 index has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def index
                  options = {}
                  
                  if ranking.present?
                    options[:json] = if params[:user_id].present? || params[:user_name].present?
              Severity: Minor
              Found in app/controllers/api/v1/user_ranking_items_controller.rb - About 1 hr to fix

                Function belongsTo has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                DS.belongsTo = function(type, options) {
                  Ember.assert("The first argument DS.belongsTo must be a model type or string, like DS.belongsTo(App.Person)", !!type && (typeof type === 'string' || DS.Model.detect(type)));
                
                  options = options || {};
                
                
                Severity: Minor
                Found in ember-data.js - About 1 hr to fix

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

                    def set_value(hash, attribute)
                      value = hash[attribute]
                      
                      if value.match '@' 
                        if eval(value)
                  Severity: Minor
                  Found in dummy/features/step_definitions/factory_steps.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

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

                    var secondRecordName = this.getSecondRecordName(),
                        firstRecordName = this.getFirstRecordName(),
                        firstRecord = this.getFirstRecord(),
                        secondRecord = this.getSecondRecord();
                  Severity: Minor
                  Found in ember-data.js and 1 other location - About 55 mins to fix
                  ember-data.js on lines 5020..5023

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

                  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

                    var secondRecordName = this.getSecondRecordName(),
                        firstRecordName = this.getFirstRecordName(),
                        firstRecord = this.getFirstRecord(),
                        secondRecord = this.getSecondRecord();
                  Severity: Minor
                  Found in ember-data.js and 1 other location - About 55 mins to fix
                  ember-data.js on lines 5064..5067

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

                  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 (typeof key === 'string' && key !== 'plurals') {
                          var type = Ember.get(Ember.lookup, key);
                          Ember.assert("Could not find model at path " + key, type);
                  
                          reifiedConfigurations.set(type, mapping);
                  Severity: Minor
                  Found in ember-data.js and 1 other location - About 50 mins to fix
                  ember-data.js on lines 7162..7169

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

                  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