InfluxOW/laravel_ddd_ecommerce

View on GitHub

Showing 18 of 18 total issues

Similar blocks of code found in 3 locations. Consider refactoring.
Open

                        Grid::make()
                            ->schema([
                                TextInput::makeTranslated(AttributeTranslationKey::TITLE)
                                    ->required()
                                    ->reactive()
app/Domains/Catalog/Admin/Resources/ProductResource.php on lines 68..86
app/Domains/News/Admin/Resources/ArticleResource.php on lines 59..77

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 148.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

                        Grid::make()
                            ->schema([
                                TextInput::makeTranslated(ProductTranslationKey::TITLE)
                                    ->required()
                                    ->reactive()
Severity: Major
Found in app/Domains/Catalog/Admin/Resources/ProductResource.php and 2 other locations - About 3 hrs to fix
app/Components/Attributable/Admin/Resources/AttributeResource.php on lines 55..73
app/Domains/News/Admin/Resources/ArticleResource.php on lines 59..77

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 148.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

                        Grid::make()
                            ->schema([
                                TextInput::makeTranslated(ArticleTranslationKey::TITLE)
                                    ->required()
                                    ->reactive()
Severity: Major
Found in app/Domains/News/Admin/Resources/ArticleResource.php and 2 other locations - About 3 hrs to fix
app/Components/Attributable/Admin/Resources/AttributeResource.php on lines 55..73
app/Domains/Catalog/Admin/Resources/ProductResource.php on lines 68..86

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 148.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    protected function rows(): Collection
    {
        return collect([
            ExportColumn::create(ArticleTranslationKey::ID, NumberFormat::FORMAT_NUMBER),
            ExportColumn::create(ArticleTranslationKey::TITLE),
Severity: Major
Found in app/Domains/News/Jobs/Export/NewsExportJob.php and 1 other location - About 3 hrs to fix
app/Domains/Users/Jobs/Export/UsersExportJob.php on lines 25..37

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 146.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    protected function rows(): Collection
    {
        return collect([
            ExportColumn::create(UserTranslationKey::ID, NumberFormat::FORMAT_NUMBER),
            ExportColumn::create(UserTranslationKey::NAME),
Severity: Major
Found in app/Domains/Users/Jobs/Export/UsersExportJob.php and 1 other location - About 3 hrs to fix
app/Domains/News/Jobs/Export/NewsExportJob.php on lines 20..32

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 146.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    protected function rows(): Collection
    {
        return collect([
            ExportColumn::create(ProductCategoryTranslationKey::ID, NumberFormat::FORMAT_NUMBER),
            ExportColumn::create(ProductCategoryTranslationKey::TITLE),
app/Domains/Catalog/Jobs/Export/ProductsExportJob.php on lines 29..41

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 140.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    protected function rows(): Collection
    {
        return collect([
            ExportColumn::create(ProductTranslationKey::ID, NumberFormat::FORMAT_NUMBER),
            ExportColumn::create(ProductTranslationKey::TITLE),
Severity: Major
Found in app/Domains/Catalog/Jobs/Export/ProductsExportJob.php and 1 other location - About 2 hrs to fix
app/Domains/Catalog/Jobs/Export/ProductCategoriesExportJob.php on lines 27..39

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 140.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

final class ProductCategory extends Model implements HasMedia, Exportable
{
    use HasExtendedFunctionality;
    use HasFactory;
    use HasSlug;
Severity: Minor
Found in app/Domains/Catalog/Models/ProductCategory.php - About 2 hrs to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                            TextInput::makeTranslated(AdminTranslationKey::PASSWORD)
                                ->required(fn (Page $livewire): bool => $livewire instanceof CreateRecord)
                                ->password()
                                ->hidden(fn (Page $livewire): bool => $livewire instanceof ViewRecord)
                                ->dehydrated(fn (?string $state): bool => isset($state))
    Severity: Major
    Found in app/Domains/Admin/Admin/Resources/AdminResource.php and 1 other location - About 2 hrs to fix
    app/Domains/Users/Admin/Resources/UserResource.php on lines 92..101

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 123.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                            TextInput::makeTranslated(UserTranslationKey::PASSWORD)
                                ->required(fn (Page $livewire): bool => $livewire instanceof CreateRecord)
                                ->password()
                                ->hidden(fn (Page $livewire): bool => $livewire instanceof ViewRecord)
                                ->dehydrated(fn (?string $state): bool => isset($state))
    Severity: Major
    Found in app/Domains/Users/Admin/Resources/UserResource.php and 1 other location - About 2 hrs to fix
    app/Domains/Admin/Admin/Resources/AdminResource.php on lines 77..86

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 123.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Function getIp has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getIp(): Closure
        {
            return function (): ?string {
                $remotesKeys = [
                    'HTTP_X_FORWARDED_FOR',
    Severity: Minor
    Found in app/Domains/Common/Mixins/RequestMixin.php - 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 reorderHierarchy has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function reorderHierarchy(array $updates, int $depth = 0, ?self $parent = null): void
        {
            $hierarchy = self::getHierarchy();
    
            $categoriesById = [];
    Severity: Minor
    Found in app/Domains/Catalog/Models/ProductCategory.php - 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

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                    TextInput::makeTranslated(AttributeValueTranslationKey::VALUE_INTEGER)
                        ->required()
                        ->integer()
                        ->hidden(fn (callable $get): bool => $get(AttributeValueTranslationKey::ATTRIBUTE->value) === null)
                        ->visible(fn (callable $get): bool => Attribute::query()->where('id', $get(AttributeValueTranslationKey::ATTRIBUTE->value))->first()?->values_type === AttributeValuesType::INTEGER),
    app/Components/Attributable/Admin/RelationManagers/AttributeValuesRelationManager.php on lines 55..59

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 101.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                    TextInput::makeTranslated(AttributeValueTranslationKey::VALUE_FLOAT)
                        ->required()
                        ->numeric()
                        ->hidden(fn (callable $get): bool => $get(AttributeValueTranslationKey::ATTRIBUTE->value) === null)
                        ->visible(fn (callable $get): bool => Attribute::query()->where('id', $get(AttributeValueTranslationKey::ATTRIBUTE->value))->first()?->values_type === AttributeValuesType::FLOAT),
    app/Components/Attributable/Admin/RelationManagers/AttributeValuesRelationManager.php on lines 50..54

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 101.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        public function append(): array
        {
            $appends = parent::append();
    
            /** @var ?Money $price */
    Severity: Minor
    Found in app/Domains/Catalog/Http/Requests/ProductIndexRequest.php and 1 other location - About 55 mins to fix
    app/Domains/News/Http/Requests/ArticleIndexRequest.php on lines 39..49

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 98.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        public function append(): array
        {
            $appends = parent::append();
    
            /** @var ?Carbon $date */
    Severity: Minor
    Found in app/Domains/News/Http/Requests/ArticleIndexRequest.php and 1 other location - About 55 mins to fix
    app/Domains/Catalog/Http/Requests/ProductIndexRequest.php on lines 46..56

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 98.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

                Select::makeTranslated(CatalogSettingsTranslationKey::AVAILABLE_CURRENCIES)
                    ->multiple()
                    ->required()
                    ->options(function (callable $get): array {
                        $currencies = collect(Currency::getCurrencies());
    Severity: Minor
    Found in app/Domains/Catalog/Admin/Pages/ManageCatalogSettings.php and 1 other location - About 30 mins to fix
    app/Domains/Catalog/Admin/Pages/ManageCatalogSettings.php on lines 38..53

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 90.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

                Select::makeTranslated(CatalogSettingsTranslationKey::REQUIRED_CURRENCIES)
                    ->multiple()
                    ->required()
                    ->options(function (callable $get): array {
                        $currencies = collect(Currency::getCurrencies());
    Severity: Minor
    Found in app/Domains/Catalog/Admin/Pages/ManageCatalogSettings.php and 1 other location - About 30 mins to fix
    app/Domains/Catalog/Admin/Pages/ManageCatalogSettings.php on lines 23..37

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 90.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Severity
    Category
    Status
    Source
    Language