rodrigogs/pulchra

View on GitHub

Showing 4 of 7 total issues

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

const _feed = instance => () => {
  let ready = true;

  if (instance.state !== instance.constructor.STATES.RUNNING) ready = false;
  if (instance._queue.length >= instance.options.concurrency) ready = false;
Severity: Minor
Found in src/Pulchra.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"

Further reading

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

const _pipe = async (instance, response, custom, pluginIndex = 0) => {
  const plugin = instance._plugins[pluginIndex];
  if (!plugin) return;

  const addFn = (url, cb) => {
Severity: Minor
Found in src/Pulchra.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"

Further reading

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

const _runner = instance => async (url) => {
  try {
    this._addQueueSize -= 1;
    const response = await instance.fetch(url);
    if (response) await _pipe(instance, response, undefined, undefined);
Severity: Minor
Found in src/Pulchra.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"

Further reading

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

const _resolveImplementation = (impl) => {
  debug('resolving implementation');

  if (typeof impl === 'string') {
    debug('received a string', 'using default storage implementation');
Severity: Minor
Found in src/Storage.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