abelevtsov/XrmSoapSDK

View on GitHub

Showing 101 of 101 total issues

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

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

    this.setAllRecommendedAttributesToRequired = function() {
        const attributes = xrmPage.data.entity.attributes.get();
        for (let name in attributes) {
            if (attributes.hasOwnProperty(name)) {
                const attribute = attributes[name];
Severity: Major
Found in src/Xrm.Soap.Sdk/js/xrm.common.js and 1 other location - About 3 hrs to fix
src/Xrm.Soap.Sdk/js/xrm.common.js on lines 257..267

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

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.setAllMandatoryAttributesToNone = function() {
        const attributes = xrmPage.data.entity.attributes.get();
        for (let name in attributes) {
            if (attributes.hasOwnProperty(name)) {
                const attribute = attributes[name];
Severity: Major
Found in src/Xrm.Soap.Sdk/js/xrm.common.js and 1 other location - About 3 hrs to fix
src/Xrm.Soap.Sdk/js/xrm.common.js on lines 245..255

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

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

            if (columnSet && $.isArray(columnSet)) {
                columnSet = new self.ColumnSet(columnSet);
                columnSet = columnSet.serialize(false, true);
            } else if (columnSet && columnSet instanceof self.ColumnSet) {
                columnSet = columnSet.serialize(false, true);
Severity: Major
Found in src/Xrm.Soap.Sdk/js/xrm.soap.sdk.js and 1 other location - About 3 hrs to fix
src/Xrm.Soap.Sdk/js/xrm.soap.sdk.js on lines 2194..2201

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

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

                if (columnSet && $.isArray(columnSet)) {
                    columnSet = new self.ColumnSet(columnSet);
                    columnSet = columnSet.serialize(false, true);
                } else if (columnSet && columnSet instanceof self.ColumnSet) {
                    columnSet = columnSet.serialize(false, true);
Severity: Major
Found in src/Xrm.Soap.Sdk/js/xrm.soap.sdk.js and 1 other location - About 3 hrs to fix
src/Xrm.Soap.Sdk/js/xrm.soap.sdk.js on lines 2415..2422

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

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

    this.QueryExpression = (function() {
        const queryTemplate = compile(`<query i:type='a:QueryExpression' xmlns:a='${contractsXrmNs}'><%= query %></query>`);
        const criteriaTemplate = compile("<a:Criteria><%= conditions %><a:FilterOperator><%= filterOperator %></a:FilterOperator><a:Filters></a:Filters></a:Criteria>");
        const conditionsTemplate = compile("<a:Conditions><% _.each(conditions, function(condition) { %><%= condition.serialize() %><% }) %></a:Conditions>");
        const linkEntitiesTemplate = compile("<a:LinkEntities><% _.each(linkEntities, function(entity) { %><%= entity.serialize() %><% }) %></a:LinkEntities>");
Severity: Major
Found in src/Xrm.Soap.Sdk/js/xrm.soap.sdk.js - About 3 hrs to fix

    Function QueryByAttribute has 79 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        this.QueryByAttribute = (function() {
            const queryTemplate = compile(`<query i:type='a:QueryByAttribute' xmlns:a='${contractsXrmNs}'><%= query %></query>`);
            const ordersTemplate = compile("<a:Orders><% _.each(orders, function(order) { %><%= order %><% }) %></a:Orders>");
            const attributesTemplate = compile(`<a:Attributes xmlns:b='${arraysNs}'><% _.each(attributes, function(attribute) { %><%= attribute %><% }) %></a:Attributes>`);
            const valuesTemplate = compile(`<a:Values xmlns:b='${arraysNs}'><% _.each(values, function(value) { %><%= value %><% }) %></a:Values>`);
    Severity: Major
    Found in src/Xrm.Soap.Sdk/js/xrm.soap.sdk.js - About 3 hrs to fix

      Function ConditionOperator has 76 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          this.ConditionOperator = (function() {
              return {
                  Equal: "Equal",
                  NotEqual: "NotEqual",
                  GreaterThan: "GreaterThan",
      Severity: Major
      Found in src/Xrm.Soap.Sdk/js/xrm.soap.sdk.js - About 3 hrs to fix

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

                orgService.prototype.create = function(entity, async) {
                    return execute(entity.serialize(), "Create", async).then(function(resultXml) {
                        return resultXml ? $(resultXml).find("CreateResult").text() : null;
                    });
                };
        Severity: Major
        Found in src/Xrm.Soap.Sdk/js/xrm.soap.sdk.js and 1 other location - About 2 hrs to fix
        src/Xrm.Soap.Sdk/js/xrm.soap.sdk.js on lines 2371..2375

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

        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

                orgService.prototype.update = function(entity, async) {
                    return execute(entity.serialize(), "Update", async).then(function(resultXml) {
                        return resultXml ? $(resultXml).find("UpdateResponse").text() : null;
                    });
                };
        Severity: Major
        Found in src/Xrm.Soap.Sdk/js/xrm.soap.sdk.js and 1 other location - About 2 hrs to fix
        src/Xrm.Soap.Sdk/js/xrm.soap.sdk.js on lines 2352..2356

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

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

            this.ColumnSet = (function() {
                const columnsTemplate = compile(`<a:AllColumns><%= allColumns %></a:AllColumns><a:Columns xmlns:b='${arraysNs}'><% _.each(columns, function(column) { %><%= column %><% }) %></a:Columns>`);
                const columnSetTemplate = compile("<a:ColumnSet><%= columnSet %></a:ColumnSet>");
                const asLinkColumnSetTemplate = compile("<a:Columns><%= columnSet %></a:Columns>");
                const simpleColumnSetTemplate = compile(`<columnSet xmlns:a='${contractsXrmNs}'><%= columnSet %></columnSet>`);
        Severity: Major
        Found in src/Xrm.Soap.Sdk/js/xrm.soap.sdk.js - About 2 hrs to fix

          Consider simplifying this complex logical expression.
          Open

                          if (c > 96 && c < 123 || c > 64 && c < 91 || c === 32 || c > 47 && c < 58 || c === 46 || c === 44 || c === 45 || c === 95) {
                              buffer += String.fromCharCode(c);
                          } else {
                              buffer += `&#${c};`;
                          }
          Severity: Critical
          Found in src/Xrm.Soap.Sdk/js/xrm.soap.sdk.js - About 2 hrs to fix

            Function SetStateRequest has 57 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                this.SetStateRequest = (function(base) {
                    const template = compile([
                            `<request i:type='b:SetStateRequest' xmlns:a='${contractsXrmNs}' xmlns:b='${contractsCrmNs}'>`,
                              `<a:Parameters xmlns:c='${genericNs}'>`,
                                "<a:KeyValuePairOfstringanyType>",
            Severity: Major
            Found in src/Xrm.Soap.Sdk/js/xrm.soap.sdk.js - About 2 hrs to fix

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

                      ctor.prototype.pageInfo = function(/* value */) {
                          if (arguments && arguments.length === 1 && arguments[0] instanceof self.PageInfo) {
                              this.pageInfo = arguments[0];
                          }
              
              
              Severity: Major
              Found in src/Xrm.Soap.Sdk/js/xrm.soap.sdk.js and 1 other location - About 2 hrs to fix
              src/Xrm.Soap.Sdk/js/xrm.soap.sdk.js on lines 1007..1013

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 79.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

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

                      ctor.prototype.pageInfo = function(/* value */) {
                          if (arguments && arguments.length === 1 && arguments[0] instanceof self.PageInfo) {
                              this.pageInfo = arguments[0];
                          }
              
              
              Severity: Major
              Found in src/Xrm.Soap.Sdk/js/xrm.soap.sdk.js and 1 other location - About 2 hrs to fix
              src/Xrm.Soap.Sdk/js/xrm.soap.sdk.js on lines 865..871

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 79.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Function ExecuteActionRequest has 54 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  this.ExecuteActionRequest = (function(base) {
                      const template = compile([
                          `<request  xmlns:a='${contractsXrmNs}' xmlns:i='${xmlSchemaInstanceNs}' xmlns:b='${genericNs}'>`,
                            "<%= parameters %>",
                            "<a:RequestId i:nil='true'/>",
              Severity: Major
              Found in src/Xrm.Soap.Sdk/js/xrm.soap.sdk.js - About 2 hrs to fix

                Function Guid has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    this.Guid = (function() {
                        const regex = /^(\{){0,1}[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}(\}){0,1}$/;
                        const empty = "{00000000-0000-0000-0000-000000000000}";
                        const ctor = function(value) {
                            if (typeof(value) === "object" &&
                Severity: Major
                Found in src/Xrm.Soap.Sdk/js/xrm.soap.sdk.js - About 2 hrs to fix

                  Function RetrieveAttributeRequest has 51 lines of code (exceeds 25 allowed). 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 - About 2 hrs to fix

                    Function RetrieveEntityRequest has 51 lines of code (exceeds 25 allowed). 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 - About 2 hrs to fix

                      Function addNotification has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          this.addNotification = function(id, level, source, message) {
                              /// <summary>
                              /// Add a notification bar message with CRM 2011 style
                              /// </summary>
                              /// <param name="message" type="String">
                      Severity: Minor
                      Found in src/Xrm.Soap.Sdk/js/xrm.common.js - About 2 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language