j3lte/chanarchive

View on GitHub

Showing 18 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

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                    '4chan': {
                        alias: '4chan',
                        templateUrl: 'http://boards.4chan.org/%s/thread/%s',
                        regEx: /^http:\/\/boards\.4chan\.org\/(\w)+\/thread\/(\d)+/,
                        baseUrl: 'http://a.4cdn.org/',
                Severity: Minor
                Found in lib/chantypes.js and 1 other location - About 50 mins to fix
                lib/chantypes.js on lines 50..60

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 51.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                    '8chan': {
                        alias: '8chan',
                        templateUrl: 'https://8ch.net/%s/res/%s.html',
                        regEx: /^https:\/\/8ch\.net\/(\w)+\/res\/(\d+)\.html.*/,
                        baseUrl: 'https://8ch.net/',
                Severity: Minor
                Found in lib/chantypes.js and 1 other location - About 50 mins to fix
                lib/chantypes.js on lines 30..40

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 51.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                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

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                            } else if (file.completed) {
                                console.log(' [ %s ] File : %s saved as %s', archiverName, chalk.green(file.url), chalk.green(file.fileName));
                            }
                Severity: Minor
                Found in cli.js and 1 other location - About 40 mins to fix
                cli.js on lines 129..131

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 49.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                            '    KRAUTCHAN ' + chalk.yellow('*') + ' :: http://krautchan.net/' + chalk.cyan('<BOARD>') + '/thread-' + chalk.cyan('<THREAD>') + '.html',
                Severity: Minor
                Found in cli.js and 1 other location - About 40 mins to fix
                cli.js on lines 51..51

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 49.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                            if (argv.debug) {
                                console.log(' [ %s ] File start : %s, size: %s bytes', archiverName, chalk.green(file.url), chalk.green(file.size));
                            }
                Severity: Minor
                Found in cli.js and 1 other location - About 40 mins to fix
                cli.js on lines 136..138

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 49.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                            '    7CHAN ' + chalk.yellow('*') + '     :: http://7chan.org/' + chalk.cyan('<BOARD>') + '/res/' + chalk.cyan('<THREAD>') + '.html',
                Severity: Minor
                Found in cli.js and 1 other location - About 40 mins to fix
                cli.js on lines 54..54

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 49.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                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