MiraitSystems/enju_trunk

View on GitHub

Showing 1,155 of 1,155 total issues

Avoid deeply nested control flow statements.
Open

        search_opts[:direct_mode] = true unless params[:binding_items_flg]
Severity: Major
Found in app/controllers/manifestations_controller.rb - About 45 mins to fix

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

      def destroy
        respond_to do |format|
          if @library.destroy?
            @library.shelves.each do |shelf|
              if shelf.destroy?
    Severity: Minor
    Found in app/controllers/libraries_controller.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

    Avoid deeply nested control flow statements.
    Open

            elsif params[:shelf_category] == 'jma'
              @shelves = Shelf.jma
            else
              @shelves = Shelf.where(["display_name like ?", params[:shelf_category] + '%'])
    Severity: Major
    Found in app/controllers/shelves_controller.rb - About 45 mins to fix

      Method add_output_column_spec has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

            def add_output_column_spec(fields, field_ext, field_names, for_join, for_separate, spec_hash = OUTPUT_COLUMN_SPEC)
      Severity: Minor
      Found in lib/enju_trunk/output_columns.rb - About 45 mins to fix

        Method create_article_item has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def create_article_item(attrs, manifestation, item, textfile, numbering, mode = 'edit')
        Severity: Minor
        Found in lib/enju_trunk/resourceadapter/import_article.rb - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                          end_page   = fix_data(page.split('-')[1]) rescue ''
          Severity: Major
          Found in lib/enju_trunk/resourceadapter/import_article.rb - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                            start_page = fix_data(page.split('-')[0]) rescue ''
            Severity: Major
            Found in lib/enju_trunk/resourceadapter/import_article.rb - About 45 mins to fix

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

                  def set_library(input_library, user, options = {:mode => 'input'})
                    if input_library.nil?
                      if options[:mode] == 'input'
                        return user.library
                      else
              Severity: Minor
              Found in lib/enju_trunk/resourceadapter/import_book.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

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

                def show
                  if @resource_import_file.resource_import.path
                    unless Setting.uploaded_file.storage == :s3
                      file = @resource_import_file.resource_import.path
                    end
              Severity: Minor
              Found in app/controllers/resource_import_files_controller.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

              Avoid deeply nested control flow statements.
              Open

                              issue_number_string  = value.split('*')[1] rescue ''
              Severity: Major
              Found in lib/enju_trunk/resourceadapter/import_article.rb - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                messages << message if message
                Severity: Major
                Found in app/controllers/loss_items_controller.rb - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                  volume_number_string = value.split('*')[0] rescue ''
                  Severity: Major
                  Found in lib/enju_trunk/resourceadapter/import_article.rb - About 45 mins to fix

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

                        def fix_use_restriction(cell, options = {:mode => 'input'})
                          if options[:mode] == 'delete'
                            return nil if cell.nil? or cell.blank?
                          end
                          if cell.nil? or cell.blank? or cell.upcase == 'FALSE' or cell == ''
                    Severity: Minor
                    Found in lib/enju_trunk/resourceadapter/import_book.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

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

                        def get_detail_name(model, primary, secondary = '')
                          return '' if model.blank? or primary.blank?
                          name_ary = model.display_name.localize.split(/[,:]/, -1) rescue []
                          return name_ary.first if name_ary.size.odd?
                          name_hash = Hash[*name_ary]
                    Severity: Minor
                    Found in lib/enju_trunk/enju_trunk_helper.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

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

                    function getWindowWidth(){
                        var de = document.documentElement;
                        return self.innerWidth || (de && de.clientWidth) || document.body.clientWidth;
                    };
                    Severity: Minor
                    Found in app/assets/javascripts/fg.menu.js and 1 other location - About 45 mins to fix
                    app/assets/javascripts/fg.menu.js on lines 565..568

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

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

                          def should_request_html_format?
                            if devise_controller?
                              if  (action_name == 'create' && request.method == ('POST')) ||
                                  (action_name == 'destroy' && request.method == ('POST'))
                                return true
                    Severity: Minor
                    Found in lib/enju_trunk/enju_trunk_controller.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

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

                      def import_request
                        begin
                          @resource_import_textfile = ResourceImportTextfile.find(params[:id])
                          Asynchronized_Service.new.perform(:ResourceImportTextfile_import, @resource_import_textfile.id)
                          flash[:message] = t('resource_import_textfile.start_importing')
                    Severity: Major
                    Found in app/controllers/resource_import_textfiles_controller.rb and 3 other locations - About 45 mins to fix
                    app/controllers/agent_import_files_controller.rb on lines 99..108
                    app/controllers/event_import_files_controller.rb on lines 97..106
                    app/controllers/resource_import_files_controller.rb on lines 99..109

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

                    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

                          can :read, [
                            AcceptType,
                            CarrierType,
                            CarrierTypeHasCheckoutType,
                            CheckoutType,
                    Severity: Minor
                    Found in app/models/ability.rb and 1 other location - About 45 mins to fix
                    app/models/ability.rb on lines 525..563

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

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

                          def convert_charset
                            case params[:format]
                            when 'csv'
                              return unless Setting.csv_charset_conversion
                              # TODO: 他の言語
                    Severity: Minor
                    Found in lib/enju_trunk/enju_trunk_controller.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

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

                        def agents_short_list(agents = [], options = {})
                          return nil if agents.blank?
                          agents_list = []
                          agents.each_with_index do |agent, i|
                            if i < 3
                    Severity: Minor
                    Found in lib/enju_trunk/enju_trunk_helper.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

                    Severity
                    Category
                    Status
                    Source
                    Language