expertiza/expertiza

View on GitHub
app/assets/javascripts/datetimepicker.js

Summary

Maintainability
F
3 days
Test Coverage

File datetimepicker.js has 439 lines of code (exceeds 250 allowed). Consider refactoring.
Open

//Javascript name: My Date Time Picker
//Date created: 16-Nov-2003 23:19
//Scripter: TengYong Ng
//Website: http://www.rainforestnet.com
//Copyright (c) 2003 TengYong Ng
Severity: Minor
Found in app/assets/javascripts/datetimepicker.js - About 6 hrs to fix

    Function RenderCal has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
    Open

    function RenderCal()
    {
        var vCalHeader;
        var vCalData;
        var vCalTime;
    Severity: Minor
    Found in app/assets/javascripts/datetimepicker.js - About 4 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 RenderCal has 98 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function RenderCal()
    {
        var vCalHeader;
        var vCalData;
        var vCalTime;
    Severity: Major
    Found in app/assets/javascripts/datetimepicker.js - About 3 hrs to fix

      Function NewCal has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

      function NewCal(pCtrl,pFormat,pShowTime,pTimeMode)
      {
          Cal=new Calendar(dtToday);
          if ((pShowTime!=null) && (pShowTime))
          {
      Severity: Minor
      Found in app/assets/javascripts/datetimepicker.js - 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 NewCal has 72 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function NewCal(pCtrl,pFormat,pShowTime,pTimeMode)
      {
          Cal=new Calendar(dtToday);
          if ((pShowTime!=null) && (pShowTime))
          {
      Severity: Major
      Found in app/assets/javascripts/datetimepicker.js - About 2 hrs to fix

        Function getShowHour has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

        function getShowHour()
        {
            var finalHour;
            if (TimeMode==12)
            {
        Severity: Minor
        Found in app/assets/javascripts/datetimepicker.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 SetHour has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

        function SetHour(intHour)
        {    
            var MaxHour;
            var MinHour;
            if (TimeMode==24)
        Severity: Minor
        Found in app/assets/javascripts/datetimepicker.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 getShowHour has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function getShowHour()
        {
            var finalHour;
            if (TimeMode==12)
            {
        Severity: Minor
        Found in app/assets/javascripts/datetimepicker.js - About 1 hr to fix

          Function GenCell has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function GenCell(pValue,pHighLight,pColor)//Generate table cell with value
          {
              var PValue;
              var PCellStr;
              var vColor;
          Severity: Minor
          Found in app/assets/javascripts/datetimepicker.js - About 1 hr to fix

            Function SetHour has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function SetHour(intHour)
            {    
                var MaxHour;
                var MinHour;
                if (TimeMode==24)
            Severity: Minor
            Found in app/assets/javascripts/datetimepicker.js - About 1 hr to fix

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

              function FormatDate(pDate)
              {
                  if(this.Month+1<10)    {
                      var month='0'+ (this.Month+1);
                  } else {
              Severity: Minor
              Found in app/assets/javascripts/datetimepicker.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 GenCell has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

              function GenCell(pValue,pHighLight,pColor)//Generate table cell with value
              {
                  var PValue;
                  var PCellStr;
                  var vColor;
              Severity: Minor
              Found in app/assets/javascripts/datetimepicker.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

              Avoid too many return statements within this function.
              Open

                      return (this.GetMonthName(false)+DateSeparator+pDate+DateSeparator+this.Year);
              Severity: Major
              Found in app/assets/javascripts/datetimepicker.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return (this.toUTCString());
                Severity: Major
                Found in app/assets/javascripts/datetimepicker.js - About 30 mins to fix

                  There are no issues that match your filters.

                  Category
                  Status