webcast-io/jobukyu

View on GitHub

Showing 12 of 12 total issues

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

  schema.statics.complete = function (id, metadata, cb) {
    this.findOne({_id: id, status: 'processing'}, function (err, job) {
      if (err) {
        cb(err, null);
      } else {
Severity: Major
Found in lib/models/job.js and 1 other location - About 5 hrs to fix
lib/models/job.js on lines 183..199

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

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

  schema.statics.fail = function (id, metadata, cb) {
    this.findOne({_id: id, status: 'processing'}, function (err, job) {
      if (err) {
        cb(err, null);
      } else {
Severity: Major
Found in lib/models/job.js and 1 other location - About 5 hrs to fix
lib/models/job.js on lines 157..173

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

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

function main (app) {



  function find (conditions, req, res) {
Severity: Major
Found in lib/controllers/jobs.js - About 5 hrs to fix

    Function main has 103 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function main (db) {
    
    
    
      // Define the collection schema
    Severity: Major
    Found in lib/models/job.js - About 4 hrs to fix

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

        schema.statics.take = function (id, cb) {
          this.findOne({_id: id, status: 'new'}, function (err, job) {
            if (err) {
              cb(err, null);
            } else {
      Severity: Major
      Found in lib/models/job.js and 2 other locations - About 3 hrs to fix
      lib/models/job.js on lines 134..147
      lib/models/job.js on lines 208..221

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

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

        schema.statics.retry = function (id, cb) {
          this.findOne({_id: id, status: 'failed'}, function (err, job) {
            if (err) {
              cb(err, null);
            } else {
      Severity: Major
      Found in lib/models/job.js and 2 other locations - About 3 hrs to fix
      lib/models/job.js on lines 112..125
      lib/models/job.js on lines 134..147

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

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

        schema.statics.release = function (id, cb) {
          this.findOne({_id: id, status: 'processing'}, function (err, job) {
            if (err) {
              cb(err, null);
            } else {
      Severity: Major
      Found in lib/models/job.js and 2 other locations - About 3 hrs to fix
      lib/models/job.js on lines 112..125
      lib/models/job.js on lines 208..221

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

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

        case 'put':
          request.put({url: webhook.url, body: metadata, json: true}, function(err) {
            if(err) { console.error(err); }
          });
          break;
      Severity: Major
      Found in lib/models/job.js and 2 other locations - About 1 hr to fix
      lib/models/job.js on lines 29..33
      lib/models/job.js on lines 39..43

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

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

        case 'patch':
          request.del({url: webhook.url, body: metadata, json: true}, function(err) {
            if(err) { console.error(err); }
          });
          break;
      Severity: Major
      Found in lib/models/job.js and 2 other locations - About 1 hr to fix
      lib/models/job.js on lines 29..33
      lib/models/job.js on lines 34..38

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

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

        case 'post':
          request.post({url: webhook.url, body: metadata, json: true}, function(err) {
            if(err) { console.error(err); }
          });
          break;
      Severity: Major
      Found in lib/models/job.js and 2 other locations - About 1 hr to fix
      lib/models/job.js on lines 34..38
      lib/models/job.js on lines 39..43

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

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

      function processWebhook (webhook, metadata) {
      
        // Scope the metadata to send to the job queue
        //
        if (webhook.data) {
      Severity: Minor
      Found in lib/models/job.js - About 1 hr to fix

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

        module.exports = function (grunt) {
        
          grunt.initConfig({
            jshint: {
        
        
        Severity: Minor
        Found in Gruntfile.js - About 1 hr to fix
          Severity
          Category
          Status
          Source
          Language