volontariat/voluntary

View on GitHub

Showing 146 of 242 total issues

Method down has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def down
    unless (Product::Recruiting rescue nil)
      create_table 'vacancies', force: true do |t|
        t.string   'type'
        t.integer  'project_id'

    Function letWinnerWinMatchesAgainstCompetitorsWhichLoseAgainstLoser has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          CompetitiveList.prototype.letWinnerWinMatchesAgainstCompetitorsWhichLoseAgainstLoser = function(winnerId, loserId) {
            var base;
            (base = this.defeatedCompetitorsByCompetitor)[loserId] || (base[loserId] = []);
            return $.each(this.matches, (function(_this) {
              return function(index, match) {
    Severity: Minor
    Found in app/assets/javascripts/voluntary/lib/jquery-competitive_list.js - About 1 hr to fix

      Method update has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def update
          if params[:event] && params[:event].keys.select{|k| ['cancel', 'skip'].include?(k)}.any?
            send(params[:event].keys.first)
            return
          end
      Severity: Minor
      Found in app/controllers/workflow/tasks_controller.rb - About 1 hr to fix

        Method gem_dependencies has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def gem_dependencies
                add_source "http://gems.github.com"
                
                # core
                gem 'rack-cors', '~> 0.2.4', require: 'rack/cors'
        Severity: Minor
        Found in lib/generators/voluntary/install/install_generator.rb - About 1 hr to fix

          Method eager_load_polymorphs has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

                    def eager_load_polymorphs(list, includes)
                      polymorphs = {}
                      
                      logger.debug "eager_load_polymorphs for list length: #{list.length}"
                      
          Severity: Minor
          Found in lib/applicat/mvc/controller.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 find_or_create_by_params has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

            def self.find_or_create_by_params(params)
              attributes = (params[:user_list_item] || params[:list_item] || params).clone
              attributes.symbolize_keys! unless params.is_a?(ActiveSupport::HashWithIndifferentAccess)
              
              if attributes[:list_id].present? then List.find(attributes[:list_id])
          Severity: Minor
          Found in app/models/list.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 wizard_steps has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

                    def wizard_steps(*wizard_steps)
                      const_set 'WIZARD_STEPS', wizard_steps
                      
                      # TODO: clarify if we still need to generate actions when we have an update action and next_step trigger
                      "::#{self.to_s}::WIZARD_STEPS".constantize.each do |wizard_step|  
          Severity: Minor
          Found in lib/wizard/controller/concerns/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

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

                CompetitiveList.prototype.sortByMostWins = function(after_update_request_proc) {
                  var $wrapper, data, positions, winsByCompetitor;
                  if (after_update_request_proc == null) {
                    after_update_request_proc = null;
                  }
          Severity: Minor
          Found in app/assets/javascripts/voluntary/lib/jquery-competitive_list.js - About 1 hr to fix

            Method create_from_table has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def create_from_table(model_name, table, extra = {})
                factory_name = model_name.gsub(/\W+/, '_').downcase.singularize.to_sym
                is_singular = model_name.to_s.singularize == model_name.to_s
                
                hashes = if is_singular

              Method path_to has 37 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def path_to(page_name)
                  case page_name
              
                  when /^the home\s?page$/
                    '/'

                Method path_to has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def path_to(page_name)
                    case page_name
                
                    when /^the home\s?page$/
                      '/'

                  Method create_from_table has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def create_from_table(model_name, table, extra = {})
                      factory_name = model_name.gsub(/\W+/, '_').downcase.singularize.to_sym
                      is_singular = model_name.to_s.singularize == model_name.to_s
                      
                      hashes = if is_singular
                  Severity: Minor
                  Found in dummy/features/step_definitions/factory_steps.rb - About 1 hr to fix

                    Method create_from_table has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def create_from_table(model_name, table, extra = {})
                        factory_name = model_name.gsub(/\W+/, '_').downcase.singularize.to_sym
                        is_singular = model_name.to_s.singularize == model_name.to_s
                        
                        hashes = if is_singular

                      Method render has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                              def render(item_container)
                                content, first_item_selected = '', false
                                  
                                item_container.items.each do |item|
                                  next if [
                      Severity: Minor
                      Found in lib/vendors/simple_navigation/renderer/twitter_sidenav.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

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

                            CompetitiveList.prototype.letOutMatchedCompetitorsOfWinnerWinAgainstLoser = function(winnerId, loserId) {
                              var base;
                              (base = this.outmatchedCompetitorsByCompetitor)[winnerId] || (base[winnerId] = []);
                              return $.each(this.outmatchedCompetitorsByCompetitor[winnerId], (function(_this) {
                                return function(index, competitorId) {
                      Severity: Minor
                      Found in app/assets/javascripts/voluntary/lib/jquery-competitive_list.js - About 1 hr to fix

                        Function buildFormatTokens has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          function buildFormatTokens() {
                        
                            createPaddedToken('f', function(d) {
                              return callDateGet(d, 'Milliseconds');
                            }, true);
                        Severity: Minor
                        Found in app/assets/javascripts/voluntary/lib/sugar.js - About 1 hr to fix

                          Method table_cell has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              def table_cell column, resource, alternative_value = nil
                                value = '-'
                                
                                if column == 'name'
                                  value = resource.send(column)
                          Severity: Minor
                          Found in app/helpers/voluntary/collection_helper.rb - About 1 hr to fix

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

                              function createLazyFunction(fn, ms, immediate, limit) {
                                var queue = [], locked = false, execute, rounded, perExecution, result;
                                ms = ms || 1;
                                limit = limit || Infinity;
                                rounded = ceil(ms);
                            Severity: Minor
                            Found in app/assets/javascripts/voluntary/lib/sugar.js - About 1 hr to fix

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

                                    options.sort = function(event, ui) {
                                      var parent = ui.item.parent(),
                                        myIndex = ui.item.data('i'),
                                        top = parseInt(ui.item.css('top').replace('px', '')),
                                        left = parseInt(ui.item.css('left').replace('px', ''));
                              Severity: Minor
                              Found in app/assets/javascripts/voluntary/lib/jquery.multisortable.js - About 1 hr to fix

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

                                  def initialize(user, options = {})
                                    controller_namespace = options[:controller_namespace] || ""
                                    project = options[:project] || nil
                                    
                                    alias_action :index, :show, :autocomplete, :parents, :childs, :tree, to: :read
                                Severity: Minor
                                Found in app/models/ability.rb - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language