korczis/microcrawler

View on GitHub

Showing 62 of 62 total issues

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

Object.keys(_worker).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function get() {
Severity: Major
Found in lib/worker/index.js and 7 other locations - About 2 hrs to fix
lib/app/index.js on lines 10..18
lib/collector/index.js on lines 10..18
lib/config/index.js on lines 10..18
lib/couchbase/index.js on lines 10..18
lib/elasticsearch/index.js on lines 10..18
lib/exporter/index.js on lines 10..18
lib/logger/index.js on lines 10..18

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 80.

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 8 locations. Consider refactoring.
Open

Object.keys(_exporter).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function get() {
Severity: Major
Found in lib/exporter/index.js and 7 other locations - About 2 hrs to fix
lib/app/index.js on lines 10..18
lib/collector/index.js on lines 10..18
lib/config/index.js on lines 10..18
lib/couchbase/index.js on lines 10..18
lib/elasticsearch/index.js on lines 10..18
lib/logger/index.js on lines 10..18
lib/worker/index.js on lines 10..18

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 80.

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 8 locations. Consider refactoring.
Open

Object.keys(_logger).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function get() {
Severity: Major
Found in lib/logger/index.js and 7 other locations - About 2 hrs to fix
lib/app/index.js on lines 10..18
lib/collector/index.js on lines 10..18
lib/config/index.js on lines 10..18
lib/couchbase/index.js on lines 10..18
lib/elasticsearch/index.js on lines 10..18
lib/exporter/index.js on lines 10..18
lib/worker/index.js on lines 10..18

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 80.

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 8 locations. Consider refactoring.
Open

Object.keys(_config).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function get() {
Severity: Major
Found in lib/config/index.js and 7 other locations - About 2 hrs to fix
lib/app/index.js on lines 10..18
lib/collector/index.js on lines 10..18
lib/couchbase/index.js on lines 10..18
lib/elasticsearch/index.js on lines 10..18
lib/exporter/index.js on lines 10..18
lib/logger/index.js on lines 10..18
lib/worker/index.js on lines 10..18

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 80.

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 8 locations. Consider refactoring.
Open

Object.keys(_app).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function get() {
Severity: Major
Found in lib/app/index.js and 7 other locations - About 2 hrs to fix
lib/collector/index.js on lines 10..18
lib/config/index.js on lines 10..18
lib/couchbase/index.js on lines 10..18
lib/elasticsearch/index.js on lines 10..18
lib/exporter/index.js on lines 10..18
lib/logger/index.js on lines 10..18
lib/worker/index.js on lines 10..18

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 80.

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 8 locations. Consider refactoring.
Open

Object.keys(_elasticsearch).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function get() {
Severity: Major
Found in lib/elasticsearch/index.js and 7 other locations - About 2 hrs to fix
lib/app/index.js on lines 10..18
lib/collector/index.js on lines 10..18
lib/config/index.js on lines 10..18
lib/couchbase/index.js on lines 10..18
lib/exporter/index.js on lines 10..18
lib/logger/index.js on lines 10..18
lib/worker/index.js on lines 10..18

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 80.

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

var App = function () {
  function App() {
    _classCallCheck(this, App);
  }

Severity: Minor
Found in lib/app/app.js - About 1 hr to fix

    Function Config has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var Config = function () {
      function Config() {
        _classCallCheck(this, Config);
      }
    
    
    Severity: Minor
    Found in lib/config/config.js - About 1 hr to fix

      Function loadProcessors has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function loadProcessors() {
        return new Promise((resolve, reject) => {
          const dir = path.join(__dirname, '..', '..', 'node_modules');
          fs.readdir(dir, (err, items) => {
            if (err) {
      Severity: Minor
      Found in src/helper/index.js - About 1 hr to fix

        Function requestSuperagent has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function requestSuperagent(url, retryNo = 0) {
          return new Promise((resolve, reject) => {
            let req = superagent
              .get(url)
              .timeout(config.timeout)
        Severity: Minor
        Found in src/helper/request.js - About 1 hr to fix

          Function loadProcessors has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function loadProcessors() {
            return new Promise(function (resolve, reject) {
              var dir = _path2.default.join(__dirname, '..', '..', 'node_modules');
              _fs2.default.readdir(dir, function (err, items) {
                if (err) {
          Severity: Minor
          Found in lib/helper/index.js - About 1 hr to fix

            Function requestSuperagent has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function requestSuperagent(url) {
              var retryNo = arguments.length <= 1 || arguments[1] === undefined ? 0 : arguments[1];
            
              return new Promise(function (resolve, reject) {
                var req = _superagentUse2.default.get(url).timeout(_config.config.timeout).retry(_config.config.retry.count).redirects(5);
            Severity: Minor
            Found in lib/helper/request.js - About 1 hr to fix

              Function crawl has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                crawl(args = process.argv) {
                  program
                    .version(pkg.version)
                    .parse(args);
              
              
              Severity: Minor
              Found in src/app/app.js - About 1 hr to fix

                Function crawl has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    value: function crawl() {
                      var args = arguments.length <= 0 || arguments[0] === undefined ? process.argv : arguments[0];
                
                      _commander2.default.version(_package2.default.version).parse(args);
                
                
                Severity: Minor
                Found in lib/app/app.js - About 1 hr to fix

                  Function run has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      value: function run(channel) {
                        var _this3 = this;
                  
                        channel.assertQueue(_config.config.amqp.queues.collector, {
                          durable: true
                  Severity: Minor
                  Found in lib/collector/collector.js - About 1 hr to fix

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

                    function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
                    Severity: Minor
                    Found in lib/helper/index.js and 1 other location - About 55 mins to fix
                    lib/helper/walk.js on lines 16..16

                    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 53.

                    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

                    function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
                    Severity: Minor
                    Found in lib/helper/walk.js and 1 other location - About 55 mins to fix
                    lib/helper/index.js on lines 17..17

                    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 53.

                    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

                    Identical blocks of code found in 9 locations. Consider refactoring.
                    Open

                    function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
                    Severity: Major
                    Found in lib/worker/index.js and 8 other locations - About 50 mins to fix
                    lib/app/index.js on lines 22..22
                    lib/collector/index.js on lines 22..22
                    lib/config/index.js on lines 22..22
                    lib/couchbase/index.js on lines 22..22
                    lib/elasticsearch/index.js on lines 22..22
                    lib/exporter/index.js on lines 22..22
                    lib/logger/index.js on lines 22..22
                    lib/logger/logger.js on lines 15..15

                    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 52.

                    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

                    Identical blocks of code found in 9 locations. Consider refactoring.
                    Open

                    function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
                    Severity: Major
                    Found in lib/couchbase/index.js and 8 other locations - About 50 mins to fix
                    lib/app/index.js on lines 22..22
                    lib/collector/index.js on lines 22..22
                    lib/config/index.js on lines 22..22
                    lib/elasticsearch/index.js on lines 22..22
                    lib/exporter/index.js on lines 22..22
                    lib/logger/index.js on lines 22..22
                    lib/logger/logger.js on lines 15..15
                    lib/worker/index.js on lines 22..22

                    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 52.

                    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

                    Identical blocks of code found in 9 locations. Consider refactoring.
                    Open

                    function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
                    Severity: Major
                    Found in lib/logger/index.js and 8 other locations - About 50 mins to fix
                    lib/app/index.js on lines 22..22
                    lib/collector/index.js on lines 22..22
                    lib/config/index.js on lines 22..22
                    lib/couchbase/index.js on lines 22..22
                    lib/elasticsearch/index.js on lines 22..22
                    lib/exporter/index.js on lines 22..22
                    lib/logger/logger.js on lines 15..15
                    lib/worker/index.js on lines 22..22

                    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 52.

                    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

                    Severity
                    Category
                    Status
                    Source
                    Language