# danigb/interval-notation

### Showing 6 of 6 total issues

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

``````export function altToQ (num, alt) {
var t = typeof num === 'number' ? type(Math.abs(num)) : num
if (alt === 0) return t === 'M' ? 'M' : 'P'
else if (alt === -1 && t === 'M') return 'm'
else if (alt > 0) return fillStr('A', alt)``````
Found in index.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"

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

``````export function parse (str, strict) {
if (typeof str !== 'string') return null
var m = IVL_REGEX.exec(str)
if (!m) return null
var i = { num: +(m || m), q: m || m }``````
Found in index.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"

#### Function `qToAlt` has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open

``````export function qToAlt (num, q) {
var t = typeof num === 'number' ? type(num) : num
if (q === 'M' && t === 'M') return 0
if (q === 'P' && t === 'P') return 0
if (q === 'm' && t === 'M') return -1``````
Found in index.js - About 45 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"

#### Avoid too many `return` statements within this function. Open

``  else return null``
Found in index.js - About 30 mins to fix

#### Avoid too many `return` statements within this function. Open

``  return null``
Found in index.js - About 30 mins to fix

#### Avoid too many `return` statements within this function. Open

``  if (/^d+\$/.test(q)) return t === 'P' ? -q.length : -q.length - 1``
Found in index.js - About 30 mins to fix