feathersjs/feathers-generator

View on GitHub

Showing 88 of 88 total issues

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

    connection: {
      host : options.host || '127.0.0.1',
      user : options.user || user,
      password : options.pass || '', // this needs to be a better way
      database: options.db || 'feathers'
src/service/templates/models/postgres/templates/service.model.js on lines 12..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 60.

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

export default function() {

  var env = process.env.NODE_ENV;
  var dir = env === 'production' ? 'lib' : 'src';

Severity: Major
Found in src/repo/templates/src/index/index.js and 5 other locations - About 1 hr to fix
examples/filter/src/index/index.js on lines 1..7
examples/hook/src/index/index.js on lines 1..7
examples/plugin/src/index/index.js on lines 1..7
examples/repo/src/index/index.js on lines 1..7
examples/service/src/index/index.js on lines 1..7

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

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

export default function() {

  var env = process.env.NODE_ENV;
  var dir = env === 'production' ? 'lib' : 'src';

Severity: Major
Found in examples/plugin/src/index/index.js and 5 other locations - About 1 hr to fix
examples/filter/src/index/index.js on lines 1..7
examples/hook/src/index/index.js on lines 1..7
examples/repo/src/index/index.js on lines 1..7
examples/service/src/index/index.js on lines 1..7
src/repo/templates/src/index/index.js on lines 1..7

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

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

export default function() {

  var env = process.env.NODE_ENV;
  var dir = env === 'production' ? 'lib' : 'src';

Severity: Major
Found in examples/service/src/index/index.js and 5 other locations - About 1 hr to fix
examples/filter/src/index/index.js on lines 1..7
examples/hook/src/index/index.js on lines 1..7
examples/plugin/src/index/index.js on lines 1..7
examples/repo/src/index/index.js on lines 1..7
src/repo/templates/src/index/index.js on lines 1..7

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

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

export default function() {

  var env = process.env.NODE_ENV;
  var dir = env === 'production' ? 'lib' : 'src';

Severity: Major
Found in examples/filter/src/index/index.js and 5 other locations - About 1 hr to fix
examples/hook/src/index/index.js on lines 1..7
examples/plugin/src/index/index.js on lines 1..7
examples/repo/src/index/index.js on lines 1..7
examples/service/src/index/index.js on lines 1..7
src/repo/templates/src/index/index.js on lines 1..7

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

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

      const questions = metadata.meta.prompts.map(prompt => {
        const question = Object.assign({}, prompt);

        if (!prompt.name) {
          throw new Error(`Invalid prompt. You must provide a 'name'. ${prompt}`);
Severity: Minor
Found in src/utils/ask.js - About 1 hr to fix

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

    export function plugin (options) {
      return function mount (files, metalsmith, done) {
        // if not mounting, skip
        if (!options.mount) {
          return done(null);
    Severity: Minor
    Found in src/utils/mount.js - About 1 hr to fix

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

      export default function (options) {
      
        const debug = require('debug')(`feathers:service:${options.table}:postgres`)
      
        const model = client({
      Severity: Minor
      Found in src/service/templates/models/postgres/templates/service.model.js - About 1 hr to fix

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

          return function rename (files, metalsmith, done) {
            const meta = metalsmith.metadata();
        
            // if generating standalone and this is default service, use index
            let index = (path.parse(options.root).name === options.name && options.path === '.');
        Severity: Minor
        Found in src/utils/rename.js - About 1 hr to fix

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

          export default function (options) {
          
            const debug = require('debug')(`feathers:service:${options.table}:mysql`)
          
            const model = client({
          Severity: Minor
          Found in src/service/templates/models/mysql/templates/service.model.js - About 1 hr to fix

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

              return function mount (files, metalsmith, done) {
                // if not mounting, skip
                if (!options.mount) {
                  return done(null);
                }
            Severity: Minor
            Found in src/utils/mount.js - About 1 hr to fix

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

              describe('{{options.name}} filter tests', function () {
                it('filter ran', function () {
                  const filter = createFilter();
              
                  assert.equal(filter({}).ran, true);
              Severity: Major
              Found in src/filter/templates/filter.test.js and 5 other locations - About 1 hr to fix
              examples/filter/src/index.test.js on lines 6..12
              examples/hook/src/index.test.js on lines 6..12
              examples/plugin/src/index.test.js on lines 6..11
              src/hook/templates/hook.test.js on lines 4..10
              src/plugin/templates/plugin.test.js on lines 4..9

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

              describe('hook hook tests', function () {
                it('hook ran', function () {
                  var hook = createHook();
              
                  assert.equal(hook({}).ran, true);
              Severity: Major
              Found in examples/hook/src/index.test.js and 5 other locations - About 1 hr to fix
              examples/filter/src/index.test.js on lines 6..12
              examples/plugin/src/index.test.js on lines 6..11
              src/filter/templates/filter.test.js on lines 4..10
              src/hook/templates/hook.test.js on lines 4..10
              src/plugin/templates/plugin.test.js on lines 4..9

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

              describe('filter filter tests', function () {
                it('filter ran', function () {
                  var filter = createFilter();
              
                  assert.equal(filter({}).ran, true);
              Severity: Major
              Found in examples/filter/src/index.test.js and 5 other locations - About 1 hr to fix
              examples/hook/src/index.test.js on lines 6..12
              examples/plugin/src/index.test.js on lines 6..11
              src/filter/templates/filter.test.js on lines 4..10
              src/hook/templates/hook.test.js on lines 4..10
              src/plugin/templates/plugin.test.js on lines 4..9

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

              describe('plugin middleware tests', function () {
                it('middleware ran', function () {
                  var mw = createMiddleware();
                  assert.equal(mw({}).ran, true);
                });
              Severity: Major
              Found in examples/plugin/src/index.test.js and 5 other locations - About 1 hr to fix
              examples/filter/src/index.test.js on lines 6..12
              examples/hook/src/index.test.js on lines 6..12
              src/filter/templates/filter.test.js on lines 4..10
              src/hook/templates/hook.test.js on lines 4..10
              src/plugin/templates/plugin.test.js on lines 4..9

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

              describe('{{options.name}} middleware tests', function () {
                it('middleware ran', function () {
                  const mw = createMiddleware();
                  assert.equal(mw({}).ran, true);
                });
              Severity: Major
              Found in src/plugin/templates/plugin.test.js and 5 other locations - About 1 hr to fix
              examples/filter/src/index.test.js on lines 6..12
              examples/hook/src/index.test.js on lines 6..12
              examples/plugin/src/index.test.js on lines 6..11
              src/filter/templates/filter.test.js on lines 4..10
              src/hook/templates/hook.test.js on lines 4..10

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

              describe('{{options.name}} hook tests', function() {
                it('hook ran', function() {
                  const hook = createHook();
              
                  assert.equal(hook({}).ran, true);
              Severity: Major
              Found in src/hook/templates/hook.test.js and 5 other locations - About 1 hr to fix
              examples/filter/src/index.test.js on lines 6..12
              examples/hook/src/index.test.js on lines 6..12
              examples/plugin/src/index.test.js on lines 6..11
              src/filter/templates/filter.test.js on lines 4..10
              src/plugin/templates/plugin.test.js on lines 4..9

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

              export default function (options) {
              
                const debug = require('debug')(`feathers:service:${options.table}:sqlite`)
              
                const model = client({
              Severity: Minor
              Found in src/service/templates/models/sqlite/templates/service.model.js - About 1 hr to fix

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

                        if (prompt.when) {
                          question.when = answers => {
                            return evaluate(prompt.when, Object.assign({ answers }, data));
                          };
                        }
                Severity: Major
                Found in src/utils/ask.js and 2 other locations - About 1 hr to fix
                src/utils/ask.js on lines 45..49
                src/utils/ask.js on lines 51..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 55.

                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

                        if (prompt.filter) {
                          question.filter = input => {
                            return evaluate(prompt.filter, Object.assign({ input }, data));
                          };
                        }
                Severity: Major
                Found in src/utils/ask.js and 2 other locations - About 1 hr to fix
                src/utils/ask.js on lines 39..43
                src/utils/ask.js on lines 51..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 55.

                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