XingFramework/Relayer

View on GitHub

Showing 591 of 591 total issues

Function addMethods has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  addMethods(target, resource, name) {
    target.get = function() {
      return resource.relationships[name];
    };
    target.present = function() {
Severity: Minor
Found in dist/relayer/RelationshipUtilities.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 addMethods has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  addMethods(target, resource, name) {
    target.get = function() {
      return resource.relationships[name];
    };
    target.present = function() {
Severity: Minor
Found in src/relayer/RelationshipUtilities.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 MultipleRelationshipDescription has 10 arguments (exceeds 4 allowed). Consider refactoring.
Open

  var MultipleRelationshipDescription = function MultipleRelationshipDescription(relationshipInitializerFactory, resourceMapperFactory, resourceSerializerFactory, inflector, embeddedRelationshipTransformerFactory, singleFromManyTransformerFactory, loadedDataEndpointFactory, name, ResourceClass, initialValues) {
Severity: Major
Found in dist/relayer.es5.js - About 1 hr to fix

    Function ListResourceMapper has 10 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      var ListResourceMapper = function ListResourceMapper(templatedUrlFromUrlFactory, resourceBuilderFactory, primaryResourceBuilderFactory, primaryResourceTransformerFactory, manyResourceMapperFactory, temporaryTemplatedUrlFactory, transport, response, relationshipDescription, endpoint) {
    Severity: Major
    Found in dist/relayer.es5.js - About 1 hr to fix

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

        constructor(
            templatedUrlFromUrlFactory,
            resourceBuilderFactory,
            primaryResourceBuilderFactory,
            primaryResourceTransformerFactory,
      Severity: Major
      Found in src/relayer/mappers/ListResourceMapper.js and 1 other location - About 1 hr to fix
      dist/relayer/mappers/ListResourceMapper.js on lines 12..36

      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

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

        constructor(
            templatedUrlFromUrlFactory,
            resourceBuilderFactory,
            primaryResourceBuilderFactory,
            primaryResourceTransformerFactory,
      Severity: Major
      Found in dist/relayer/mappers/ListResourceMapper.js and 1 other location - About 1 hr to fix
      src/relayer/mappers/ListResourceMapper.js on lines 12..36

      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

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

          get properties() {
            if (!this.hasOwnProperty("_properties")) {
              this._properties = Object.create(this._properties || {});
            }
            return this._properties;
      Severity: Major
      Found in dist/relayer.es5.js and 1 other location - About 1 hr to fix
      dist/relayer.es5.js on lines 3848..3853

      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

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

          get relationships() {
            if (!this.hasOwnProperty("_relationships")) {
              this._relationships = Object.create(this._relationships || {});
            }
            return this._relationships;
      Severity: Major
      Found in dist/relayer.es5.js and 1 other location - About 1 hr to fix
      dist/relayer.es5.js on lines 3854..3859

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

      var RelationshipUtilities = (function () {
        function RelationshipUtilities() {
          _classCallCheck(this, RelationshipUtilities);
        }
      
      
      Severity: Minor
      Found in dist/cjs/relayer/RelationshipUtilities.js - About 1 hr to fix

        Function _resourceFn has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              this._resourceFn = function(uriParams, recursiveCall = false) {
                if (relationship.async && this.isPersisted) {
                  var endpoint;
                  if (!this.relationships[name]) {
                    if (recursiveCall === false) {
        Severity: Minor
        Found in dist/relayer/decorators/RelatedResourceDecorator.js - About 1 hr to fix

          Function _resourceFn has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                this._resourceFn = function(uriParams, recursiveCall = false) {
                  if (relationship.async && this.isPersisted) {
                    var endpoint;
                    if (!this.relationships[name]) {
                      if (recursiveCall === false) {
          Severity: Minor
          Found in src/relayer/decorators/RelatedResourceDecorator.js - About 1 hr to fix

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

              function MapResourceSerializer(resourceSerializerFactory, resource) {
                _classCallCheck(this, MapResourceSerializer);
            
                _get(Object.getPrototypeOf(MapResourceSerializer.prototype), "constructor", this).call(this, resource);
                this.resourceSerializerFactory = resourceSerializerFactory;
            Severity: Major
            Found in dist/cjs/relayer/serializers/MapResourceSerializer.js and 3 other locations - About 1 hr to fix
            dist/cjs/relayer/serializers/ListResourceSerializer.js on lines 28..33
            dist/cjs/relayer/serializers/ManyResourceSerializer.js on lines 28..33
            dist/cjs/relayer/transformers/CreateResourceTransformer.js on lines 22..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 59.

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

              function ListResourceSerializer(manyResourceSerializerFactory, resource) {
                _classCallCheck(this, ListResourceSerializer);
            
                _get(Object.getPrototypeOf(ListResourceSerializer.prototype), "constructor", this).call(this, resource);
                this.manyResourceSerializerFactory = manyResourceSerializerFactory;
            Severity: Major
            Found in dist/cjs/relayer/serializers/ListResourceSerializer.js and 3 other locations - About 1 hr to fix
            dist/cjs/relayer/serializers/ManyResourceSerializer.js on lines 28..33
            dist/cjs/relayer/serializers/MapResourceSerializer.js on lines 28..33
            dist/cjs/relayer/transformers/CreateResourceTransformer.js on lines 22..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 59.

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

              function ManyResourceSerializer(resourceSerializerFactory, resource) {
                _classCallCheck(this, ManyResourceSerializer);
            
                _get(Object.getPrototypeOf(ManyResourceSerializer.prototype), "constructor", this).call(this, resource);
                this.resourceSerializerFactory = resourceSerializerFactory;
            Severity: Major
            Found in dist/cjs/relayer/serializers/ManyResourceSerializer.js and 3 other locations - About 1 hr to fix
            dist/cjs/relayer/serializers/ListResourceSerializer.js on lines 28..33
            dist/cjs/relayer/serializers/MapResourceSerializer.js on lines 28..33
            dist/cjs/relayer/transformers/CreateResourceTransformer.js on lines 22..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 59.

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

              function CreateResourceTransformer(relationshipDescription, uriTemplate) {
                _classCallCheck(this, CreateResourceTransformer);
            
                _get(Object.getPrototypeOf(CreateResourceTransformer.prototype), "constructor", this).call(this, relationshipDescription);
                this.uriTemplate = uriTemplate;
            Severity: Major
            Found in dist/cjs/relayer/transformers/CreateResourceTransformer.js and 3 other locations - About 1 hr to fix
            dist/cjs/relayer/serializers/ListResourceSerializer.js on lines 28..33
            dist/cjs/relayer/serializers/ManyResourceSerializer.js on lines 28..33
            dist/cjs/relayer/serializers/MapResourceSerializer.js on lines 28..33

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

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

            var LoadedDataEndpoint = (function (_ResolvedEndpoint) {
              function LoadedDataEndpoint(Promise, resolvedEndpoint, resource) {
                var resourceTransformers = arguments[3] === undefined ? [] : arguments[3];
                var createResourceTransformers = arguments[4] === undefined ? [] : arguments[4];
            
            
            Severity: Minor
            Found in dist/cjs/relayer/endpoints/LoadedDataEndpoint.js - About 1 hr to fix

              Function ResourceBuilder has 9 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                function ResourceBuilder(templatedUrlFromUrlFactory, resolvedEndpointFactory, throwErrorTransformerFactory, createResourceTransformerFactory, transport, response, primaryResourceTransformer, ResourceClass, relationshipDescription) {
              Severity: Major
              Found in dist/cjs/relayer/ResourceBuilder.js - About 1 hr to fix

                Function ResourceBuilder has 9 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                  var ResourceBuilder = function ResourceBuilder(templatedUrlFromUrlFactory, resolvedEndpointFactory, throwErrorTransformerFactory, createResourceTransformerFactory, transport, response, primaryResourceTransformer, ResourceClass, relationshipDescription) {
                Severity: Major
                Found in dist/relayer.es5.js - About 1 hr to fix

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

                      linkedEndpoint: function(parent, uriParams) {
                        var transport = parent.self().transport;
                        var url,
                            templatedUrl,
                            primaryResourceTransformer,
                  Severity: Minor
                  Found in dist/relayer.es5.js - About 1 hr to fix

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

                      function EmbeddedPropertyTransformer(path) {
                        _classCallCheck(this, EmbeddedPropertyTransformer);
                    
                        _get(Object.getPrototypeOf(EmbeddedPropertyTransformer.prototype), "constructor", this).call(this);
                        this.path = path;
                    dist/cjs/relayer/endpoints/PromiseEndpoint.js on lines 20..25
                    dist/cjs/relayer/injector.js on lines 102..107
                    dist/cjs/relayer/injector.js on lines 122..127
                    dist/cjs/relayer/injector.js on lines 150..155
                    dist/cjs/relayer/transformers/EmbeddedRelationshipTransformer.js on lines 22..27
                    dist/cjs/relayer/transformers/PrimaryResourceTransformer.js on lines 22..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 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