codeforamerica/citygram

View on GitHub

Showing 9 of 11 total issues

Function hookupSteps has 121 lines of code (exceeds 25 allowed). Consider refactoring.
Open

app.hookupSteps = function() {
  $('.startButton').on('click', function() {
    app.scrollToElement($('#step1'));
  });

Severity: Major
Found in app/assets/js/scripts.js - About 4 hrs to fix

    File scripts.js has 299 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    $(document).ready(function() {
      app.hookupMap();
      app.hookupSteps();
      app.hideSteps();
    });
    Severity: Minor
    Found in app/assets/js/scripts.js - About 3 hrs to fix

      Function geolocate has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        app.geolocate = function(e) {
          e && e.preventDefault();
          var address = $('#geolocate').val();
          if (! address) { return }
          var city = undefined;
      Severity: Minor
      Found in app/assets/js/scripts.js - About 1 hr to fix

        Function hookupSteps has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

        app.hookupSteps = function() {
          $('.startButton').on('click', function() {
            app.scrollToElement($('#step1'));
          });
        
        
        Severity: Minor
        Found in app/assets/js/scripts.js - 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 hookupMap has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        app.hookupMap = function() {
          document.getElementById('locatormap').innerHTML = "<div id='map'><div class='map-key-panel js-dot-legend'><span class='map-event-dot'></span>Click to see notification</div></div>";
          var center = JSON.parse($('meta[name=mapCenter]').attr('content'));
          var options = {
            zoom: 13,
        Severity: Minor
        Found in app/assets/js/scripts.js - About 1 hr to fix

          Function hookupMap has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          app.hookupMap = function() {
            document.getElementById('locatormap').innerHTML = "<div id='map'><div class='map-key-panel js-dot-legend'><span class='map-event-dot'></span>Click to see notification</div></div>";
            var center = JSON.parse($('meta[name=mapCenter]').attr('content'));
            var options = {
              zoom: 13,
          Severity: Minor
          Found in app/assets/js/scripts.js - 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 geocode has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          app.geocode = function(address, city, state, callback, context) {
          Severity: Minor
          Found in app/assets/js/scripts.js - About 35 mins to fix

            Method call has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    def call(name, starts, ends, _, env)
            Severity: Minor
            Found in app/services/connection_builder.rb - About 35 mins to fix

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

                  def perform(subscription_id)
                    subscription = Subscription.first!(id: subscription_id)
                    publisher = subscription.publisher
              
                    # TODO: get rid of this case statement
              Severity: Minor
              Found in app/workers/subscription_confirmation.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