valor-software/angular2-bootstrap

View on GitHub
src/chronos/create/check-overflow.ts

Summary

Maintainability
C
1 day
Test Coverage

Function checkOverflow has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

export function checkOverflow(config: DateParsingConfig): DateParsingConfig {
  let overflow;
  const a = config._a;

  if (a && getParsingFlags(config).overflow === -2) {
Severity: Minor
Found in src/chronos/create/check-overflow.ts - About 6 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

Consider simplifying this complex logical expression.
Open

  if (a && getParsingFlags(config).overflow === -2) {
    // todo: fix this sh*t
    overflow =
      a[MONTH] < 0 || a[MONTH] > 11 ? MONTH :
        a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE :
Severity: Critical
Found in src/chronos/create/check-overflow.ts - About 2 hrs to fix

    There are no issues that match your filters.

    Category
    Status