historyforge/historyforge

View on GitHub

Showing 131 of 347 total issues

Function ToolbarController has 84 lines of code (exceeds 25 allowed). Consider refactoring.
Open

            n = e.handleEvent, i = e.triggerEvent, t2 = e.findClosestElementFromNode, e.ToolbarController = function(e2) {
              function s2(t3) {
                this.element = t3, this.didKeyDownDialogInput = o(this.didKeyDownDialogInput, this), this.didClickDialogButton = o(this.didClickDialogButton, this), this.didClickAttributeButton = o(this.didClickAttributeButton, this), this.didClickActionButton = o(this.didClickActionButton, this), this.attributes = {}, this.actions = {}, this.resetDialogInputs(), n("mousedown", { onElement: this.element, matchingSelector: a, withCallback: this.didClickActionButton }), n("mousedown", { onElement: this.element, matchingSelector: c, withCallback: this.didClickAttributeButton }), n("click", { onElement: this.element, matchingSelector: v, preventDefault: true }), n("click", { onElement: this.element, matchingSelector: l, withCallback: this.didClickDialogButton }), n("keydown", { onElement: this.element, matchingSelector: h, withCallback: this.didKeyDownDialogInput });
              }
              var a, u, c, l, h, p, d, f, g, m, v;
Severity: Major
Found in app/assets/builds/richtext.js - About 3 hrs to fix

    Function DirectUploadController has 82 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            var DirectUploadController = function() {
              function DirectUploadController2(input, file) {
                classCallCheck(this, DirectUploadController2);
                this.input = input;
                this.file = file;
    Severity: Major
    Found in app/assets/builds/richtext.js - About 3 hrs to fix

      Function Editor has 82 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                  e.Editor = function() {
                    function n(n2, o, r) {
                      this.composition = n2, this.selectionManager = o, this.element = r, this.insertFiles = t2(this.insertFiles, this), this.undoManager = new e.UndoManager(this.composition), this.filters = i.slice(0);
                    }
                    var i;
      Severity: Major
      Found in app/assets/builds/richtext.js - About 3 hrs to fix

        Method probable_match has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

          def probable_match
            return if possible_matches.blank?
        
            record = @census_record
            probables = []
        Severity: Minor
        Found in app/jobs/match_census_to_person_record_job.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

        Function LocationMapper has 80 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                    t2 = e.elementContainsNode, n = e.findChildIndexOfNode, r = e.nodeIsBlockStart, s = e.nodeIsBlockStartComment, o = e.nodeIsBlockContainer, a = e.nodeIsCursorTarget, u = e.nodeIsEmptyTextNode, c = e.nodeIsTextNode, i = e.nodeIsAttachmentElement, l = e.tagName, h = e.walkTree, e.LocationMapper = function() {
                      function e2(t3) {
                        this.element = t3;
                      }
                      var p, d, f, g;
        Severity: Major
        Found in app/assets/builds/richtext.js - About 3 hrs to fix

          Function BlobRecord has 80 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  var BlobRecord = function() {
                    function BlobRecord2(file, checksum, url) {
                      var _this = this;
                      classCallCheck(this, BlobRecord2);
                      this.file = file;
          Severity: Major
          Found in app/assets/builds/richtext.js - About 3 hrs to fix

            Function Hash has 73 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                        t2 = e.arraysAreEqual, e.Hash = function(i2) {
                          function o(t3) {
                            t3 == null && (t3 = {}), this.values = s(t3), o.__super__.constructor.apply(this, arguments);
                          }
                          var r, s, a, u, c;
            Severity: Major
            Found in app/assets/builds/richtext.js - About 2 hrs to fix

              Function AttachmentEditorController has 71 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                          n = e.defer, i = e.handleEvent, s = e.makeElement, u = e.tagName, a = e.config, r = a.lang, t2 = a.css, o = a.keyNames, e.AttachmentEditorController = function(a2) {
                            function h2(t3, e2, n2, i2) {
                              this.attachmentPiece = t3, this.element = e2, this.container = n2, this.options = i2 != null ? i2 : {}, this.didBlurCaption = c(this.didBlurCaption, this), this.didChangeCaption = c(this.didChangeCaption, this), this.didInputCaption = c(this.didInputCaption, this), this.didKeyDownCaption = c(this.didKeyDownCaption, this), this.didClickActionButton = c(this.didClickActionButton, this), this.didClickToolbar = c(this.didClickToolbar, this), this.attachment = this.attachmentPiece.attachment, u(this.element) === "a" && (this.element = this.element.firstChild), this.install();
                            }
                            var p;
              Severity: Major
              Found in app/assets/builds/richtext.js - About 2 hrs to fix

                Function CompositionController has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                            i = e.findClosestElementFromNode, o = e.handleEvent, r = e.innerElementIsActive, n = e.defer, t2 = e.AttachmentView.attachmentSelector, e.CompositionController = function(u2) {
                              function c(n2, i2) {
                                this.element = n2, this.composition = i2, this.didClickAttachment = s(this.didClickAttachment, this), this.didBlur = s(this.didBlur, this), this.didFocus = s(this.didFocus, this), this.documentView = new e.DocumentView(this.composition.document, { element: this.element }), o("focus", { onElement: this.element, withCallback: this.didFocus }), o("blur", { onElement: this.element, withCallback: this.didBlur }), o("click", { onElement: this.element, matchingSelector: "a[contenteditable=false]", preventDefault: true }), o("mousedown", { onElement: this.element, matchingSelector: t2, withCallback: this.didClickAttachment }), o("click", { onElement: this.element, matchingSelector: "a" + t2, preventDefault: true });
                              }
                              return a(c, u2), c.prototype.didFocus = function() {
                Severity: Major
                Found in app/assets/builds/richtext.js - About 2 hrs to fix

                  Function SelectionManager has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                              i = e.getDOMSelection, n = e.getDOMRange, l = e.setDOMRange, t2 = e.elementContainsNode, s = e.nodeIsCursorTarget, r = e.innerElementIsActive, o = e.handleEvent, a = e.normalizeRange, u = e.rangeIsCollapsed, c = e.rangesAreEqual, e.SelectionManager = function(d2) {
                                function f(t3) {
                                  this.element = t3, this.selectionDidChange = h(this.selectionDidChange, this), this.didMouseDown = h(this.didMouseDown, this), this.locationMapper = new e.LocationMapper(this.element), this.pointMapper = new e.PointMapper(), this.lockCount = 0, o("mousedown", { onElement: this.element, withCallback: this.didMouseDown });
                                }
                                return p(f, d2), f.prototype.getLocationRange = function(t3) {
                  Severity: Major
                  Found in app/assets/builds/richtext.js - About 2 hrs to fix

                    Function ObjectView has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                                e.ObjectView = function(n2) {
                                  function o(t3, e2) {
                                    this.object = t3, this.options = e2 != null ? e2 : {}, this.childViews = [], this.rootView = this;
                                  }
                                  return t2(o, n2), o.prototype.getNodes = function() {
                    Severity: Major
                    Found in app/assets/builds/richtext.js - About 2 hrs to fix

                      Method scope_fields_for has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def self.scope_fields_for(year)
                          with_options edit_only: true do
                            divider 'Census Scope'
                            input :page_number, as: :integer, min: 0, max: 10_000, facet: false
                            input :page_side, as: :select, facet: false if year > 1870 && year < 1950
                      Severity: Minor
                      Found in app/services/census_form_field_config.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 FileChecksum has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              var FileChecksum = function() {
                                createClass(FileChecksum2, null, [{
                                  key: "create",
                                  value: function create(file, callback) {
                                    var instance = new FileChecksum2(file);
                      Severity: Major
                      Found in app/assets/builds/richtext.js - About 2 hrs to fix

                        Consider simplifying this complex logical expression.
                        Open

                                      if (i2 && i2.type === "childList" && i2.addedNodes && i2.addedNodes) {
                                        for (var o2 = i2.addedNodes[0]; o2 && o2 !== document && !o2.host; )
                                          o2 = o2.parentNode;
                                        var r2 = o2 && (o2.URL || o2._URL || o2.host && o2.host.localName) || "";
                                        r2 = r2.split("/?").shift().split("/").pop();
                        Severity: Critical
                        Found in app/assets/builds/richtext.js - About 2 hrs to fix

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

                          class Buildings::MainController < ApplicationController
                            include AdvancedRestoreSearch
                            include RenderCsv
                          
                            wrap_parameters format: []
                          Severity: Minor
                          Found in app/controllers/buildings/main_controller.rb - About 2 hrs to fix

                            Function Piece has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                        e.Piece = function(n2) {
                                          function i(t3, n3) {
                                            n3 == null && (n3 = {}), i.__super__.constructor.apply(this, arguments), this.attributes = e.Hash.box(n3);
                                          }
                                          return t2(i, n2), i.types = {}, i.registerType = function(t3, e2) {
                            Severity: Major
                            Found in app/assets/builds/richtext.js - About 2 hrs to fix

                              Function DirectUploadsController has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                      var DirectUploadsController = function() {
                                        function DirectUploadsController2(form) {
                                          classCallCheck(this, DirectUploadsController2);
                                          this.form = form;
                                          this.inputs = findElements(form, inputSelector).filter(function(input) {
                              Severity: Major
                              Found in app/assets/builds/richtext.js - About 2 hrs to fix

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

                                  def perform
                                    PaperTrail::Version.find_each do |version|
                                      person_change = version.changeset[:person_id]
                                      if person_change
                                        from_person_id, to_person_id = person_change
                                Severity: Minor
                                Found in app/jobs/generate_audit_logs_job.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 row_data has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                                Open

                                  def row_data
                                    records.map do |record|
                                      hash = { street_address: { name: record.street_address, id: record.id, reviewed: record.reviewed? } }
                                      columns.each do |column|
                                        next if SKIP_COLUMNS.include?(column)
                                Severity: Minor
                                Found in app/services/building_grid_translator.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 initialize has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                                Open

                                  def initialize(user)
                                    if user.blank?
                                      # a guest user can only do this stuff
                                      can :read, Person
                                      can :read, Building do |building| building.reviewed?; end
                                Severity: Minor
                                Found in app/services/ability.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

                                Severity
                                Category
                                Status
                                Source
                                Language