MiraitSystems/enju_trunk

View on GitHub

Showing 1,155 of 1,155 total issues

Method enju_hiduke2yyyymmdd_sub has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

  def self.enju_hiduke2yyyymmdd_sub(datestr)
    yyyymmdd_from = nil 
    yyyymmdd_to = nil 
    dfrom = nil 
    dto = nil
Severity: Minor
Found in lib/enju_trunk/date_helper.rb - About 4 hrs 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_agent_value has 109 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def set_agent_value(agent, row)
    #日本語化
    full_name = I18n.t('activerecord.attributes.agent.full_name')
    full_name_transcription = I18n.t('activerecord.attributes.agent.full_name_transcription')
    full_name_alternative = I18n.t('activerecord.attributes.agent.full_name_alternative')
Severity: Major
Found in app/models/agent_import_file.rb - About 4 hrs to fix

    Method create_manifestation_from_nacsis_cat has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

          def create_manifestation_from_nacsis_cat(nacsis_cat, book_types, manifestation = nil)
            return nil if nacsis_cat.blank?
    
            ActiveRecord::Base.transaction do
              child_manifestation = nil
    Severity: Minor
    Found in app/models/nacsis_cat.rb - About 4 hrs 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 process_book_data has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

        def process_book_data(import_textresult, datas, sheet, textfile, numbering, auto_numbering, not_set_serial_number, external_resource)
          manifestation = series_statement = item = nil
          error_msgs = []
    
          # 所蔵、シリーズ、書誌を特定する
    Severity: Minor
    Found in lib/enju_trunk/resourceadapter/import_book.rb - About 4 hrs 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 find_same_item has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

        def find_same_item(attrs, manifestation_type)
          conditions = ["((manifestations).manifestation_type_id = \'#{manifestation_type.id}\')"] # FIXME!
          attrs.each do |key, value|
            case key
            when 'creators', 'subjects'
    Severity: Minor
    Found in lib/enju_trunk/resourceadapter/import_article.rb - About 4 hrs 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 download_file has 106 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def download_file
        @libraries = Library.all
        @bookstores = Bookstore.all
        @budgets = Budget.all
        @budget_types = BudgetType.all
    Severity: Major
    Found in app/controllers/expenses_controller.rb - About 4 hrs to fix

      File agent.rb has 342 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      class Agent < ActiveRecord::Base
        attr_accessible :last_name, :middle_name, :first_name,
          :last_name_transcription, :middle_name_transcription,
          :first_name_transcription, :corporate_name, :corporate_name_transcription,
          :full_name, :full_name_transcription, :full_name_alternative, :zip_code_1,
      Severity: Minor
      Found in app/models/agent.rb - About 4 hrs to fix

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

          def index
            #session[:params] = {} unless session[:params]
            #session[:params][:agent] = params
            # 最近追加されたパトロン
            #@query = params[:query] ||= "[* TO *]"
        Severity: Major
        Found in app/controllers/agents_controller.rb - About 4 hrs to fix

          Function _init has 104 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          Calendar.prototype._init = function (firstDayOfWeek, date) {
              var today = new Date(),
                  TY = today.getFullYear(),
                  TM = today.getMonth(),
                  TD = today.getDate();
          Severity: Major
          Found in app/assets/javascripts/jquery.simplecalendarjp.js - About 4 hrs to fix

            Method fetch has 103 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def fetch(row, options = {:edit_mode => 'create'})
                shelf = Shelf.where(:name => row['shelf'].to_s.strip).first || Shelf.web
                case options[:edit_mode]
                when 'create'
                  manifestation = nil
            Severity: Major
            Found in app/models/resource_import_file.rb - About 4 hrs to fix

              Method index has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
              Open

                def index
                  unless SystemConfiguration.get("user_show_questions")
                    unless current_user.has_role?('Librarian')
                      access_denied; return
                    end
              Severity: Minor
              Found in app/controllers/questions_controller.rb - About 4 hrs 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 import has 100 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def import
                  sm_start!
                  #日本語化
                  full_name = I18n.t('activerecord.attributes.agent.full_name')
                  username = I18n.t('activerecord.attributes.user.username')
              Severity: Major
              Found in app/models/agent_import_file.rb - About 4 hrs to fix

                Function updateFromControl has 99 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function updateFromControl(input, target) {
                
                        function getCoords(picker, container) {
                
                            var left, top;
                Severity: Major
                Found in app/assets/javascripts/jquery.minicolors.js - About 3 hrs to fix

                  Method construct_list_query has 99 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def construct_list_query(list_type, library_ids, carrier_type_ids, bookstore_ids, ndcs, acquired_at, apply_order)
                      scope = Item.scoped
                  
                      ti = Item.arel_table
                      tc = Checkout.arel_table
                  Severity: Major
                  Found in app/controllers/export_item_lists_controller.rb - About 3 hrs to fix

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

                    $.fn.getTotalHeight = function(){
                        return $(this).height() + parseInt($(this).css('paddingTop')) + parseInt($(this).css('paddingBottom')) + parseInt($(this).css('borderTopWidth')) + parseInt($(this).css('borderBottomWidth'));
                    };
                    Severity: Major
                    Found in app/assets/javascripts/fg.menu.js and 1 other location - About 3 hrs to fix
                    app/assets/javascripts/fg.menu.js on lines 549..551

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

                    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

                    $.fn.getTotalWidth = function(){
                        return $(this).width() + parseInt($(this).css('paddingRight')) + parseInt($(this).css('paddingLeft')) + parseInt($(this).css('borderRightWidth')) + parseInt($(this).css('borderLeftWidth'));
                    };
                    Severity: Major
                    Found in app/assets/javascripts/fg.menu.js and 1 other location - About 3 hrs to fix
                    app/assets/javascripts/fg.menu.js on lines 553..555

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

                    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 a Cognitive Complexity of 27 (exceeds 5 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 3 hrs 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 bestrequest has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def bestrequest
                        logger.info "bestrequest start"
                        if params[:opac] and params[:search_date_first].blank? and params[:search_date_last].blank?
                          @start_d = (Date.today - 2.weeks).to_s
                          @end_d = Date.today.to_s
                    Severity: Minor
                    Found in app/controllers/manifestation_exstats_controller.rb - About 3 hrs 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 index has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def index
                        query = params[:query].to_s.strip
                        per_page = Item.default_per_page
                        @count = {}
                        if user_signed_in?
                    Severity: Minor
                    Found in app/controllers/items_controller.rb - About 3 hrs 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 update has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def update
                        @relationship_family = @series_statement_relationship.relationship_family
                        before_relationship_series_statement_ids = @series_statement_relationship.relationship_family.series_statements.map(&:id)
                        SeriesStatementRelationship.transaction do  
                          @series_statement_relationship.update_attributes!(params[:series_statement_relationship])
                    Severity: Minor
                    Found in app/controllers/series_statement_relationships_controller.rb - About 3 hrs 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