SockDrawer/SockBot

View on GitHub
providers/nodebb/index.js

Summary

Maintainability
C
7 hrs
Test Coverage

File index.js has 273 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';
/**
 * NodeBB provider module
 * @module sockbot.providers.nodebb
 * @author Accalia
Severity: Minor
Found in providers/nodebb/index.js - About 2 hrs to fix

Forum has 21 functions (exceeds 20 allowed). Consider refactoring.
Open

class Forum extends EventEmitter {

    /**
     * Get announced compatibilities string for the provider
     */
Severity: Minor
Found in providers/nodebb/index.js - About 2 hrs to fix

Function login has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    login() {
        const errorify = (err) => {
            if (!(err instanceof Error)) {
                err = new Error(err);
            }
Severity: Minor
Found in providers/nodebb/index.js - About 1 hr to fix

Function _getConfig has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _getConfig() {
        this._verifyCookies();
        this._config = {};
        return new Promise((resolve, reject) => {
            debug('begin configuration fetch for CSRF token');
Severity: Minor
Found in providers/nodebb/index.js - About 1 hr to fix

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

    _emitWithRetry(delay) {
        let trials = 5;
        const args = Array.prototype.slice.call(arguments);
        args.shift(); // remove the delay parameter
        const fn = () => new Promise((resolve, reject) => {
Severity: Minor
Found in providers/nodebb/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

There are no issues that match your filters.

Category
Status