j3lte/chanarchive

View on GitHub
lib/chanarchive.js

Summary

Maintainability
B
6 hrs
Test Coverage

Function handleNext has 54 lines of code (exceeds 25 allowed). Consider refactoring.
Open

ChanArchiver.prototype.handleNext = function () {

    var save = function (exists) {

        handleFile.existed = exists;
Severity: Major
Found in lib/chanarchive.js - About 2 hrs to fix

    Function handleNext has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    ChanArchiver.prototype.handleNext = function () {
    
        var save = function (exists) {
    
            handleFile.existed = exists;
    Severity: Minor
    Found in lib/chanarchive.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 ChanArchiver has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function ChanArchiver (options) {
    
        if (!(this instanceof ChanArchiver)) {
            return new ChanArchiver(options);
        }
    Severity: Minor
    Found in lib/chanarchive.js - About 1 hr to fix

      Function parsePage has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      ChanArchiver.prototype.parsePage = function (error, response, body) {
          var _this = this;
          if (!error && response.statusCode === 200 && response.headers['content-type'].indexOf('application/json') === 0) {
              var storageFolder = this.saveFolder + this.board + '/' + this.thread + '/';
              mkdirp(storageFolder, function(err) {
      Severity: Minor
      Found in lib/chanarchive.js - About 1 hr to fix

        Function ChanArchiver has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        function ChanArchiver (options) {
        
            if (!(this instanceof ChanArchiver)) {
                return new ChanArchiver(options);
            }
        Severity: Minor
        Found in lib/chanarchive.js - About 35 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