Showing 120 of 122 total issues
Function daffCartItemEntitiesReducer
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function daffCartItemEntitiesReducer<
T extends DaffCart = DaffCart,
U extends DaffCartItemInput = DaffCartItemInput,
>(
state = daffCartItemEntitiesAdapter<T['items'][number]>().getInitialState(),
Function cartShippingAddressReducer
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function cartShippingAddressReducer<T extends DaffCart>(
state = daffCartReducerInitialState,
action: ActionTypes,
): DaffCartReducerState<T> {
switch (action.type) {
Function cartShippingInformationReducer
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function cartShippingInformationReducer<T extends DaffCart = DaffCart>(
state = daffCartReducerInitialState,
action: ActionTypes<T>,
): DaffCartReducerState<T> {
switch (action.type) {
Function cartBillingAddressReducer
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function cartBillingAddressReducer<T extends DaffCart = DaffCart>(
state = daffCartReducerInitialState,
action: ActionTypes<T>,
): DaffCartReducerState<T> {
switch (action.type) {
Function createCompositeProductAppliedOptionsEntitiesSelectors
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Open
const createCompositeProductAppliedOptionsEntitiesSelectors = <T extends DaffProduct>(): DaffCompositeProductEntitiesMemoizedSelectors<T> => {
const {
selectCompositeProductState,
} = getDaffCompositeProductFeatureSelector();
const {
- 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 ngAfterContentChecked
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
ngAfterContentChecked() {
const nextShift = sidebarViewportContentShift(this.sidebars) + 'px';
if (this._shift !== nextShift) {
this._shift = nextShift;
Function createConfigurableProductAppliedAttributesEntitiesSelectors
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const createConfigurableProductAppliedAttributesEntitiesSelectors = <T extends DaffProduct>(): DaffConfigurableProductEntitiesMemoizedSelectors<T> => {
const {
selectConfigurableProductState,
} = getDaffConfigurableProductFeatureSelector();
const adapterSelectors = daffConfigurableProductAppliedAttributesEntitiesAdapter().getSelectors();
Function constructor
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
constructor(
private productFactory: DaffProductExtensionFactory,
private productImageFactory: DaffProductImageFactory) {
this._products = [
'1001',
Function createProductReviewEntitiesSelectors
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const createProductReviewEntitiesSelectors = <T extends DaffProductReview = DaffProductReview>(): DaffProductReviewEntitiesMemoizedSelectors<T> => {
const {
selectReviewsState,
} = getDaffReviewsFeatureSelector<T>();
const adapterSelectors = daffProductReviewEntitiesAdapter<T>().getSelectors();
Function fakeTree
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private fakeTree(depth: number = 0): DaffNavigationTree {
const children = depth !== 0
? [...Array(faker.datatype.number({ min:1, max:3 }))].map(() => this.fakeTree(depth - 1))
: [];
Function daffAuthorizeNetReducer
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function daffAuthorizeNetReducer <T extends DaffAuthorizeNetTokenRequest>(
state: DaffAuthorizeNetReducerState = daffAuthorizeNetReducerInitialState,
action: DaffAuthorizeNetActions<T> | DaffPaymentActions,
): DaffAuthorizeNetReducerState {
switch (action.type) {
Function daffColorMixin
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
export function
daffColorMixin<T extends Constructor<HasElementRef>>(Base: T, defaultColor?: DaffPalette) {
class DaffColorableMixinClass extends Base {
//TODO move this back to private in Typescript 3.1
_color: DaffPalette;
- 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 open
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
open(
toast: DaffToastData,
configuration?: Partial<DaffToastConfiguration>,
): DaffToast {
if(this._parentToast && this.options.useParent) {
Function daffMagentoTransformItem
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function daffMagentoTransformItem(item: MagentoOrderItem, order: MagentoOrder, qty: number): DaffOrderItem {
const discount = item.discounts.reduce((acc, d) => daffAdd(acc, d.amount.value), 0);
const rowTotal = qty * item.product_sale_price.value;
const rowTotalWithDiscount = qty * daffSubtract(item.product_sale_price.value, discount);
Function daffMagentoCustomerOrderTransformItem
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function daffMagentoCustomerOrderTransformItem(item: MagentoOrderItem, order: MagentoCustomerOrder, qty: number): DaffOrderItem {
const discount = item.discounts.reduce((acc, d) => daffAdd(acc, d.amount.value), 0);
const rowTotal = qty * item.product_sale_price.value;
const rowTotalWithDiscount = qty * daffSubtract(item.product_sale_price.value, discount);
Function forRoot
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static forRoot(config: DaffCategoryMagentoDriverConfig = MAGENTO_CATEGORY_CONFIG_DEFAULT): ModuleWithProviders<DaffCategoryMagentoDriverModule> {
return {
ngModule: DaffCategoryMagentoDriverModule,
providers: [
{
Function listOrders
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private listOrders(reqInfo: RequestInfo) {
const request: DaffCollectionRequest | null = reqInfo.utils.getJsonBody(reqInfo.req);
const pageSize = request?.pageSize || DEFAULT_PAGE_SIZE;
const currentPage = request?.currentPage || 1;
const orders: DaffOrder[] = reqInfo.collection;
Function createProductPageSelectors
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const createProductPageSelectors = <T extends DaffProductReview = DaffProductReview>(): DaffProductPageReviewsMemoizedSelectors => {
const {
selectReviewsState,
} = getDaffReviewsFeatureSelector<T>();
Function transformTotals
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function transformTotals(totals: {
grand_total: number;
subtotal: number;
shipping: number;
discount: number;
Function daffMagentoCustomerOrderTransformTotals
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function daffMagentoCustomerOrderTransformTotals(totals: MagentoOrderTotal): DaffOrderTotal[] {
return [
{
label: 'Subtotal',
type: DaffOrderTotalTypeEnum.Subtotal,