volontariat/voluntary_ranking

View on GitHub

Showing 36 of 117 total issues

Method index has a Cognitive Complexity of 8 (exceeds 5 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 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 set_project_defaults has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def set_project_defaults(attributes)
    attributes[:user_id] ||= @me.id if @me && !attributes[:user_id]
    attributes[:product_id] ||= @product.id if @product && !attributes[:product_id]
    attributes[:area_ids] ||= [Area.last.id] if Area.any? && !attributes[:area_ids]
  end
Severity: Minor
Found in dummy/features/step_definitions/project_steps.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 set_vacancy_defaults has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def set_vacancy_defaults(attributes)
    attributes[:user_id] ||= @me.id unless attributes[:user_id] || !@me
    attributes[:project_id] ||= Project.last.id unless attributes[:project_id] || Project.all.none?
  end
Severity: Minor
Found in dummy/features/step_definitions/vacancy_steps.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

Function removeRelationshipChangeFor has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

  removeRelationshipChangeFor: function(clientReference, childKey, parentReference, parentKey, type) {
Severity: Minor
Found in ember-data.js - About 35 mins to fix

    Function addRelationshipChangeFor has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      addRelationshipChangeFor: function(clientReference, childKey, parentReference, parentKey, change) {
    Severity: Minor
    Found in ember-data.js - About 35 mins to fix

      Function extractEmbeddedHasMany has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        extractEmbeddedHasMany: function(loader, relationship, array, parent, prematerialized) {
      Severity: Minor
      Found in ember-data.js - About 35 mins to fix

        Function extractEmbeddedBelongsTo has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          extractEmbeddedBelongsTo: function(loader, relationship, data, parent, prematerialized) {
        Severity: Minor
        Found in ember-data.js - About 35 mins to fix

          Function dirtyRecordsForAttributeChange has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            dirtyRecordsForAttributeChange: function(dirtySet, record, attributeName, newValue, oldValue) {
          Severity: Minor
          Found in ember-data.js - About 35 mins to fix

            Function relationshipChangeFor has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              relationshipChangeFor: function(clientReference, childKey, parentReference, parentKey, type) {
            Severity: Minor
            Found in ember-data.js - About 35 mins to fix

              Method up has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                def up
                  add_column :vacancies, :resource_type, :string
                  add_column :vacancies, :resource_id, :integer
                  
                  if (Product::Recruiting rescue nil)

              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

              Avoid too many return statements within this function.
              Open

                  return DS.OneToOneChange.createChange(firstRecordReference, secondRecordReference, store, options);
              Severity: Major
              Found in ember-data.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                    return DS.ManyToManyChange.createChange(firstRecordReference, secondRecordReference, store, options);
                Severity: Major
                Found in ember-data.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                      return store.findById(belongsTo.type, belongsTo.id);
                  Severity: Major
                  Found in ember-data.js - About 30 mins to fix

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

                      def down
                        add_column :vacancies, :user_id, :integer
                        
                        if (Product::Recruiting rescue nil)
                          Vacancy.where('resource_type = "User"').update_all('user_id = resource_id')

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

                      def up
                        Product.each do |product|
                          next if product.klass_name.present?
                          
                          if product.name == 'Product'

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

                            def thing=(thing)
                              thing.save if thing.new_record?
                              
                              self.thing_id = thing.id
                              
                    Severity: Minor
                    Found in lib/concerns/model/base_ranking_item.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

                    Severity
                    Category
                    Status
                    Source
                    Language