volontariat/voluntary

View on GitHub

Showing 146 of 242 total issues

Function extendSimilar has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

  function extendSimilar(klass, set, fn, instance, polyfill, override) {
Severity: Minor
Found in app/assets/javascripts/voluntary/lib/sugar.js - About 45 mins to fix

    Method create_with_topic has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.create_with_topic(user_id, attributes)
        topic = ArgumentTopic.find_or_create_by_name attributes[:topic_name]
        
        if topic.valid?
          argumentable_id = if attributes[:argumentable_name].present?
    Severity: Minor
    Found in app/models/argument.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 updateDate has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      function updateDate(d, params, reset, advance, prefer, weekdayForward) {
    Severity: Minor
    Found in app/assets/javascripts/voluntary/lib/sugar.js - About 45 mins to fix

      Function abbreviateNumber has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        function abbreviateNumber(num, roundTo, str, mid, limit, bytes) {
      Severity: Minor
      Found in app/assets/javascripts/voluntary/lib/sugar.js - About 45 mins to fix

        Consider simplifying this complex logical expression.
        Open

              if (obj.start && obj.end) {
                return obj.start >= this.start && obj.start <= this.end &&
                       obj.end   >= this.start && obj.end   <= this.end;
              } else {
                return obj >= this.start && obj <= this.end;
        Severity: Major
        Found in app/assets/javascripts/voluntary/lib/sugar.js - About 40 mins to fix

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

            function extend(klass, methods, instance, polyfill, override) {
          Severity: Minor
          Found in app/assets/javascripts/voluntary/lib/sugar.js - About 35 mins to fix

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

              function runTagReplacements(str, reg, strip, replacementFn, fullString) {
            Severity: Minor
            Found in app/assets/javascripts/voluntary/lib/sugar.js - About 35 mins to fix

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

                function setDelay(fn, ms, after, scope, args) {
              Severity: Minor
              Found in app/assets/javascripts/voluntary/lib/sugar.js - About 35 mins to fix

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

                  function truncateString(str, length, from, ellipsis, split) {
                Severity: Minor
                Found in app/assets/javascripts/voluntary/lib/sugar.js - About 35 mins to fix

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

                      addFormat: function(src, allowsTime, match, variant, iso) {
                  Severity: Minor
                  Found in app/assets/javascripts/voluntary/lib/sugar.js - About 35 mins to fix

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

                      function createDate(contextDate, f, localeCode, prefer, forceUTC) {
                    Severity: Minor
                    Found in app/assets/javascripts/voluntary/lib/sugar.js - About 35 mins to fix

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

                        function getExtendedDate(contextDate, f, localeCode, prefer, forceUTC) {
                      Severity: Minor
                      Found in app/assets/javascripts/voluntary/lib/sugar.js - About 35 mins to fix

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

                          function compareDate(d, find, localeCode, buffer, forceUTC) {
                        Severity: Minor
                        Found in app/assets/javascripts/voluntary/lib/sugar.js - About 35 mins to fix

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

                            function entryAtIndex(obj, length, index, overshoot, isString) {
                          Severity: Minor
                          Found in app/assets/javascripts/voluntary/lib/sugar.js - About 35 mins to fix

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

                              def next
                                story = Story.find(params[:story_id])
                                task = story.next_task_for_user(current_user)
                                product_id = story.product_id.blank? ? 'no-name' : story.product_id
                                
                            Severity: Minor
                            Found in app/controllers/workflow/tasks_controller.rb - About 35 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 access_denied has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                            Open

                                  def access_denied
                                    message = I18n.t('general.exceptions.access_denied')
                                    
                                    if request.format.try('json?') || request.xhr?
                                      render status: 403, json: { error: message } and return
                            Severity: Minor
                            Found in app/controllers/concerns/voluntary/v1/base_controller.rb - About 35 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 build_result has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def build_result
                                result_params = params[:task] ? params[:task].delete(:result_attributes) : nil
                                result_params = result_params || {}
                                
                                unless resource.result_id.present?
                            Severity: Minor
                            Found in app/controllers/workflow/tasks_controller.rb - About 35 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 languages has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def self.languages(query = nil)
                                options = []
                                
                                AVAILABLE_LANGUAGES.merge(OTHER_LANGUAGES).each do |locale, language|
                                  next if query && !language.downcase.match(query.downcase)
                            Severity: Minor
                            Found in app/models/user.rb - About 35 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 exception_action has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                            Open

                                      def exception_action(exception)
                                        @exception_catched = true
                                        
                                        if Rails.env == 'production'
                                          notify_airbrake(exception)
                            Severity: Minor
                            Found in lib/applicat/mvc/controller.rb - About 35 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 search has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def self.search(term, known_things)
                                begin
                                  JSON.parse(
                                    HTTParty.get(
                                      "https://www.wikidata.org/w/api.php?action=wbsearchentities&search=" +
                            Severity: Minor
                            Found in app/models/wikidata.rb - About 35 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