tunnckoCore/gibon

View on GitHub

Showing 164 of 164 total issues

Function inArray has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function inArray(arr, val) {
  const items = [arr].flat().filter(Boolean);
  const len = items.length;
  let i = null;

Severity: Minor
Found in modules/arr-includes/src/index.js - About 25 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 parse has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export function parse(commits, options) {
  const result = toArray(commits)
    .filter(Boolean)
    .reduce((acc, val) => {
      if (typeof val === 'string') {
Severity: Minor
Found in @packages/parse-commit-message/src/main.js - About 25 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 defaultOptions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export function defaultOptions(options = {}) {
  const cfg = { ...options };

  const types = defaultTypes(cfg.extendTypes);
  const opts = extend(
Severity: Minor
Found in @packages/koa-better-body/src/utils.js - About 25 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 checkHeader has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export function checkHeader(header, options) {
  // handy trick to suppress/mute typescript
  if (header && typeof header === 'object' && 'value' in header) {
    const { value } = header;
    return stringToHeader(value, options);
Severity: Minor
Found in @packages/parse-commit-message/src/header.js - About 25 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

Severity
Category
Status
Source
Language