next-l/enju_leaf

View on GitHub

Showing 345 of 709 total issues

Function buildSegResizeListener has 58 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    buildSegResizeListener: function(seg, isStart) {
        var _this = this;
        var view = this.view;
        var calendar = view.calendar;
        var el = seg.el;
Severity: Major
Found in app/assets/javascripts/enju_event/fullcalendar.js - About 2 hrs to fix

    Function buildDayDragListener has 58 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        buildDayDragListener: function() {
            var _this = this;
            var view = this.view;
            var isSelectable = view.opt('selectable');
            var dayClickHit; // null if invalid dayClick
    Severity: Major
    Found in app/assets/javascripts/enju_event/fullcalendar.js - About 2 hrs to fix

      File reserves_controller.rb has 263 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      class ReservesController < ApplicationController
        before_action :set_reserve, only: [:show, :edit, :update, :destroy]
        before_action :check_policy, only: [:index, :new, :create]
        before_action :prepare_options, only: [:new, :edit]
        before_action :get_user, only: [:index, :new]
      Severity: Minor
      Found in app/controllers/reserves_controller.rb - About 2 hrs to fix

        File items_controller.rb has 262 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        class ItemsController < ApplicationController
          include EnjuInventory::Controller
          before_action :set_item, only: [:show, :edit, :update, :destroy]
          before_action :check_policy, only: [:index, :new, :create]
          before_action :get_agent, :get_manifestation, :get_shelf, except: [:create, :update, :destroy]
        Severity: Minor
        Found in app/controllers/items_controller.rb - About 2 hrs to fix

          Function makeMoment has 57 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function makeMoment(args, parseAsUTC, parseZone) {
              var input = args[0];
              var isSingleString = args.length == 1 && typeof input === 'string';
              var isAmbigTime;
              var isAmbigZone;
          Severity: Major
          Found in app/assets/javascripts/enju_event/fullcalendar.js - About 2 hrs to fix

            Method create_loc_subject_related_elements has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                  def self.create_loc_subject_related_elements(doc, manifestation)
                    subjects = get_mods_subjects(doc)
                    classifications = get_mods_classifications(doc)
                    if defined?(EnjuSubject)
                      subject_heading_type = SubjectHeadingType.find_by(name: 'lcsh') || SubjectHeadingType.create!(name: 'lcsh')
            Severity: Minor
            Found in app/models/concerns/enju_loc/enju_manifestation.rb - About 2 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 17 (exceeds 5 allowed). Consider refactoring.
            Open

              def index
                if params[:mode] == 'select'
                  if @library
                    @shelves = @library.shelves
                  else
            Severity: Minor
            Found in app/controllers/shelves_controller.rb - About 2 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

            Function fgSegHtml has 55 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                fgSegHtml: function(seg, disableResizing) {
                    var view = this.view;
                    var event = seg.event;
                    var isDraggable = view.isEventDraggable(event);
                    var isResizableFromStart = !disableResizing && seg.isStart && view.isEventResizableFromStart(event);
            Severity: Major
            Found in app/assets/javascripts/enju_event/fullcalendar.js - About 2 hrs to fix

              File user_import_file.rb has 258 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              class UserImportFile < ApplicationRecord
                include Statesman::Adapters::ActiveRecordQueries[
                  transition_class: UserImportFileTransition,
                  initial_state: UserImportFileStateMachine.initial_state
                ]
              Severity: Minor
              Found in app/models/user_import_file.rb - About 2 hrs to fix

                Class ResourceImportFile has 21 methods (exceeds 20 allowed). Consider refactoring.
                Open

                class ResourceImportFile < ApplicationRecord
                  include Statesman::Adapters::ActiveRecordQueries[
                    transition_class: ResourceImportFileTransition,
                    initial_state: ResourceImportFileStateMachine.initial_state
                  ]
                Severity: Minor
                Found in app/models/resource_import_file.rb - About 2 hrs to fix

                  File attachment.rb has 255 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  def migrate_attachment
                    option = {
                      path: ":rails_root/private/system/:class/:attachment/:id_partition/:style/:filename"
                    }
                  
                  
                  Severity: Minor
                  Found in lib/tasks/attachment.rb - About 2 hrs to fix

                    Method deletable_by? has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def deletable_by?(current_user)
                          return nil unless current_user
                    
                          if defined?(EnjuCirculation)
                            # 未返却の資料のあるユーザを削除しようとした
                    Severity: Minor
                    Found in app/models/concerns/enju_seed/enju_user.rb - About 2 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 16 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def update
                        respond_to do |format|
                          if @series_statement_merge_list.update(series_statement_merge_list_params)
                            if params[:mode] == 'merge'
                              selected_series_statement = SeriesStatement.find(params[:selected_series_statement_id]) rescue nil
                    Severity: Minor
                    Found in app/controllers/series_statement_merge_lists_controller.rb - About 2 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 16 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def index
                        @count = {}
                        query = params[:query].to_s.strip
                        @query = query.dup
                        query = query.gsub(' ', ' ')
                    Severity: Minor
                    Found in app/controllers/events_controller.rb - About 2 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 51 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def index
                        @count = {}
                        if request.format.text?
                          per_page = 65534
                        else
                    Severity: Major
                    Found in app/controllers/purchase_requests_controller.rb - About 2 hrs to fix

                      Method modify has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def modify
                          transition_to!(:started)
                          rows = open_import_file(create_import_temp_file(attachment))
                          rows.shift
                          row_num = 1
                      Severity: Minor
                      Found in app/models/resource_import_file.rb - About 2 hrs to fix

                        Method create_additional_attributes has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                              def create_additional_attributes(doc, manifestation)
                                title = get_title(doc)
                                creators = get_creators(doc).uniq
                                subjects = get_subjects(doc).uniq
                                classifications = get_classifications(doc).uniq
                        Severity: Minor
                        Found in app/models/concerns/enju_ndl/enju_manifestation.rb - About 1 hr to fix

                          Function buildViewSpec has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              buildViewSpec: function(requestedViewType) {
                                  var viewOverrides = this.overrides.views || {};
                                  var specChain = []; // for the view. lowest to highest priority
                                  var defaultsChain = []; // for the view. lowest to highest priority
                                  var overridesChain = []; // for the view. lowest to highest priority
                          Severity: Minor
                          Found in app/assets/javascripts/enju_event/fullcalendar.js - About 1 hr to fix

                            Function fgSegHtml has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                fgSegHtml: function(seg, disableResizing) {
                                    var view = this.view;
                                    var event = seg.event;
                                    var isDraggable = view.isEventDraggable(event);
                                    var isResizableFromStart = !disableResizing && event.allDay &&
                            Severity: Minor
                            Found in app/assets/javascripts/enju_event/fullcalendar.js - About 1 hr to fix

                              Method import has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                def import
                                  transition_to!(:started)
                                  num = { imported: 0, failed: 0 }
                                  rows = open_import_file(create_import_temp_file(attachment))
                                  check_field(rows.first)
                              Severity: Minor
                              Found in app/models/event_import_file.rb - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language