se-panfilov/mini-toastr

View on GitHub

Showing 5 of 5 total issues

Function flatten has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

export function flatten (obj, into, prefix) {
  into = into || {}
  prefix = prefix || EMPTY_STRING

  for (const k in obj) {
Severity: Minor
Found in mini-toastr.js - 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 fadeOut has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export function fadeOut (element, cb) {
  if (element.style.opacity && element.style.opacity > 0.05) {
    element.style.opacity = element.style.opacity - 0.05
  } else if (element.style.opacity && element.style.opacity <= 0.1) {
    if (element.parentNode) {
Severity: Minor
Found in mini-toastr.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 showMessage has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

  showMessage (message, title, type, timeout, cb, overrideConf) {
Severity: Minor
Found in mini-toastr.js - About 45 mins to fix

    Avoid too many return statements within this function.
    Open

      return EMPTY_STRING
    Severity: Major
    Found in mini-toastr.js - About 30 mins to fix

      TODO found
      Open

      | Filename | line # | TODO
      Severity: Minor
      Found in TODO.md by fixme
      Severity
      Category
      Status
      Source
      Language