wbio/reviews-collector-android

View on GitHub

Showing 342 of 342 total issues

Function collect has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
Open

    collect() {
        // Preserve our reference to 'this'
        const self = this;
        // Get a list of app IDs
        const appIds = _.keys(self.apps);
Severity: Minor
Found in src/index.js - About 7 hrs 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 collect has 135 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    collect() {
        // Preserve our reference to 'this'
        const self = this;
        // Get a list of app IDs
        const appIds = _.keys(self.apps);
Severity: Major
Found in src/index.js - About 5 hrs to fix

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

    'use strict';
    
    const Crawler = require('node-webcrawler');
    const cheerio = require('cheerio');
    const _ = require('lodash');
    Severity: Minor
    Found in src/index.js - About 2 hrs to fix

      Function parse has 49 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              function parse(result) {
                  const html = responseToHtml(result);
                  if (typeof html === 'undefined') {
                      // We got an invalid response
                      requeue();
      Severity: Minor
      Found in src/index.js - About 1 hr to fix

        Line 23 exceeds the maximum line length of 100.
        Open

                    userAgent: 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.85 Safari/537.36',
        Severity: Minor
        Found in src/index.js by eslint

        enforce a maximum line length (max-len)

        Very long lines of code in any language can be difficult to read. In order to aid in readability and maintainability many coders have developed a convention to limit lines of code to X number of characters (traditionally 80 characters).

        var foo = { "bar": "This is a bar.", "baz": { "qux": "This is a qux" }, "difficult": "to read" }; // very long

        Rule Details

        This rule enforces a maximum line length to increase code readability and maintainability. The length of a line is defined as the number of Unicode characters in the line.

        Options

        This rule has a number or object option:

        • "code" (default 80) enforces a maximum line length
        • "tabWidth" (default 4) specifies the character width for tab characters
        • "comments" enforces a maximum line length for comments; defaults to value of code
        • "ignorePattern" ignores lines matching a regular expression; can only match a single line and need to be double escaped when written in YAML or JSON
        • "ignoreComments": true ignores all trailing comments and comments on their own line
        • "ignoreTrailingComments": true ignores only trailing comments
        • "ignoreUrls": true ignores lines that contain a URL
        • "ignoreStrings": true ignores lines that contain a double-quoted or single-quoted string
        • "ignoreTemplateLiterals": true ignores lines that contain a template literal
        • "ignoreRegExpLiterals": true ignores lines that contain a RegExp literal

        code

        Examples of incorrect code for this rule with the default { "code": 80 } option:

        /*eslint max-len: ["error", 80]*/
        
        var foo = { "bar": "This is a bar.", "baz": { "qux": "This is a qux" }, "difficult": "to read" };

        Examples of correct code for this rule with the default { "code": 80 } option:

        /*eslint max-len: ["error", 80]*/
        
        var foo = {
          "bar": "This is a bar.",
          "baz": { "qux": "This is a qux" },
          "easier": "to read"
        };

        tabWidth

        Examples of incorrect code for this rule with the default { "tabWidth": 4 } option:

        /*eslint max-len: ["error", 80, 4]*/
        
        \t  \t  var foo = { "bar": "This is a bar.", "baz": { "qux": "This is a qux" } };

        Examples of correct code for this rule with the default { "tabWidth": 4 } option:

        /*eslint max-len: ["error", 80, 4]*/
        
        \t  \t  var foo = {
        \t  \t  \t  \t  "bar": "This is a bar.",
        \t  \t  \t  \t  "baz": { "qux": "This is a qux" }
        \t  \t  };

        comments

        Examples of incorrect code for this rule with the { "comments": 65 } option:

        /*eslint max-len: ["error", { "comments": 65 }]*/
        
        /**
         * This is a comment that violates the maximum line length we have specified
        **/

        ignoreComments

        Examples of correct code for this rule with the { "ignoreComments": true } option:

        /*eslint max-len: ["error", { "ignoreComments": true }]*/
        
        /**
         * This is a really really really really really really really really really long comment
        **/

        ignoreTrailingComments

        Examples of correct code for this rule with the { "ignoreTrailingComments": true } option:

        /*eslint max-len: ["error", { "ignoreTrailingComments": true }]*/
        
        var foo = 'bar'; // This is a really really really really really really really long comment

        ignoreUrls

        Examples of correct code for this rule with the { "ignoreUrls": true } option:

        /*eslint max-len: ["error", { "ignoreUrls": true }]*/
        
        var url = 'https://www.example.com/really/really/really/really/really/really/really/long';

        ignoreStrings

        Examples of correct code for this rule with the { "ignoreStrings": true } option:

        /*eslint max-len: ["error", { "ignoreStrings": true }]*/
        
        var longString = 'this is a really really really really really long string!';

        ignoreTemplateLiterals

        Examples of correct code for this rule with the { "ignoreTemplateLiterals": true } option:

        /*eslint max-len: ["error", { "ignoreTemplateLiterals": true }]*/
        
        var longTemplateLiteral = `this is a really really really really really long template literal!`;

        ignoreRegExpLiterals

        Examples of correct code for this rule with the { "ignoreRegExpLiterals": true } option:

        /*eslint max-len: ["error", { "ignoreRegExpLiterals": true }]*/
        
        var longRegExpLiteral = /this is a really really really really really long regular expression!/;

        ignorePattern

        Examples of correct code for this rule with the { "ignorePattern": true } option:

        /*eslint max-len: ["error", { "ignorePattern": "^\\s*var\\s.+=\\s*require\\s*\\(/" }]*/
        
        var dep = require('really/really/really/really/really/really/really/really/long/module');

        Related Rules

        • [complexity](complexity.md)
        • [max-depth](max-depth.md)
        • [max-nested-callbacks](max-nested-callbacks.md)
        • [max-params](max-params.md)
        • [max-statements](max-statements.md) Source: http://eslint.org/docs/rules/

        Function htmlToReviews has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function htmlToReviews(html, appId, pageNum, emit) {
            try {
                const $ = cheerio.load(html);
                const reviewObjs = $('.single-review');
                const reviews = [];
        Severity: Minor
        Found in src/index.js - About 1 hr to fix

          Function constructor has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              constructor(apps, options) {
                  if (options && options.maxPages && options.checkBeforeContinue) {
                      console.error('Warning: The \'maxPages\' option will be ignored when \'checkBeforeContinue\' is present');
                  }
                  const defaults = {
          Severity: Minor
          Found in src/index.js - About 1 hr to fix

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

            function responseToHtml(response) {
                if (response.headers['content-type'] === 'application/json; charset=utf-8') {
                    try {
                        const decoded = decodeUnicode(decodeUTF8(response.body));
                        const body = JSON.parse(removeLeadingChars(decoded));
            Severity: Minor
            Found in src/index.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

            Avoid too many return statements within this function.
            Open

                return undefined;
            Severity: Major
            Found in src/index.js - About 30 mins to fix

              Unexpected tab character.
              Open

                              } else {
              Severity: Minor
              Found in src/index.js by eslint

              disallow all tabs (no-tabs)

              Some style guides don't allow the use of tab characters at all, including within comments.

              Rule Details

              This rule looks for tabs anywhere inside a file: code, comments or anything else.

              Examples of incorrect code for this rule:

              var a /t= 2;
              
              /**
              * /t/t it's a test function
              */
              function test(){}
              
              var x = 1; // /t test

              Examples of correct code for this rule:

              var a = 2;
              
              /**
              * it's a test function
              */
              function test(){}
              
              var x = 1; // test

              When Not To Use It

              If you have established a standard where having tabs is fine.

              Compatibility

              Unexpected tab character.
              Open

                          } else {
              Severity: Minor
              Found in src/index.js by eslint

              disallow all tabs (no-tabs)

              Some style guides don't allow the use of tab characters at all, including within comments.

              Rule Details

              This rule looks for tabs anywhere inside a file: code, comments or anything else.

              Examples of incorrect code for this rule:

              var a /t= 2;
              
              /**
              * /t/t it's a test function
              */
              function test(){}
              
              var x = 1; // /t test

              Examples of correct code for this rule:

              var a = 2;
              
              /**
              * it's a test function
              */
              function test(){}
              
              var x = 1; // test

              When Not To Use It

              If you have established a standard where having tabs is fine.

              Compatibility

              Unexpected tab character.
              Open

                          }
              Severity: Minor
              Found in src/index.js by eslint

              disallow all tabs (no-tabs)

              Some style guides don't allow the use of tab characters at all, including within comments.

              Rule Details

              This rule looks for tabs anywhere inside a file: code, comments or anything else.

              Examples of incorrect code for this rule:

              var a /t= 2;
              
              /**
              * /t/t it's a test function
              */
              function test(){}
              
              var x = 1; // /t test

              Examples of correct code for this rule:

              var a = 2;
              
              /**
              * it's a test function
              */
              function test(){}
              
              var x = 1; // test

              When Not To Use It

              If you have established a standard where having tabs is fine.

              Compatibility

              Unexpected tab character.
              Open

                              const postData = {
              Severity: Minor
              Found in src/index.js by eslint

              disallow all tabs (no-tabs)

              Some style guides don't allow the use of tab characters at all, including within comments.

              Rule Details

              This rule looks for tabs anywhere inside a file: code, comments or anything else.

              Examples of incorrect code for this rule:

              var a /t= 2;
              
              /**
              * /t/t it's a test function
              */
              function test(){}
              
              var x = 1; // /t test

              Examples of correct code for this rule:

              var a = 2;
              
              /**
              * it's a test function
              */
              function test(){}
              
              var x = 1; // test

              When Not To Use It

              If you have established a standard where having tabs is fine.

              Compatibility

              Unexpected tab character.
              Open

                                  uri: url,
              Severity: Minor
              Found in src/index.js by eslint

              disallow all tabs (no-tabs)

              Some style guides don't allow the use of tab characters at all, including within comments.

              Rule Details

              This rule looks for tabs anywhere inside a file: code, comments or anything else.

              Examples of incorrect code for this rule:

              var a /t= 2;
              
              /**
              * /t/t it's a test function
              */
              function test(){}
              
              var x = 1; // /t test

              Examples of correct code for this rule:

              var a = 2;
              
              /**
              * it's a test function
              */
              function test(){}
              
              var x = 1; // test

              When Not To Use It

              If you have established a standard where having tabs is fine.

              Compatibility

              Unexpected tab character.
              Open

                       */
              Severity: Minor
              Found in src/index.js by eslint

              disallow all tabs (no-tabs)

              Some style guides don't allow the use of tab characters at all, including within comments.

              Rule Details

              This rule looks for tabs anywhere inside a file: code, comments or anything else.

              Examples of incorrect code for this rule:

              var a /t= 2;
              
              /**
              * /t/t it's a test function
              */
              function test(){}
              
              var x = 1; // /t test

              Examples of correct code for this rule:

              var a = 2;
              
              /**
              * it's a test function
              */
              function test(){}
              
              var x = 1; // test

              When Not To Use It

              If you have established a standard where having tabs is fine.

              Compatibility

              Unexpected tab character.
              Open

                              requeue();
              Severity: Minor
              Found in src/index.js by eslint

              disallow all tabs (no-tabs)

              Some style guides don't allow the use of tab characters at all, including within comments.

              Rule Details

              This rule looks for tabs anywhere inside a file: code, comments or anything else.

              Examples of incorrect code for this rule:

              var a /t= 2;
              
              /**
              * /t/t it's a test function
              */
              function test(){}
              
              var x = 1; // /t test

              Examples of correct code for this rule:

              var a = 2;
              
              /**
              * it's a test function
              */
              function test(){}
              
              var x = 1; // test

              When Not To Use It

              If you have established a standard where having tabs is fine.

              Compatibility

              Expected empty line after require statement not followed by another require.
              Open

              const EventEmitter = require('events').EventEmitter;
              Severity: Minor
              Found in src/index.js by eslint

              For more information visit Source: http://eslint.org/docs/rules/

              Unexpected tab character.
              Open

                      if (_.isArray(apps)) {
              Severity: Minor
              Found in src/index.js by eslint

              disallow all tabs (no-tabs)

              Some style guides don't allow the use of tab characters at all, including within comments.

              Rule Details

              This rule looks for tabs anywhere inside a file: code, comments or anything else.

              Examples of incorrect code for this rule:

              var a /t= 2;
              
              /**
              * /t/t it's a test function
              */
              function test(){}
              
              var x = 1; // /t test

              Examples of correct code for this rule:

              var a = 2;
              
              /**
              * it's a test function
              */
              function test(){}
              
              var x = 1; // test

              When Not To Use It

              If you have established a standard where having tabs is fine.

              Compatibility

              Unexpected tab character.
              Open

                              }
              Severity: Minor
              Found in src/index.js by eslint

              disallow all tabs (no-tabs)

              Some style guides don't allow the use of tab characters at all, including within comments.

              Rule Details

              This rule looks for tabs anywhere inside a file: code, comments or anything else.

              Examples of incorrect code for this rule:

              var a /t= 2;
              
              /**
              * /t/t it's a test function
              */
              function test(){}
              
              var x = 1; // /t test

              Examples of correct code for this rule:

              var a = 2;
              
              /**
              * it's a test function
              */
              function test(){}
              
              var x = 1; // test

              When Not To Use It

              If you have established a standard where having tabs is fine.

              Compatibility

              Unexpected tab character.
              Open

                  /**
              Severity: Minor
              Found in src/index.js by eslint

              disallow all tabs (no-tabs)

              Some style guides don't allow the use of tab characters at all, including within comments.

              Rule Details

              This rule looks for tabs anywhere inside a file: code, comments or anything else.

              Examples of incorrect code for this rule:

              var a /t= 2;
              
              /**
              * /t/t it's a test function
              */
              function test(){}
              
              var x = 1; // /t test

              Examples of correct code for this rule:

              var a = 2;
              
              /**
              * it's a test function
              */
              function test(){}
              
              var x = 1; // test

              When Not To Use It

              If you have established a standard where having tabs is fine.

              Compatibility

              Severity
              Category
              Status
              Source
              Language