valor-software/angular2-bootstrap

View on GitHub
src/chronos/create/from-array.ts

Summary

Maintainability
C
1 day
Test Coverage

Function configFromArray has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

export function configFromArray(config: DateParsingConfig): DateParsingConfig {
  const input = [];
  let i;
  let date;
  let currentDate;
Severity: Minor
Found in src/chronos/create/from-array.ts - About 2 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 dayOfYearFromWeekInfo has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

function dayOfYearFromWeekInfo(config: DateParsingConfig): DateParsingConfig {
  let w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow;

  w = config._w;
  if (w.GG != null || w.W != null || w.E != null) {
Severity: Minor
Found in src/chronos/create/from-array.ts - About 2 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 configFromArray has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function configFromArray(config: DateParsingConfig): DateParsingConfig {
  const input = [];
  let i;
  let date;
  let currentDate;
Severity: Minor
Found in src/chronos/create/from-array.ts - About 1 hr to fix

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

    function dayOfYearFromWeekInfo(config: DateParsingConfig): DateParsingConfig {
      let w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow;
    
      w = config._w;
      if (w.GG != null || w.W != null || w.E != null) {
    Severity: Minor
    Found in src/chronos/create/from-array.ts - About 1 hr to fix

      There are no issues that match your filters.

      Category
      Status