volontariat/voluntary

View on GitHub

Showing 242 of 242 total issues

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

Avoid too many return statements within this function.
Open

                    return this;
Severity: Major
Found in app/assets/javascripts/voluntary/optional_lib/jquery.location_picker.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

        return defaultMatcher(f);
    Severity: Major
    Found in app/assets/javascripts/voluntary/lib/sugar.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

            return -1;
      Severity: Major
      Found in app/assets/javascripts/voluntary/lib/sugar.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                                return {
                                    map: gmapContext.map,
                                    marker: gmapContext.marker,
                                    location: locationObj
                                }
        Severity: Major
        Found in app/assets/javascripts/voluntary/optional_lib/jquery.location_picker.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                                  return null;
          Severity: Major
          Found in app/assets/javascripts/voluntary/optional_lib/jquery.location_picker.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return this.each(function() {
                        var $target = $(this);
                        // If plug-in hasn't been applied before - initialize, otherwise - skip
                        if (isPluginApplied(this)){
                          updateMap(getContextForElement(this), $(this), options);
            Severity: Major
            Found in app/assets/javascripts/voluntary/optional_lib/jquery.location_picker.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                    return 0;
              Severity: Major
              Found in app/assets/javascripts/voluntary/lib/sugar.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                            return null;
                Severity: Major
                Found in app/assets/javascripts/voluntary/optional_lib/jquery.location_picker.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return 0;
                  Severity: Major
                  Found in app/assets/javascripts/voluntary/lib/sugar.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                          return fuzzyMatcher(f, isObject);
                    Severity: Major
                    Found in app/assets/javascripts/voluntary/lib/sugar.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                            return el[map];
                      Severity: Major
                      Found in app/assets/javascripts/voluntary/lib/sugar.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                              return 1;
                        Severity: Major
                        Found in app/assets/javascripts/voluntary/lib/sugar.js - About 30 mins to fix

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

                            create_table "professions", force: :cascade do |t|
                              t.string   "name",       limit: 255
                              t.string   "slug",       limit: 255
                              t.datetime "created_at",             null: false
                              t.datetime "updated_at",             null: false
                          Severity: Minor
                          Found in dummy/db/schema.rb and 1 other location - About 30 mins to fix
                          dummy/db/schema.rb on lines 123..128

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

                          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

                            create_table "lists", force: :cascade do |t|
                              t.integer  "user_id",    limit: 4
                              t.string   "name",       limit: 255
                              t.datetime "created_at",             null: false
                              t.datetime "updated_at",             null: false
                          Severity: Minor
                          Found in dummy/db/schema.rb and 1 other location - About 30 mins to fix
                          dummy/db/schema.rb on lines 153..158

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

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

                              def show_association(association)
                                if association.to_s == association.to_s.pluralize
                                  return show_attribute(
                                    association,
                                    title: t("#{association}.index.title"), 
                          Severity: Minor
                          Found in app/helpers/voluntary/show_helper.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

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

                                    def set_i18n_locale_from_params
                                      if params[:locale]
                                        if I18n.available_locales.include?(params[:locale].to_sym)
                                          I18n.locale = params[:locale]
                                        else
                          Severity: Minor
                          Found in lib/applicat/mvc/controller.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