j3lte/chanarchive

View on GitHub

Showing 12 of 18 total issues

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 runChanArchiver has 54 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function runChanArchiver(archiver) {
    
        require('http').globalAgent.maxSockets =
        require('https').globalAgent.maxSockets = Math.max(argv.threads, 10);
    
    
    Severity: Major
    Found in cli.js - About 2 hrs to fix

      Function exports has 52 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports = function (grunt) {
          grunt.initConfig({
              pkg: grunt.file.readJSON('package.json'),
              eslint: {
                  all: [
      Severity: Major
      Found in Gruntfile.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 postHandler has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              postHandler: function (postElement, $) {
                  var post = {};
          
                  post.no = $(postElement.find('.reflink a').get(1)).html() || '';
                  post.now = postElement.find('.post_header').first().contents().filter(function() {
          Severity: Minor
          Found in lib/proxy/proxies/7chan.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 startChanArchive has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function startChanArchive() {
                  _.forEach(urls, function (url) {
                      chanTypes.get(url, function (chan, returnUrl) {
                          if (chan) {
                              url = returnUrl || url;
              Severity: Minor
              Found in cli.js - About 1 hr to fix

                Function postHandler has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    postHandler: function (postElement, $) {
                        var post = {};
                
                        post.no = $(postElement.find('.reflink a').get(1)).html() || '';
                        post.now = postElement.find('.post_header').first().contents().filter(function() {
                Severity: Minor
                Found in lib/proxy/proxies/7chan.js - About 45 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 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

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

                var genericImagePostHandler = function (post) {
                    var filename = this._originalFilenames ? post.filename + '_' + post.tim : post.tim;
                    var fullFileName = filename + post.ext;
                    var fileUrl = post.fileUrl || this.picUrl + this.board + '/src/' + post.tim + post.ext;
                
                
                Severity: Minor
                Found in lib/chantypes.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

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

                        callback: function(err, update) {
                            if (err) {
                                console.log(chalk.red('\n\n Error checking the update : '), err);
                            } else {
                                if (update.latest !== update.current) {
                Severity: Minor
                Found in cli.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

                Severity
                Category
                Status
                Source
                Language