abelevtsov/XrmSoapSDK

View on GitHub

Showing 101 of 101 total issues

File xrm.soap.sdk.js has 2126 lines of code (exceeds 250 allowed). Consider refactoring.
Open

(function(global) {
    global.Type.registerNamespace("Xrm.Soap.Sdk");
})(this);

(function(global) {
Severity: Major
Found in src/Xrm.Soap.Sdk/js/xrm.soap.sdk.js - About 5 days to fix

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

        this.RetrieveAttributeRequest = (function(base) {
            const template = compile([
                    `<request i:type='a:RetrieveAttributeRequest' xmlns:a='${contractsXrmNs}'>`,
                      `<a:Parameters xmlns:b='${genericNs}'>`,
                        "<a:KeyValuePairOfstringanyType>",
    Severity: Major
    Found in src/Xrm.Soap.Sdk/js/xrm.soap.sdk.js and 1 other location - About 1 day to fix
    src/Xrm.Soap.Sdk/js/xrm.soap.sdk.js on lines 1709..1765

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

    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

        this.RetrieveEntityRequest = (function(base) {
            const template = compile([
                    `<request i:type='a:RetrieveEntityRequest' xmlns:a='${contractsXrmNs}'>`,
                      `<a:Parameters xmlns:b='${genericNs}'>`,
                        "<a:KeyValuePairOfstringanyType>",
    Severity: Major
    Found in src/Xrm.Soap.Sdk/js/xrm.soap.sdk.js and 1 other location - About 1 day to fix
    src/Xrm.Soap.Sdk/js/xrm.soap.sdk.js on lines 1767..1823

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

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

        this.Entity = (function() {
            /**
             * Universal class for creating, updating and deleting any entity
             * @param {String} logicalName
             * @param {Guid} id
    Severity: Major
    Found in src/Xrm.Soap.Sdk/js/xrm.soap.sdk.js - About 1 day to fix

      Function OrganizationService has 273 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          this.OrganizationService = (function() {
              var url = splittedUrl[0] + "//" + splittedUrl[1],
                  serviceUrl = url + (splittedUrl.length === 3 && splittedUrl[2] === orgName ? (`/${orgName}`) : "") + xrmServiceUrl,
                  soapTemplate = compile([
                      utf8Root,
      Severity: Major
      Found in src/Xrm.Soap.Sdk/js/xrm.soap.sdk.js - About 1 day to fix

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

                queryByAttributeAsyncExample = function() {
                    var query = new QueryByAttribute("contact", ["firstname"], ["test"], new ColumnSet("fullname"));
                    orgService.retrieveMultipleAsync(query).then(function(contacts) {
                        for (let i = 0, l = contacts.length; i < l; i++) {
                            console.log(`FullName: ${contacts[i].getAttributeValue("fullname")}`);
        Severity: Major
        Found in src/Xrm.Soap.Sdk/js/examples.js and 1 other location - About 1 day to fix
        src/Xrm.Soap.Sdk/js/examples.js on lines 84..98

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

        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

                queryByAttributeExample = function() {
                    var query = new QueryByAttribute("contact", ["firstname"], ["test"], new ColumnSet("fullname"));
                    orgService.retrieveMultiple(query).then(function(contacts) {
                        for (let i = 0, l = contacts.length; i < l; i++) {
                            console.log(`FullName: ${contacts[i].getAttributeValue("fullname")}`);
        Severity: Major
        Found in src/Xrm.Soap.Sdk/js/examples.js and 1 other location - About 1 day to fix
        src/Xrm.Soap.Sdk/js/examples.js on lines 100..114

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

        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

        File xrm.common.js has 427 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        Type.registerNamespace("Xrm.Common");
        
        (function(global) {
            "use strict";
        
        
        Severity: Minor
        Found in src/Xrm.Soap.Sdk/js/xrm.common.js - About 6 hrs to fix

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

                  fetchExample = function() {
                      /* eslint-disable */
                      const fetchXml = [
                          "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>",
                              "<entity name='contact'>",
          Severity: Major
          Found in src/Xrm.Soap.Sdk/js/examples.js and 1 other location - About 5 hrs to fix
          src/Xrm.Soap.Sdk/js/examples.js on lines 54..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 151.

          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

                  fetchAsyncExample = function() {
                      /* eslint-disable */
                      const fetchXml = [
                          "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>",
                              "<entity name='contact'>",
          Severity: Major
          Found in src/Xrm.Soap.Sdk/js/examples.js and 1 other location - About 5 hrs to fix
          src/Xrm.Soap.Sdk/js/examples.js on lines 25..52

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

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

              this.CrmProvider = (function() {
                  const entityMetadataType = "EntityMetadata";
                  const orgService = new self.OrganizationService();
                  const crmProvider = function() {};
          
          
          Severity: Major
          Found in src/Xrm.Soap.Sdk/js/xrm.soap.sdk.js - About 5 hrs to fix

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

                            parameters: _.map(parameters, function(p) {
                                // ToDo: extract this method to common usage
                                const typed = p.value ? p.value.hasOwnProperty("type") : false;
                                return parameterTemplate({
                                    name: p.name,
            Severity: Major
            Found in src/Xrm.Soap.Sdk/js/xrm.soap.sdk.js and 1 other location - About 4 hrs to fix
            src/Xrm.Soap.Sdk/js/xrm.soap.sdk.js on lines 2012..2020

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

            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

                            parameters: _.map(parameters, function(p) {
                                // ToDo: extract this method to common usage
                                const typed = p.value ? p.value.hasOwnProperty("type") : false;
                                return parameterTemplate({
                                    name: p.name,
            Severity: Major
            Found in src/Xrm.Soap.Sdk/js/xrm.soap.sdk.js and 1 other location - About 4 hrs to fix
            src/Xrm.Soap.Sdk/js/xrm.soap.sdk.js on lines 2066..2074

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

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

                    entity.deserialize = function(resultNode) {
                        var obj = {},
                            resultNodes = resultNode.childNodes,
                            instance = new self.Entity(),
            
            
            Severity: Major
            Found in src/Xrm.Soap.Sdk/js/xrm.soap.sdk.js - About 4 hrs to fix

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

                      ctor.prototype.addOrders = function(/* order list */) {
                          if (arguments && arguments.length) {
                              let counter = this.orders.length;
                              for (var i = 0, l = arguments.length; i < l; i++) {
                                  const order = arguments[i];
              Severity: Major
              Found in src/Xrm.Soap.Sdk/js/xrm.soap.sdk.js and 2 other locations - About 4 hrs to fix
              src/Xrm.Soap.Sdk/js/xrm.soap.sdk.js on lines 954..962
              src/Xrm.Soap.Sdk/js/xrm.soap.sdk.js on lines 981..989

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

              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

                      ctor.prototype.addOrders = function(/* order list */) {
                          if (arguments && arguments.length) {
                              let counter = this.orders.length;
                              for (var i = 0, l = arguments.length; i < l; i++) {
                                  const order = arguments[i];
              Severity: Major
              Found in src/Xrm.Soap.Sdk/js/xrm.soap.sdk.js and 2 other locations - About 4 hrs to fix
              src/Xrm.Soap.Sdk/js/xrm.soap.sdk.js on lines 839..847
              src/Xrm.Soap.Sdk/js/xrm.soap.sdk.js on lines 981..989

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

              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

                      ctor.prototype.addLinks = function(/* linkEntity list */) {
                          if (arguments && arguments.length) {
                              let counter = this.linkEntities.length;
                              for (var i = 0, l = arguments.length; i < l; i++) {
                                  const linkEntity = arguments[i];
              Severity: Major
              Found in src/Xrm.Soap.Sdk/js/xrm.soap.sdk.js and 2 other locations - About 4 hrs to fix
              src/Xrm.Soap.Sdk/js/xrm.soap.sdk.js on lines 839..847
              src/Xrm.Soap.Sdk/js/xrm.soap.sdk.js on lines 954..962

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

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

                      objectifyNode = function(node) {
                          if (node.attributes && node.attributes.length === 1) {
                              var nil = node.attributes.getNamedItem("i:nil");
                              if (nil && nil.nodeValue === trueString) {
                                  return null;
              Severity: Major
              Found in src/Xrm.Soap.Sdk/js/xrm.soap.sdk.js - About 4 hrs to fix

                Function serialize has 104 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                            serialize: function() {
                                var xml = [`<entity xmlns:a='${contractsXrmNs}'>`],
                                    counter = 1;
                
                                xml[counter++] = `<a:Attributes xmlns:b='${genericNs}'>`;
                Severity: Major
                Found in src/Xrm.Soap.Sdk/js/xrm.soap.sdk.js - About 4 hrs to fix

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

                              return orgService.execute(request, async).then(function(result) {
                                  const $response = $(result).find("ExecuteResult").eq(0);
                                  return crmXmlDecode($response.text());
                              }).catch(function(err) {
                                  notify(`Ошибка:\n${err && err.description ? err.description : err}`);
                  Severity: Major
                  Found in src/Xrm.Soap.Sdk/js/xrm.soap.sdk.js and 1 other location - About 4 hrs to fix
                  src/Xrm.Soap.Sdk/js/xrm.soap.sdk.js on lines 2807..2812

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

                  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