jkroepke/featurebook-js

View on GitHub

Showing 52 of 52 total issues

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

    it('should propagate null given a directory without the summary file', (done) => {
      featurebook.readSummary('__nonexistentsummaryfile_', (err, summary) => {
        expect(err).to.be.null;
        expect(summary).to.be.null;
        done();
Severity: Major
Found in packages/featurebook-api/test/featurebook-api.test.js and 1 other location - About 2 hrs to fix
packages/featurebook-api/test/featurebook-api.test.js on lines 117..123

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

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

    it('should parse an inline-style link to another feature with a custom linkRenderer', () => {
      function linkRenderer(attrs) {
        return { ...attrs, href: `___${attrs.href}` };
      }

packages/featurebook-markdown/test/featurebook-markdown.test.js on lines 32..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 77.

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

    it('should parse an inline-style image relative to the assets directory with a custom imageRenderer', () => {
      function imageRenderer(attrs) {
        return { ...attrs, src: `___${attrs.src}` };
      }
      markdown.render('![Hello World](asset://assets/images/hello_world.png)', { imageRenderer })
packages/featurebook-markdown/test/featurebook-markdown.test.js on lines 18..25

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

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 () {
  'use strict';

  /* global angular */
  angular.module('scFeatureBook')
packages/featurebook-serve/public/scripts/person.directive.js on lines 1..19

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

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 () {
  'use strict';

  /* global angular */
  angular.module('scFeatureBook')
packages/featurebook-serve/public/scripts/gherkin-scenario.directive.js on lines 1..19

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

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

module.exports = (config) => {
  config.set({
    basePath: './../',
    frameworks: ['jasmine'],
    reporters: ['progress', 'coverage'],
Severity: Minor
Found in packages/featurebook-serve/test/karma.conf.js - About 1 hr to fix

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

      app.get('/api/rest/spec/tree', async (req, res, next) => {
        try {
          const specTree = await api.readSpecTree(specDir);
          return res.send(specTree);
        } catch (error) {
    Severity: Major
    Found in packages/featurebook-serve/lib/featurebook-serve.js and 1 other location - About 1 hr to fix
    packages/featurebook-serve/lib/featurebook-serve.js on lines 33..41

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

    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

      app.get('/api/rest/metadata', async (req, res, next) => {
        try {
          const metadata = await api.readMetadata(specDir);
    
          return res.send(metadata);
    Severity: Major
    Found in packages/featurebook-serve/lib/featurebook-serve.js and 1 other location - About 1 hr to fix
    packages/featurebook-serve/lib/featurebook-serve.js on lines 59..66

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

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

      setDocumentDefinition(styles = {}) {
        this.docDefinition = {
          defaultStyle: {
            font: 'Anaheim',
            fontSize: 12,
    Severity: Minor
    Found in packages/featurebook-pdf/lib/featurebook-pdf-generator.js - About 1 hr to fix

      Function findInDir has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

      const findInDir = async (startDir, filter) => {
        const search = async (file) => {
          const node = {
            path: path.normalize(path.relative(startDir, file)).replace(/\\/g, '/'),
            name: path.basename(file),
      Severity: Minor
      Found in packages/featurebook-api/lib/helpers.js - About 1 hr 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 processSpecTree has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

      const processSpecTree = async (specDir, specTree) => {
        const traverse = async (file) => {
          const node = {
            ...file,
            displayName: helpers.getDisplayName(file.name),
      Severity: Minor
      Found in packages/featurebook-api/lib/featurebook-api.js - About 1 hr 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 featureBookServiceFactory has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        function featureBookServiceFactory($http) {
          return {
            getMetadata: getMetadata,
            getSummary: getSummary,
            getSpecTree: getSpecTree,
      Severity: Minor
      Found in packages/featurebook-serve/public/scripts/featurebook.service.js - About 1 hr to fix

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

            beforeEach(function () {
                module('scFeatureBook');
                module('scFeatureBook.templates');
        
                inject(function (_$compile_, $rootScope) {
        packages/featurebook-serve/test/public/gherkin-data-table.directive.spec.js on lines 7..15
        packages/featurebook-serve/test/public/gherkin-step.definition.spec.js on lines 7..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 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

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

            beforeEach(function () {
                module('scFeatureBook');
                module('scFeatureBook.templates');
        
                inject(function (_$compile_, $rootScope) {
        packages/featurebook-serve/test/public/gherkin-data-table.directive.spec.js on lines 7..15
        packages/featurebook-serve/test/public/person.directive.spec.js on lines 7..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 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

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

            beforeEach(function () {
                module('scFeatureBook');
                module('scFeatureBook.templates');
        
                inject(function (_$compile_, $rootScope) {
        packages/featurebook-serve/test/public/gherkin-step.definition.spec.js on lines 7..15
        packages/featurebook-serve/test/public/person.directive.spec.js on lines 7..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 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 findInDir has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const findInDir = async (startDir, filter) => {
          const search = async (file) => {
            const node = {
              path: path.normalize(path.relative(startDir, file)).replace(/\\/g, '/'),
              name: path.basename(file),
        Severity: Minor
        Found in packages/featurebook-api/lib/helpers.js - About 1 hr to fix

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

          const processSpecTree = async (specDir, specTree) => {
            const traverse = async (file) => {
              const node = {
                ...file,
                displayName: helpers.getDisplayName(file.name),
          Severity: Minor
          Found in packages/featurebook-api/lib/featurebook-api.js - About 1 hr to fix

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

              const search = async (file) => {
                const node = {
                  path: path.normalize(path.relative(startDir, file)).replace(/\\/g, '/'),
                  name: path.basename(file),
                };
            Severity: Minor
            Found in packages/featurebook-api/lib/helpers.js - About 1 hr to fix

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

                      scope.hasDataTable = function hasDataTable() {
                        return angular.isDefined(scope.step.argument)
                          && scope.step.argument.type === 'DataTable';
                      };
              packages/featurebook-serve/public/scripts/gherkin-step.directive.js on lines 21..24

              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

                      scope.hasDocString = function hasDocString() {
                        return angular.isDefined(scope.step.argument)
                          && scope.step.argument.type === 'DocString';
                      };
              packages/featurebook-serve/public/scripts/gherkin-step.directive.js on lines 17..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 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

              Severity
              Category
              Status
              Source
              Language