historyforge/historyforge

View on GitHub

Showing 131 of 347 total issues

Function InputController has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

            t2 = e.handleEvent, n = e.innerElementIsActive, e.InputController = function(o2) {
              function r(n2) {
                var i2;
                this.element = n2, this.mutationObserver = new e.MutationObserver(this.element), this.mutationObserver.delegate = this;
                for (i2 in this.events)
Severity: Major
Found in app/assets/builds/richtext.js - About 2 hrs to fix

    Function Map has 51 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const Map = props => {
      const mapRef = useRef<HTMLDivElement>(null)
      const [map, setMap] = useState(null)
      const [markers, setMarkers] = useState(null)
      const [marker, setMarker] = useState(null)
    Severity: Major
    Found in app/javascript/miniforge/Map.tsx - About 2 hrs to fix

      Consider simplifying this complex logical expression.
      Open

                    if (t3 = n2(t3), !e3.childList && !e3.attributes && !e3.characterData || e3.attributeOldValue && !e3.attributes || e3.attributeFilter && e3.attributeFilter.length && !e3.attributes || e3.characterDataOldValue && !e3.characterData)
                      throw new SyntaxError();
      Severity: Critical
      Found in app/assets/builds/richtext.js - About 2 hrs to fix

        Method initialize has 50 lines of code (exceeds 25 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

          Function HTMLSanitizer has 50 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                      n = e.tagName, i = e.walkTree, t2 = e.nodeIsAttachmentElement, e.HTMLSanitizer = function(r2) {
                        function u(t3, e2) {
                          var n2;
                          n2 = e2 != null ? e2 : {}, this.allowedAttributes = n2.allowedAttributes, this.forbiddenProtocols = n2.forbiddenProtocols, this.forbiddenElements = n2.forbiddenElements, this.allowedAttributes == null && (this.allowedAttributes = c), this.forbiddenProtocols == null && (this.forbiddenProtocols = h), this.forbiddenElements == null && (this.forbiddenElements = l), this.body = p(t3);
                        }
          Severity: Minor
          Found in app/assets/builds/richtext.js - About 2 hrs to fix

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

                        t2 = e.defer, n = e.makeElement, e.DocumentView = function(o2) {
                          function r() {
                            r.__super__.constructor.apply(this, arguments), this.element = this.options.element, this.elementStore = new e.ElementStore(), this.setDocument(this.object);
                          }
                          var s, a, u;
            Severity: Minor
            Found in app/assets/builds/richtext.js - About 1 hr to fix

              Method option_label has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

                def option_label(item)
                  if options[:coded]
                    code = item.downcase == item ? item.capitalize : item
                    code = code.gsub('_', ' ')
                    if attribute_name == :race && @builder.object.class.respond_to?(:translate_race_code)
              Severity: Minor
              Found in app/inputs/collection_radio_buttons_input.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

              Method define_enumeration has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

                  def self.define_enumeration(name, values, **kwargs)
                    strict = kwargs[:strict]
                    self.enumerations ||= []
              
                    class_eval "def self.#{name}_choices; #{values.inspect}; end", __FILE__, __LINE__
              Severity: Minor
              Found in app/models/concerns/define_enumeration.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

              Function PieceView has 47 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                          i = e.makeElement, t2 = e.findInnerElement, n = e.getTextConfig, e.PieceView = function(r2) {
                            function s() {
                              var t3;
                              s.__super__.constructor.apply(this, arguments), this.piece = this.object, this.attributes = this.piece.getAttributes(), t3 = this.options, this.textConfig = t3.textConfig, this.context = t3.context, this.piece.attachment ? this.attachment = this.piece.attachment : this.string = this.piece.toString();
                            }
              Severity: Minor
              Found in app/assets/builds/richtext.js - About 1 hr to fix

                Method from_string has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                  def self.from_string(address_str)
                    address = ConvertibleAddress.new
                    bits = address_str.split(' ')
                    number = bits.shift if bits.first.to_i > 0
                    start = bits.shift
                Severity: Minor
                Found in app/services/reverse_street_conversion.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

                Function BlobUpload has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        var BlobUpload = function() {
                          function BlobUpload2(blob) {
                            var _this = this;
                            classCallCheck(this, BlobUpload2);
                            this.blob = blob;
                Severity: Minor
                Found in app/assets/builds/richtext.js - About 1 hr to fix

                  Function CensusSearch has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const CensusSearch = (props) => {
                    const [open, setOpen] = useState(null)
                  
                    const { years, year, setYear, filters, current, message, params } = props
                  
                  
                  Severity: Minor
                  Found in app/javascript/forge/CensusSearch/index.jsx - About 1 hr to fix

                    Function initMap has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      initMap() {
                        if (typeof google === 'undefined') {
                          setTimeout(
                            () => this.initMap(),
                            1000
                    Severity: Minor
                    Found in app/javascript/controllers/photo_wizard_controller.js - About 1 hr to fix

                      Method render has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def render
                            html = render_image.html_safe
                      
                            if picture.outlink?
                              link_options = { href: picture.outlink }
                      Severity: Minor
                      Found in app/models/cms/picture.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

                      Method scoped has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def scoped
                          active? && builder.left_outer_joins(:addresses)
                      
                          builder.reviewed unless user
                          builder.without_residents if unpeopled?
                      Severity: Minor
                      Found in app/services/building_search.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

                      Function default has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export default function(text) {
                        // The object to be returned.
                        const result = {}
                      
                        // Iterate over all key=value pairs.
                      Severity: Minor
                      Found in app/javascript/js/deparam.js - About 1 hr to fix

                        Function layers has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export const layers = function(state = {}, action) {
                          if (action.type === 'FORGE_INIT') {
                            const nextLayers = state.layers.map(layer => {
                              layer.selected = layerStorage.isSelected(layer);
                              return layer;
                        Severity: Minor
                        Found in app/javascript/forge/reducers/layers.js - About 1 hr to fix

                          Function AttachmentView has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                      i = e.makeElement, t2 = e.config.css, e.AttachmentView = function(r2) {
                                        function s() {
                                          s.__super__.constructor.apply(this, arguments), this.attachment = this.object, this.attachment.uploadProgressDelegate = this, this.attachmentPiece = this.options.piece;
                                        }
                                        var a;
                          Severity: Minor
                          Found in app/assets/builds/richtext.js - About 1 hr to fix

                            Function DirectUpload2 has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                    var DirectUpload2 = function() {
                                      function DirectUpload3(file, url, delegate) {
                                        classCallCheck(this, DirectUpload3);
                                        this.id = ++id;
                                        this.file = file;
                            Severity: Minor
                            Found in app/assets/builds/richtext.js - About 1 hr to fix

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

                                def load_parent
                                  if params[:person_id]
                                    @person = Person.find params[:person_id]
                                    @model_class = @person.photos
                              
                              
                              Severity: Minor
                              Found in app/controllers/photographs_controller.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

                              Severity
                              Category
                              Status
                              Source
                              Language