openaustralia/planningalerts

View on GitHub

Showing 8 of 12 total issues

Function barGraph has 154 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function barGraph(selector, url, metric) {
  // Add the chart
  d3.json(url, function(data) {

    data = data.map(function(d, i) {
Severity: Major
Found in app/assets/javascripts/bar_graph.js - About 6 hrs to fix

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

      class Tailwind < ActionView::Helpers::FormBuilder
        extend T::Sig
    
        sig { params(method: Symbol, text: T.any(T.nilable(String), T::Hash[Symbol, String]), options: T::Hash[Symbol, String]).returns(String) }
        def label(method, text = nil, options = {})
    Severity: Minor
    Found in app/lib/form_builders/tailwind.rb - About 2 hrs to fix

      Method initialize has 52 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def initialize(size:, alignment:)
          super
      
          # Doing it this way so that tailwind doesn't compile the classes out
          case size
      Severity: Major
      Found in app/components/speech_bubble_component.rb - About 2 hrs to fix

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

          def initialize(tag:, size: nil, color: nil, font: nil, weight: nil, extra_classes: "")
            super
        
            default_size = DEFAULT_SIZES[tag]
            raise "Unexpected tag #{tag}" if default_size.nil?
        Severity: Minor
        Found in app/components/heading_component.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 initialiseGeocodingMap has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        async function initialiseGeocodingMap(map_div) {
          const { Map, InfoWindow } = await google.maps.importLibrary('maps');
          const { Marker } = await google.maps.importLibrary("marker");
        
          var g = JSON.parse(map_div.dataset.google);
        Severity: Minor
        Found in app/assets/javascripts/maps.js - About 1 hr to fix

          Method initialize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

            def initialize(size:, alignment:)
              super
          
              # Doing it this way so that tailwind doesn't compile the classes out
              case size
          Severity: Minor
          Found in app/components/speech_bubble_component.rb - About 55 mins 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 getAddress has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          async function getAddress() {
            try {
              var pos = await getPositionByGeolocation({enableHighAccuracy: true, timeout: 10000});
            } catch(err) {
              if (err.code == 1) { // User said no
          Severity: Minor
          Found in app/assets/javascripts/geolocation.js - About 35 mins 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 changed_data_attributes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

            def changed_data_attributes
              v = previous_version
              if v
                changed = {}
                data_attributes.each_key do |a|
          Severity: Minor
          Found in app/models/application_version.rb - About 25 mins 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