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;
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;
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;
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
- Read upRead up
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;
- Read upRead up
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;
- Read upRead up
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
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 || [];
- Read upRead up
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);
}
- Read upRead up
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));
- Read upRead up
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++) {
- Read upRead up
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"