ministryofjustice/hwf-calculator

View on GitHub

Showing 3 of 91 total issues

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

    function BenefitsReceivedPage () {
        var self = this;

        self.init = function() {
            initListenersForCheckboxes();
Severity: Major
Found in app/assets/javascripts/pages/benefits_received.js - About 3 hrs to fix

    Function DetailsPolyfill has 74 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function DetailsPolyfill () {
            var self = this;
            var _nextId = 0;
            self.init = function() {
                if(checkSupport()) {
    Severity: Major
    Found in app/assets/javascripts/details.polyfill.js - About 2 hrs to fix

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

        def call
          return self unless valid?
          if lte_minimum?
            mark_as_help_available
          elsif above_minimum? && lte_maximum?
      Severity: Minor
      Found in app/services/household_income_calculator_service.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