historyforge/historyforge

View on GitHub

Showing 347 of 347 total issues

Avoid too many return statements within this function.
Open

      return criteria && predicate && <span> {scopes[predicate]} {criteria}</span>
Severity: Major
Found in app/javascript/forge/CensusSearch/FilterListItem.jsx - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

        return { ...state, building: null, highlighted: null }
    Severity: Major
    Found in app/javascript/forge/reducers/buildings.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

        return state
      Severity: Major
      Found in app/javascript/forge/reducers/buildings.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

            return forgeRemoveFilter(state, action)
        Severity: Major
        Found in app/javascript/forge/reducers/search.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

              return forgeAddFilter(state, action)
          Severity: Major
          Found in app/javascript/forge/reducers/search.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                return { ...state, active: false, layeredAt: new Date().getTime() };
            Severity: Major
            Found in app/javascript/forge/reducers/layers.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                  return forgeSetFilter(state, action)
              Severity: Major
              Found in app/javascript/forge/reducers/search.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                  return state
                Severity: Major
                Found in app/javascript/forge/reducers/layers.js - About 30 mins to fix

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

                                }, historyRedo: function() {
                                  var t3;
                                  return (t3 = this.delegate) != null ? t3.inputControllerWillPerformRedo() : void 0;
                                }, historyUndo: function() {
                  Severity: Minor
                  Found in app/assets/builds/richtext.js and 1 other location - About 30 mins to fix
                  app/assets/builds/richtext.js on lines 2243..2246

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

                  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

                                }, historyUndo: function() {
                                  var t3;
                                  return (t3 = this.delegate) != null ? t3.inputControllerWillPerformUndo() : void 0;
                                }, insertCompositionText: function() {
                  Severity: Minor
                  Found in app/assets/builds/richtext.js and 1 other location - About 30 mins to fix
                  app/assets/builds/richtext.js on lines 2240..2243

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

                  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 3 locations. Consider refactoring.
                  Open

                    def destroy
                      @locality = Locality.find params[:id]
                      if @locality.destroy
                        flash[:notice] = 'Deleted the locality.'
                        redirect_to action: :index
                  Severity: Minor
                  Found in app/controllers/localities_controller.rb and 2 other locations - About 25 mins to fix
                  app/controllers/street_conversions_controller.rb on lines 44..52
                  app/controllers/user_groups_controller.rb on lines 40..48

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

                  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 3 locations. Consider refactoring.
                  Open

                    def destroy
                      @street_conversion = StreetConversion.find params[:id]
                      if @street_conversion.destroy
                        flash[:notice] = 'Deleted the street conversion.'
                        redirect_to action: :index
                  Severity: Minor
                  Found in app/controllers/street_conversions_controller.rb and 2 other locations - About 25 mins to fix
                  app/controllers/localities_controller.rb on lines 54..62
                  app/controllers/user_groups_controller.rb on lines 40..48

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

                  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 3 locations. Consider refactoring.
                  Open

                    def destroy
                      @user_group = UserGroup.find params[:id]
                      if @user_group.destroy
                        flash[:notice] = 'Deleted the user group.'
                        redirect_to action: :index
                  Severity: Minor
                  Found in app/controllers/user_groups_controller.rb and 2 other locations - About 25 mins to fix
                  app/controllers/localities_controller.rb on lines 54..62
                  app/controllers/street_conversions_controller.rb on lines 44..52

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

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

                      def self.matches_for(name, gender = nil)
                        match_against = if gender
                                          gender.downcase == 'm' ? MALE_NAMES : FEMALE_NAMES
                                        else
                                          ALL_NAMES
                  Severity: Minor
                  Found in app/services/people/nicknames.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

                  Function Details has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const Details = building => (
                      <>
                          <h5>
                              <a href={`/buildings/${building.id}`} target="_blank"
                                 title="Open building record in new tab" rel="noreferrer">
                  Severity: Minor
                  Found in app/javascript/forge/Building/Details.jsx - 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 matches? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def matches?(record)
                      needed_matches = [record.to_prefix, record.to_name, record.to_suffix, record.to_city].select(&:present?).size
                      matches = 0
                      matches += 1 if record.to_prefix.present? && address.street_prefix == record.to_prefix
                      matches += 1 if record.to_name.present? && address.street_name == record.to_name
                  Severity: Minor
                  Found in app/services/reverse_street_conversion.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 disable_and_reset has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def disable_and_reset
                      @user = User.find(params[:id])
                      if @user.provider?
                        flash[:error] = 'Sorry, users from other providers are not able to be reset'
                        return redirect_to action: 'show'
                  Severity: Minor
                  Found in app/controllers/users_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

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

                      def items
                        @items || begin
                          @items = model.items.map { |item|
                            item.theme_callback ||= :menu_list_item
                            item.active_callback ||= :current_page?
                  Severity: Minor
                  Found in app/services/cms/menu_presenter.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 translate_income has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def translate_income
                      return if wages_or_salary.present? || income.blank?
                  
                      self.wages_or_salary = if income == 999
                        'Un'
                  Severity: Minor
                  Found in app/models/census1940_record.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 render has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def render
                      if style.present?
                        if style == 'raw'
                          RawImgTagRenderer.new(self).render
                        elsif style == 'parallax'
                  Severity: Minor
                  Found in app/models/cms/picture.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