ContainerHQ/arkis-api

View on GitHub

Showing 56 of 56 total issues

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

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

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

    module.exports = function(sequelize, DataTypes) {
      let { attributes, options } = concerns.extend({
        attributes: {
          id: {
            type: DataTypes.UUID,
    Severity: Major
    Found in app/models/cluster.js - About 5 hrs to fix

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

        up: function (queryInterface, DataTypes) {
          return queryInterface.createTable('Nodes', {
            id: {
              type: DataTypes.UUID,
              primaryKey: true,
      Severity: Major
      Found in migrations/20150617102839-create-nodes-migration.js - About 4 hrs to fix

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

        router
        .get('/', middlewares.pagination, (req, res, next) => {
          Cluster
          .scope('defaultScope',
            { method: ['filtered', req.query] },
        Severity: Major
        Found in app/routes/api/v1/clusters.js and 1 other location - About 4 hrs to fix
        app/routes/api/v1/nodes.js on lines 14..30

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

        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

        router
        .get('/', middlewares.pagination, (req, res, next) => {
          Node
          .scope('defaultScope',
            { method: ['filtered', req.query] },
        Severity: Major
        Found in app/routes/api/v1/nodes.js and 1 other location - About 4 hrs to fix
        app/routes/api/v1/clusters.js on lines 14..27

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

        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 96 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: Major
        Found in app/models/user.js - About 3 hrs to fix

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

              return this.getNodes('MachineManager').then(machines => {
                return Promise.all(_.map(machines, machine => {
                  return machine.destroy().catch(err => {
                    deletionErrors.push({
                      name: err.name,
          Severity: Major
          Found in app/services/cluster_manager.js and 1 other location - About 3 hrs to fix
          app/services/account_manager.js on lines 29..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 102.

          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 this.getClusterManagers(options).then(managers => {
                  return Promise.all(_.map(managers, manager => {
                    return manager.destroy().catch(err => {
                      deletionErrors.push({
                        name: err.name,
          Severity: Major
          Found in app/services/account_manager.js and 1 other location - About 3 hrs to fix
          app/services/cluster_manager.js on lines 91..102

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

          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

            removeKey(id) {
              return new Promise((resolve, reject) => {
                this._client.accountDeleteKey(id, (err, res) => {
                  if (err) { return reject(err); }
          
          
          Severity: Major
          Found in app/connectors/machine/digital_ocean.js and 1 other location - About 3 hrs to fix
          app/connectors/machine/digital_ocean.js on lines 58..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 96.

          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

            delete(id) {
              return new Promise((resolve, reject) => {
                this._client.dropletsDelete(id, (err, res) => {
                  if (err) { return reject(err); }
          
          
          Severity: Major
          Found in app/connectors/machine/digital_ocean.js and 1 other location - About 3 hrs to fix
          app/connectors/machine/digital_ocean.js on lines 85..95

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

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

            up: function (queryInterface, DataTypes) {
              return queryInterface.createTable('Clusters', {
                id: {
                  type: DataTypes.UUID,
                  primaryKey: true,
          Severity: Major
          Found in migrations/20150616120728-create-clusters-migration.js - About 2 hrs to fix

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

                  this._client.accountAddKey(opts, (err, res, body) => {
                    if (err) { return reject(err); }
            
                    if (res.statusCode === 201) {
                      return resolve(body.ssh_key.id);
            Severity: Major
            Found in app/connectors/machine/digital_ocean.js and 1 other location - About 2 hrs to fix
            app/connectors/machine/digital_ocean.js on lines 48..55

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

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

            module.exports = function(sequelize, DataTypes) {
              let { attributes, options } = concerns.extend({
                attributes: {
                  id: {
                    type: DataTypes.UUID,
            Severity: Major
            Found in app/models/action.js - About 2 hrs to fix

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

                    this._client.dropletsCreate(opts, (err, res, body) => {
                      if (err) { return reject(err); }
              
                      if (res.statusCode === 202) {
                        return resolve(body.droplet.id);
              Severity: Major
              Found in app/connectors/machine/digital_ocean.js and 1 other location - About 2 hrs to fix
              app/connectors/machine/digital_ocean.js on lines 75..82

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

              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

              router
              .get('/', (err, res, next) => {
                let manager = new RegionSizeManager();
              
                manager.getSizes().then(sizes => {
              Severity: Major
              Found in app/routes/api/v1/sizes.js and 1 other location - About 2 hrs to fix
              app/routes/api/v1/regions.js on lines 8..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 79.

              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

              router
              .get('/', (err, res, next) => {
                let manager = new RegionSizeManager();
              
                manager.getRegions().then(regions => {
              Severity: Major
              Found in app/routes/api/v1/regions.js and 1 other location - About 2 hrs to fix
              app/routes/api/v1/sizes.js on lines 8..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 79.

              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 a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

              module.exports = function(sequelize, DataTypes) {
                let { attributes, options } = concerns.extend({
                  attributes: {
                    id: {
                      type: DataTypes.UUID,
              Severity: Minor
              Found in app/models/node.js - About 2 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 up has 52 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                up: function (queryInterface, DataTypes) {
                  return queryInterface.createTable('Users', {
                    id: {
                      type: DataTypes.INTEGER,
                      primaryKey: true,
              Severity: Major
              Found in migrations/20150528143545-create-users-migration.js - About 2 hrs to fix

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

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

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language