Showing 119 of 121 total issues
Function getRequest
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
getRequest(queryParamMap: ParamMap): DaffCollectionRequest {
const request = DAFF_PRODUCT_COLLECTION_REQUEST_FIELDS.reduce<DaffCollectionRequest>((acc, field) => {
const qp = this.config.params[field] || field;
if (queryParamMap.has(qp)) {
const qpVal = queryParamMap.get(qp);
- 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 locationOf
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const locationOf = <T>(element: T, array: T[], comparer, start = 0, end = array.length) => {
if (array.length === 0) {
return -1;
}
- 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 transformMagentoCartGraphQlError
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function transformMagentoCartGraphQlError(error: GraphQLError, requestPayload?: unknown): DaffError {
// TODO: readdress this when we move to eslint
// eslint-disable-next-line
for (const code in DaffCartMagentoErrorMessageRegexMap) {
const matchIndex = error.message.search(DaffCartMagentoErrorMessageRegexMap[code]);
- 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 constructor
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
constructor(
private cartFacade: DaffCartFacade,
) {
this.currentStep$ = combineLatest([
this._currentStep$,
- 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
Avoid too many return
statements within this function. Open
return 'open';
Avoid too many return
statements within this function. Open
return 'closed';
Avoid too many return
statements within this function. Open
return this.resetPassword(reqInfo);
Avoid too many return
statements within this function. Open
return 'under-closed';
Avoid too many return
statements within this function. Open
return this.sendResetEmail(reqInfo);
Function validateGetBlocksResponse
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const validateGetBlocksResponse = (response: ApolloQueryResult<MagentoGetBlocksResponse>) => {
if (response.data?.cmsBlocks?.items) {
if (response.data.cmsBlocks.items.reduce((acc, block) => acc && !!(
block.identifier
&& block.content
- 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 isOpening
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const isOpening = (fromState: DaffSidebarAnimationState, toState: DaffSidebarAnimationState): boolean => {
if(fromState === 'under-open' && toState === 'open' || fromState === 'open' && toState === 'under-open') {
return false;
}
- 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 validateGetOrdersResponse
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const validateGetOrdersResponse = (response: ApolloQueryResult<MagentoGetGuestOrdersResponse>) => {
if (response.data?.graycoreGuestOrders?.items) {
if (response.data.graycoreGuestOrders.items.reduce((acc, order) => acc && !!(
order.billing_address
&& order.shipping_address
- 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 list
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
list(cartId?: string, request: DaffCollectionRequest = {}): Observable<DaffOrderCollection> {
const variables: MagentoCustomerOrderListQueryVariables = {
currentPage: request.currentPage,
pageSize: request.pageSize,
};
- 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 post
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
post(reqInfo) {
if (reqInfo.id === 'login') {
return this.login(reqInfo);
} else if (reqInfo.id === 'register') {
return this.register(reqInfo);
- 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 getVariables
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private getVariables(options: DaffSearchProductDriverOptions = {}) {
const queryVariables = {
filter: this.productFilterRequestsTransformer.transform(options.filterRequests),
};
if (options.pageSize || options.limit) {
- 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 validateGetOrdersResponse
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const validateGetOrdersResponse = (response: ApolloQueryResult<MagentoGetGuestOrdersResponse>) => {
if (response.data?.graycoreGuestOrders?.orders) {
if (response.data.graycoreGuestOrders.orders.reduce((acc, order) => acc && !!(
order.billing_address
&& order.shipping_address
- 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 traverseRouteTree
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const traverseRouteTree = (routes: Routes = [], matcher: (route: Route) => boolean, operate: RouteOperator): Routes => {
if(routes.length === 0) {
return routes;
}
- 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 ngOnChanges
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
ngOnChanges(changes: SimpleChanges): void {
if(!changes.tree.currentValue) {
this._tree = undefined;
this.flatTree = [];
return;
- 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 $process
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
$process(docs: Document[]) {
const ret = docs.map((doc) => {
if (this.docTypes.includes(doc.docType)) {
doc[this.contentKey] = this.marked.parse(doc.content);
if (doc.kind === DaffDocKind.PACKAGE || doc.kind === DaffDocKind.COMPONENT) {
- 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"