MiraitSystems/enju_trunk

View on GitHub

Showing 1,155 of 1,155 total issues

Method sort_by has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def sort_by
    sort = {:sort_by => 'created_at', :order => 'desc'}
    unless '1.1' == @version
      @path, @ascending = @cql.sort_by.split('/')
    else
Severity: Minor
Found in lib/enju_leaf/sru.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

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

  def create
    @resource_import_file = ResourceImportFile.new(params[:resource_import_file])
    @resource_import_file.user = current_user

    respond_to do |format|
Severity: Major
Found in app/controllers/resource_import_files_controller.rb and 2 other locations - About 1 hr to fix
app/controllers/agent_import_files_controller.rb on lines 59..69
app/controllers/subscriptions_controller.rb on lines 48..58

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

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 create
    @agent_import_file = AgentImportFile.new(params[:agent_import_file])
    @agent_import_file.user = current_user

    respond_to do |format|
Severity: Major
Found in app/controllers/agent_import_files_controller.rb and 2 other locations - About 1 hr to fix
app/controllers/resource_import_files_controller.rb on lines 59..69
app/controllers/subscriptions_controller.rb on lines 48..58

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

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 import_series_statement has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def import_series_statement(row)
    issn = nil
    if row['issn'].present?
      issn = Lisbn.new(row['issn'].to_s)
    end
Severity: Minor
Found in app/models/resource_import_file.rb - About 1 hr to fix

    Method get_manifestation_list_excelx has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def self.get_manifestation_list_excelx(manifestation_ids, current_user, selected_column = [])
        user_file = UserFile.new(current_user)
        excel_filepath, excel_fileinfo = user_file.create(:manifestation_list, Setting.manifestation_list_print_excelx.filename)
    
        begin
    Severity: Minor
    Found in app/models/manifestation.rb - About 1 hr to fix

      Method build_query has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def build_query(cond, inverse = false)
              if inverse
                op = 'OR'
              else
                op = 'AND'
      Severity: Minor
      Found in app/models/nacsis_cat.rb - About 1 hr to fix

        Method output_familylist_pdf has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def self.output_familylist_pdf(families)
            max_family_column = 7
            report = EnjuTrunk.new_report('familylist.tlf')
        
            # set page_num
        Severity: Minor
        Found in app/models/family.rb - About 1 hr to fix

          Method index has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def index
              @displist = []
              dispList = Struct.new(:state, :reserves)
          
              unless params[:format] == 'pdf' or params[:format] == 'tsv'
          Severity: Minor
          Found in app/controllers/reservelists_controller.rb - About 1 hr to fix

            Method manage_list_of_order has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def manage_list_of_order
                @start_at_s = params[:start_at]
                @end_at_s = params[:end_at]
                action = params[:submit_order_list] || params[:submit_not_arrival_list]
            
            
            Severity: Minor
            Found in app/controllers/order_lists_controller.rb - About 1 hr to fix

              Method create has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def create
                  @item = Item.new(params[:item])
              
                  @manifestation = Manifestation.find(@item.manifestation_id)
              
              
              Severity: Minor
              Found in app/controllers/items_controller.rb - About 1 hr to fix

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

                            if (/pm/i.test(a[i]) && hr < 12)
                                hr += 12;
                            else if (/am/i.test(a[i]) && hr >= 12)
                                hr -= 12;
                Severity: Major
                Found in app/assets/javascripts/jquery.simplecalendarjp.js and 1 other location - About 1 hr to fix
                app/assets/javascripts/jquery.simplecalendarjp.js on lines 968..971

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

                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

                                    if (/pm/i.test(AP.innerHTML) && h < 12)
                                        h += 12;
                                    else if (/am/i.test(AP.innerHTML) && h == 12)
                                        h = 0;
                Severity: Major
                Found in app/assets/javascripts/jquery.simplecalendarjp.js and 1 other location - About 1 hr to fix
                app/assets/javascripts/jquery.simplecalendarjp.js on lines 1717..1720

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

                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

                  def create
                    @budget = Budget.new(params[:budget])
                
                    respond_to do |format|
                      if @budget.save
                Severity: Major
                Found in app/controllers/budgets_controller.rb and 1 other location - About 1 hr to fix
                app/controllers/carrier_type_has_checkout_types_controller.rb on lines 50..61

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

                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 update
                    if params[:move]
                      move_position(@identifier_type, params[:move])
                      return
                    end
                Severity: Major
                Found in app/controllers/identifier_types_controller.rb and 2 other locations - About 1 hr to fix
                app/controllers/picture_files_controller.rb on lines 130..143
                app/controllers/user_groups_controller.rb on lines 70..82

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

                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 update
                    if params[:move]
                      move_position(@user_group, params[:move])
                      return
                    end
                Severity: Major
                Found in app/controllers/user_groups_controller.rb and 2 other locations - About 1 hr to fix
                app/controllers/identifier_types_controller.rb on lines 57..69
                app/controllers/picture_files_controller.rb on lines 130..143

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

                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 update
                    # 並べ替え
                    if params[:move]
                      move_position(@picture_file, params[:move])
                      return
                Severity: Major
                Found in app/controllers/picture_files_controller.rb and 2 other locations - About 1 hr to fix
                app/controllers/identifier_types_controller.rb on lines 57..69
                app/controllers/user_groups_controller.rb on lines 70..82

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

                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

                  def create
                    @carrier_type_has_checkout_type = CarrierTypeHasCheckoutType.new(params[:carrier_type_has_checkout_type])
                
                    respond_to do |format|
                      if @carrier_type_has_checkout_type.save
                app/controllers/budgets_controller.rb on lines 18..29

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

                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 export_pdf has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def self.export_pdf(expenses)
                    begin
                      report = EnjuTrunk.new_report('expense_list.tlf')
                      report.events.on :page_create do |e|
                        e.page.item(:page).value(e.page.no)
                Severity: Minor
                Found in app/models/expense.rb - About 1 hr to fix

                  Method check_price has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def check_price
                      record = Expense.where(:item_id => self.id).order("id DESC").first
                      begin
                        unless record.nil?
                          record.acquired_at_ym = select_acquired_at
                  Severity: Minor
                  Found in app/models/item.rb - About 1 hr to fix

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

                      def create
                        @copy_request = CopyRequest.new(params[:copy_request])
                        respond_to do |format|
                          if @copy_request.save
                            flash[:notice] = t('controller.successfully_created', :model => t('activerecord.models.copy_request'))
                    Severity: Major
                    Found in app/controllers/copy_requests_controller.rb and 17 other locations - About 1 hr to fix
                    app/controllers/abbreviations_controller.rb on lines 23..33
                    app/controllers/areas_controller.rb on lines 32..41
                    app/controllers/budget_categories_controller.rb on lines 35..45
                    app/controllers/budget_types_controller.rb on lines 13..23
                    app/controllers/checkout_stat_has_manifestations_controller.rb on lines 41..51
                    app/controllers/checkout_stat_has_users_controller.rb on lines 41..51
                    app/controllers/departments_controller.rb on lines 13..22
                    app/controllers/keycodes_controller.rb on lines 16..25
                    app/controllers/manifestation_checkout_stats_controller.rb on lines 48..58
                    app/controllers/manifestation_reserve_stats_controller.rb on lines 47..57
                    app/controllers/reserve_stat_has_manifestations_controller.rb on lines 41..51
                    app/controllers/reserve_stat_has_users_controller.rb on lines 41..51
                    app/controllers/series_statement_merge_lists_controller.rb on lines 42..52
                    app/controllers/series_statement_merges_controller.rb on lines 50..60
                    app/controllers/terms_controller.rb on lines 13..23
                    app/controllers/user_checkout_stats_controller.rb on lines 47..57
                    app/controllers/user_reserve_stats_controller.rb on lines 47..57

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

                    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

                    Severity
                    Category
                    Status
                    Source
                    Language