volontariat/voluntary

View on GitHub

Showing 146 of 242 total issues

Method table_cell has a Cognitive Complexity of 21 (exceeds 5 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 2 hrs 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 setupInputListenersInput has 71 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function setupInputListenersInput(inputBinding, gmapContext) {
        if (inputBinding) {
            if (inputBinding.radiusInput){
                inputBinding.radiusInput.on("change", function(e) {
                    if (!e.originalEvent) { return }

    Function nextMatch has 71 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          CompetitiveList.prototype.nextMatch = function(from_start) {
            var autoWinnerMatchesHtml, competitorStrings, html, i, modalBodyHtml, modalFooterHtml, modalTitle, radioButtons, rows;
            autoWinnerMatchesHtml = '';
            if (this.currentAutoWinnerMatches.length > 0) {
              this.currentMatch = this.matches[this.currentMatchIndex];
    Severity: Major
    Found in app/assets/javascripts/voluntary/lib/jquery-competitive_list.js - About 2 hrs to fix

      Function updateDate has 68 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        function updateDate(d, params, reset, advance, prefer, weekdayForward) {
          var specificityIndex;
      
          function getParam(key) {
            return isDefined(params[key]) ? params[key] : params[key + 's'];
      Severity: Major
      Found in app/assets/javascripts/voluntary/lib/sugar.js - About 2 hrs to fix

        Method included has 64 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def self.included(base)
            base.extend ClassMethods
            
            base.class_eval do
              include Model::MongoDb::StateVersionAttributes
        Severity: Major
        Found in app/models/state_machines/task.rb - About 2 hrs to fix

          Method included has 61 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  def self.included(base)
                    base.class_eval do
                      has_ancestry :cache_depth => true, :orphan_strategy => :rootify
          
                      acts_as_list
          Severity: Major
          Found in lib/applicat/mvc/model/tree.rb - About 2 hrs to fix

            Function moveCompetitorToPosition has 61 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  CompetitiveList.prototype.moveCompetitorToPosition = function(competitorId, position, after_update_request_proc) {
                    var defeatedCompetitor, outmatchedCompetitor, positionOfdefeatedCompetitor, positions;
                    if (after_update_request_proc == null) {
                      after_update_request_proc = null;
                    }
            Severity: Major
            Found in app/assets/javascripts/voluntary/lib/jquery-competitive_list.js - About 2 hrs to fix

              File navigation.rb has 267 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              module Voluntary
                module Navigation
                  class Base
                    @@products = {}
                    @@core_menus = [:areas, :products, :organizations, :projects, :users, :workflow, :authentication]
              Severity: Minor
              Found in lib/voluntary/navigation.rb - About 2 hrs to fix

                Function runTagReplacements has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  function runTagReplacements(str, reg, strip, replacementFn, fullString) {
                
                    var match;
                    var result = '';
                    var currentIndex = 0;
                Severity: Major
                Found in app/assets/javascripts/voluntary/lib/sugar.js - About 2 hrs to fix

                  Function api has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      function api (key, value, attributes) {
                        var result;
                  
                        // Write
                  
                  
                  Severity: Major
                  Found in app/assets/javascripts/voluntary/lib/jquery.cookie.js - About 2 hrs to fix

                    Method included has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def self.included(base)
                        base.extend ClassMethods
                        
                        base.class_eval do
                          include Model::MongoDb::StateVersionAttributes
                    Severity: Major
                    Found in app/models/state_machines/story.rb - About 2 hrs to fix

                      Method included has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                      Open

                                def self.included(base)
                                  base.class_eval do
                                    cattr_reader :per_page
                                    @@per_page = 20
                        
                      Severity: Minor
                      Found in lib/applicat/mvc/model/resource/base.rb - About 2 hrs 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 addFormat has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          addFormat: function(src, allowsTime, match, variant, iso) {
                            var to = match || [], loc = this, time, timeMarkers, lastIsNumeral;
                      
                            src = src.replace(/\s+/g, '[,. ]*');
                            src = src.replace(/\{([^,]+?)\}/g, function(all, k) {
                      Severity: Major
                      Found in app/assets/javascripts/voluntary/lib/sugar.js - About 2 hrs to fix

                        Function mouseDown has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            function mouseDown(e) {
                              var item = $(this),
                                parent = item.parent(),
                                myIndex = item.index();
                        
                        
                        Severity: Minor
                        Found in app/assets/javascripts/voluntary/lib/jquery.multisortable.js - About 1 hr to fix

                          Function every has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              'every': function(amount, fn) {
                                var increment,
                                    precision,
                                    dio,
                                    unit,
                          Severity: Minor
                          Found in app/assets/javascripts/voluntary/lib/sugar.js - About 1 hr to fix

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

                                  def gem_dependencies
                                    create_file 'Gemfile', ''
                                    
                                    append_file 'Gemfile', :verbose => true do
                                      <<-EOH
                            Severity: Minor
                            Found in lib/generators/voluntary/product_dummy/product_dummy_generator.rb - About 1 hr to fix

                              Function buildStartEndsWith has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                function buildStartEndsWith() {
                                  var override = true;
                                  try {
                                    // If String#startsWith does not exist or alternately if it exists but
                                    // correctly throws an error here, then there is no need to flag the
                              Severity: Minor
                              Found in app/assets/javascripts/voluntary/lib/sugar.js - About 1 hr to fix

                                Method transition_actions has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    def transition_actions(*actions)
                                      actions = actions.first.is_a?(Symbol) ? actions : actions.first
                                      
                                      actions.each do |action|  
                                        define_method action do
                                Severity: Minor
                                Found in lib/applicat/mvc/controller/transition_actions.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 create has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                                Open

                                  def create
                                    build_resource(params[:user])
                                
                                    captcha_verified = if Rails.env == 'production'
                                      verify_recaptcha(model: resource, message: I18n.t('general.exceptions.wrong_recaptcha'))
                                Severity: Minor
                                Found in app/controllers/devise_extensions/registrations_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 path_to has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  def path_to(page_name)
                                    case page_name
                                
                                    when /^the home\s?page$/
                                      '/'
                                Severity: Minor
                                Found in dummy/features/support/paths.rb - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language