Showing 121 of 123 total issues
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,
Function getByUrl
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
getByUrl(categoryRequest: DaffCategoryUrlRequest): Observable<DaffGetCategoryResponse> {
return combineLatest([
this.apollo.query<MagentoCategoryUrlResolverResponse>({
query: MagentoResolveCategoryUrl,
variables: {
Function daffMagentoTransformTotals
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function daffMagentoTransformTotals(totals: MagentoOrderTotal): DaffOrderTotal[] {
return [
{
label: 'Subtotal',
type: DaffOrderTotalTypeEnum.Subtotal,
Function daffOperationStateSelectorFactory
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function daffOperationStateSelectorFactory <
TRootState,
TState extends DaffOperationState = DaffOperationState
>(
selectState: Selector<TRootState, TState>,
Function constructor
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
constructor(
injector: Injector,
private componentFactoryResolver: ComponentFactoryResolver,
) {
[
Function forRoot
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static forRoot(config: DaffProductMagentoDriverConfig = MAGENTO_PRODUCT_CONFIG_DEFAULT): ModuleWithProviders<DaffProductMagentoDriverModule> {
return {
ngModule: DaffProductMagentoDriverModule,
providers: [
{
Function transformItem
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function transformItem(item: MagentoGraycoreOrderItem): DaffOrderItem {
return {
id: null,
item_id: null,
type: DaffOrderItemType.Simple,
Function load
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
load(name: string, script: DaffExternalScript): Observable<boolean> {
// Don't load the same script twice.
if(this.scriptMap.has(name)){
return this.scriptMap.get(name).subject;
}
Function delegateRequest
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private delegateRequest(reqInfo: RequestInfo) {
reqInfo.collection = this.carts;
switch (reqInfo.collectionName) {
case 'cart':
Function createCategoryFeatureSelectors
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const createCategoryFeatureSelectors = <V extends DaffGenericCategory<V>>(): DaffCategoryEntitiesMemoizedSelectors<V> => {
const entitiesSelectors = daffCategoryEntitiesAdapter<V>().getSelectors();
const categoryFeatureState = getDaffCategoryFeatureSelector<V>().selectCategoryFeatureState;
Function createBestSellersSelectors
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const createBestSellersSelectors = <T extends DaffProduct>(): DaffBestSellersMemoizedSelectors<T> => {
const {
selectAllProducts,
} = getDaffProductEntitiesSelectors<T>();
const {
Function createAuthorizeNetSelectors
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const createAuthorizeNetSelectors = (): DaffAuthorizeNetMemoizedSelectors => {
/**
* AuthorizeNet Feature State
*/
Function app
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function app(): express.Express {
const server = express();
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const distFolder = join(__dirname, '../browser');
Function createCategoryPageSelectors
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const createCategoryPageSelectors = <V extends DaffGenericCategory<V>>(): DaffCategoryPageMemoizedSelectors<V> => {
const selectCategoryFeatureState = getDaffCategoryFeatureSelector<V>().selectCategoryFeatureState;
const selectCategoryState = createSelector(
selectCategoryFeatureState,
Function createCountryEntitySelectors
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const createCountryEntitySelectors = <T extends DaffCountry = DaffCountry>() => {
const { selectGeographyFeatureState } = getDaffGeographyFeatureStateSelector<T>();
const selectCountryEntitiesState = createSelector(
selectGeographyFeatureState,
state => state.countries,
Function getMaxPricesForConfigurationIncludingOptionalItems
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
function getMaxPricesForConfigurationIncludingOptionalItems(product: DaffCompositeProduct, appliedOptions: Dictionary<DaffCompositeProductItemOption>): DaffProductPrices {
return {
discountedPrice: product.items.reduce((acc, item) => daffAdd(
acc,
appliedOptionHasId(appliedOptions[item.id]) ?
- 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 createCartItemEntitiesSelectors
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
const createCartItemEntitiesSelectors = <
T extends DaffCart = DaffCart,
V extends DaffCartOrderResult = DaffCartOrderResult,
Configurable extends DaffConfigurableCartItem = DaffConfigurableCartItem,
Composite extends DaffCompositeCartItem = DaffCompositeCartItem,
- 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 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
list(cartId?: DaffCart['id']): Observable<DaffOrderCollection> {
return this.apollo.query<MagentoGetGuestOrdersResponse>({
query: getGuestOrders(this.extraOrderFragments),
variables: {
cartId,
Function addItem
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private addItem(reqInfo: RequestInfo): DaffCart {
const cart = this.getCart(reqInfo);
const cartIndex = reqInfo.collection.findIndex(c => c.id === reqInfo.id);
const itemInput = reqInfo.utils.getJsonBody(reqInfo.req);
const existingCartItemIndex = cart.items.findIndex(item => item.product_id === itemInput.productId);
Function list
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
list(cartId?: DaffCart['id']): Observable<DaffOrderCollection> {
return this.apollo.query<MagentoGetGuestOrdersResponse>({
query: getGuestOrders(this.extraOrderFragments),
variables: {
cartId,