camelCaseDave/xrm-mock

View on GitHub

Showing 11 of 99 total issues

ProcessManagerMock has 26 functions (exceeds 20 allowed). Consider refactoring.
Open

export class ProcessManagerMock implements Xrm.ProcessFlow.ProcessManager {
    public enabledProcesses: Xrm.Page.Process[] | Xrm.ProcessFlow.ProcessDictionary;

    constructor(enabledProcesses: Xrm.ProcessFlow.Process[]) {
        this.enabledProcesses = enabledProcesses;
Severity: Minor
Found in src/xrm-mock/processflow/processmanager/processmanager.mock.ts - About 3 hrs to fix

    ContextMock has 22 functions (exceeds 20 allowed). Consider refactoring.
    Open

    export class ContextMock implements Xrm.GlobalContext {
        public advancedConfigSetting: {[index in "MaxChildIncidentNumber" | "MaxIncidentMergeNumber"]: number };
        public client: Xrm.ClientContext;
        public clientUrl: string;
        public currentAppName: string;
    Severity: Minor
    Found in src/xrm-mock/globalcontext/context.mock.ts - About 2 hrs to fix

      Function constructor has 55 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        constructor(components: IEntityMetadataComponents) {
          this.ActivityTypeMask = components.ActivityTypeMask;
          this.Attributes = components.Attributes;
          this.AutoRouteToOwnerQueue = components.AutoRouteToOwnerQueue;
          this.CanEnableSyncToExternalSearchIndex = components.CanEnableSyncToExternalSearchIndex;
      Severity: Major
      Found in src/xrm-mock/metadata/entitymetadata/entitymetadata.mock.ts - About 2 hrs to fix

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

          private createOptionSetFromParameters(name: string,
                                                value: string | number,
                                                options: Xrm.OptionSetValue[]): XrmMock.OptionSetAttributeMock {
            let num: number;
            if (value !== null
        Severity: Minor
        Found in src/xrm-mock-generator/attribute.ts - 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 get has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            public get(param?: string | number | Xrm.Collection.MatchingDelegate<T> | T[]): T | T[] {
                if (param === undefined || param === null) {
                    return (this.itemCollection as T[]);
                } else if (typeof param === "string") {
                    let attribute: T;
        Severity: Minor
        Found in src/xrm-mock/collection/itemcollection/itemcollection.mock.ts - 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 removeOption has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            public removeOption(value: number): void {
                let option: OptionSetValueMock;
                for (const item of this.options) {
                    if (item.value === value) {
                        option = item;
        Severity: Minor
        Found in src/xrm-mock/controls/optionsetcontrol/optionsetcontrol.mock.ts - 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 createOptionSetFromParameters has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          private createOptionSetFromParameters(name: string,
                                                value: string | number,
                                                options: Xrm.OptionSetValue[]): XrmMock.OptionSetAttributeMock {
            let num: number;
            if (value !== null
        Severity: Minor
        Found in src/xrm-mock-generator/attribute.ts - About 1 hr to fix

          Function constructor has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              constructor(components: ILookupControlComponents) {
                  super(LookupControlMock.defaultComponents(components));
                  this.entityTypes = components.entityTypes || [];
                  this.filters = components.filters || [];
                  this.onLookupTagHandlers = components.onLookupTagHandlers || [];
          Severity: Minor
          Found in src/xrm-mock/controls/lookupcontrol/lookupcontrol.mock.ts - About 35 mins 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 setFormNotification has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public setFormNotification(message: string, level: Xrm.Page.ui.FormNotificationLevel, uniqueId: string): boolean {
                  let formNotificationAlreadyExists = false;
                  if (this.formNotifications && this.formNotifications.length) {
                      formNotificationAlreadyExists = this._getFormNotificationExists(this.formNotifications, uniqueId);
                  }
          Severity: Minor
          Found in src/xrm-mock/ui/ui.mock.ts - About 35 mins 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 setValue has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public setValue(value: number): void {
                  if ((this.min || this.min === 0) && this.min > value) {
                      throw new Error(("value cannot be below the min of " + this.min));
                  } else if ((this.max || this.max === 0) && this.max < value) {
                      throw new Error(("value cannot be above the max of " + this.max));
          Severity: Minor
          Found in src/xrm-mock/attributes/numberattribute/numberattribute.mock.ts - About 25 mins 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 getIsDirty has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public getIsDirty(): boolean {
                  let isDirty = false;
          
                  if (this.attributes) {
                      for (let i = 0; i < this.attributes.getLength(); i++) {
          Severity: Minor
          Found in src/xrm-mock/entity/entity.mock.ts - About 25 mins 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

          Severity
          Category
          Status
          Source
          Language