ContainerHQ/arkis-api

View on GitHub

Showing 56 of 56 total issues

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

        state_message: function() {
          let state = this.get('state');

          switch (state) {
            case 'empty':
Severity: Major
Found in app/models/node.js and 1 other location - About 1 hr to fix
app/models/cluster.js on lines 90..107

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

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

      name: {
        type: DataTypes.STRING,
        allowNull: false,
        defaultValue: null,
        validate: _.merge({ len: [1, 64] },
Severity: Major
Found in app/models/cluster.js and 1 other location - About 1 hr to fix
app/models/node.js on lines 50..58

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

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

      name: {
        type: DataTypes.STRING,
        allowNull: false,
        defaultValue: null,
        validate: _.merge({ len: [1, 64] },
Severity: Major
Found in app/models/node.js and 1 other location - About 1 hr to fix
app/models/cluster.js on lines 41..49

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

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

  getSizes() {
    return Promise.resolve([{
      slug: '48gb',
      memory: 49152,
      disk: 480,
Severity: Minor
Found in app/connectors/fakes/machine.js - About 1 hr to fix

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

    module.exports = function(req, res, next) {
      req.docker = CURRENT_DOCKER;
      res.docker = function(opts={}, callback=opts) {
        let stream = opts.stream || false,
          type = opts.type || 'application/json',
    Severity: Minor
    Found in app/middlewares/docker.js - About 1 hr to fix

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

        up: function (queryInterface, DataTypes) {
          return queryInterface.createTable('Profiles', {
            id: {
              type: DataTypes.INTEGER,
              primaryKey: true,
      Severity: Minor
      Found in migrations/20150604151434-create-profiles-migration.js - About 1 hr to fix

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

          static _createCertificate({ type, key, ca }) {
            return new Promise((resolve, reject) => {
              let options = _.merge({
                clientKey: key,
                clientKeyPassword: config.secrets.ssl,
        Severity: Minor
        Found in app/connectors/cert.js - About 1 hr to fix

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

            up: function (queryInterface, DataTypes) {
              return queryInterface.createTable('UserProviderLinks', {
                id: {
                  type: DataTypes.INTEGER,
                  primaryKey: true,
          Severity: Minor
          Found in migrations/20151006033215-create-user-provider-link-migration.js - About 1 hr to fix

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

            module.exports = function(req, res, next) {
              req.pagination = {
                limit:  parseInt(req.query.limit  || DEFAULT_LIMIT),
                offset: parseInt(req.query.offset || DEFAULT_OFFSET),
                group:  ['id']
            Severity: Minor
            Found in app/middlewares/pagination.js - About 1 hr to fix

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

              router
              .param('token', middlewares.tokenDecoder)
              .param('token', (req, res, next) => {
                Node.findById(req.token.jit).then(node => {
                  if (!node) { return res.notFound(); }
              Severity: Major
              Found in app/routes/api/v1/agent.js and 1 other location - About 1 hr to fix
              app/routes/api/v1/agent.js on lines 15..39

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

              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

                encrypt(text) {
                  let cipher = crypto.createCipher(this.algorithm, this.password);
              
                  return cipher.update(text, 'utf8', 'hex') + cipher.final('hex');
                }
              Severity: Major
              Found in app/support/encryption.js and 1 other location - About 1 hr to fix
              app/support/encryption.js on lines 16..20

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

              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

                decrypt(text) {
                  let decipher = crypto.createDecipher(this.algorithm, this.password);
              
                  return decipher.update(text, 'hex', 'utf8') + decipher.final('utf8');
                }
              Severity: Major
              Found in app/support/encryption.js and 1 other location - About 1 hr to fix
              app/support/encryption.js on lines 11..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 58.

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

              module.exports = function(sequelize, DataTypes) {
                let { attributes, options } = concerns.extend({
                  attributes: {
                   id: {
                     type: DataTypes.INTEGER,
              Severity: Minor
              Found in app/models/profile.js - About 1 hr to fix

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

                    }, {
                      slug: '64gb',
                      memory: 65536,
                      disk: 640,
                      transfer: 9,
                Severity: Major
                Found in app/connectors/fakes/machine.js and 1 other location - About 1 hr to fix
                app/connectors/fakes/machine.js on lines 31..50

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

                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

                  down: function (queryInterface) {
                    return queryInterface.removeIndex('Nodes', ['name', 'cluster_id'], {
                      indicesType: 'UNIQUE'
                    }).then(function() {
                      return queryInterface.dropTable('Nodes');
                Severity: Major
                Found in migrations/20150617102839-create-nodes-migration.js and 1 other location - About 1 hr to fix
                migrations/20150528143545-create-users-migration.js on lines 59..65

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

                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

                    return Promise.resolve([{
                      slug: '48gb',
                      memory: 49152,
                      disk: 480,
                      transfer: 8,
                Severity: Major
                Found in app/connectors/fakes/machine.js and 1 other location - About 1 hr to fix
                app/connectors/fakes/machine.js on lines 50..69

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

                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

                  down: function (queryInterface) {
                    return queryInterface.removeIndex('Users', ['provider', 'provider_id'], {
                      indicesType: 'UNIQUE'
                    }).then(function() {
                      return queryInterface.dropTable('Users');
                Severity: Major
                Found in migrations/20150528143545-create-users-migration.js and 1 other location - About 1 hr to fix
                migrations/20150617102839-create-nodes-migration.js on lines 125..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 57.

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

                module.exports = function(sequelize, DataTypes) {
                  return sequelize.define('UserProviderLink', {
                    id: {
                      type: DataTypes.INTEGER,
                      primaryKey: true,
                Severity: Minor
                Found in app/models/user_providers_link.js - About 1 hr to fix

                  Function destroy has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    destroy() {
                      return sequelize.transaction(t => {
                        let options = { transaction: t }, deletionErrors = [];
                  
                        return this.getClusterManagers(options).then(managers => {
                  Severity: Minor
                  Found in app/services/account_manager.js - About 1 hr to fix

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

                    module.exports = function(req, res, next) {
                      res.notFound = function() {
                        res.status(404).json({
                          name: 'not_found',
                          message: 'The requested resource cannot be found.'
                    Severity: Minor
                    Found in app/middlewares/res_handler.js - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language