piotrkowalczuk/charon

View on GitHub
internal/model/modelmock/user_groups_provider.go

Summary

Maintainability
C
1 day
Test Coverage

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

func (_m *UserGroupsProvider) Find(ctx context.Context, expr *model.UserGroupsFindExpr) ([]*model.UserGroupsEntity, error) {
    ret := _m.Called(ctx, expr)

    var r0 []*model.UserGroupsEntity
    if rf, ok := ret.Get(0).(func(context.Context, *model.UserGroupsFindExpr) []*model.UserGroupsEntity); ok {
Severity: Major
Found in internal/model/modelmock/user_groups_provider.go and 4 other locations - About 3 hrs to fix
internal/model/modelmock/group_provider.go on lines 61..81
internal/model/modelmock/permission_provider.go on lines 16..36
internal/model/modelmock/refresh_token_provider.go on lines 38..58
internal/model/modelmock/user_provider.go on lines 139..159

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 296.

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 8 locations. Consider refactoring.
Open

func (_m *UserGroupsProvider) Insert(ctx context.Context, ent *model.UserGroupsEntity) (*model.UserGroupsEntity, error) {
    ret := _m.Called(ctx, ent)

    var r0 *model.UserGroupsEntity
    if rf, ok := ret.Get(0).(func(context.Context, *model.UserGroupsEntity) *model.UserGroupsEntity); ok {
Severity: Major
Found in internal/model/modelmock/user_groups_provider.go and 7 other locations - About 3 hrs to fix
internal/model/modelmock/group_permissions_provider.go on lines 15..35
internal/model/modelmock/group_provider.go on lines 130..150
internal/model/modelmock/permission_provider.go on lines 108..128
internal/model/modelmock/refresh_token_provider.go on lines 15..35
internal/model/modelmock/user_permissions_provider.go on lines 36..56
internal/model/modelmock/user_provider.go on lines 51..71
internal/model/modelmock/user_provider.go on lines 208..228

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 288.

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

func (_m *UserGroupsProvider) Exists(ctx context.Context, userID int64, groupID int64) (bool, error) {
    ret := _m.Called(ctx, userID, groupID)

    var r0 bool
    if rf, ok := ret.Get(0).(func(context.Context, int64, int64) bool); ok {
Severity: Major
Found in internal/model/modelmock/user_groups_provider.go and 1 other location - About 2 hrs to fix
internal/model/modelmock/user_provider.go on lines 252..270

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 242.

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 6 locations. Consider refactoring.
Open

func (_m *UserGroupsProvider) DeleteByUserID(ctx context.Context, id int64) (int64, error) {
    ret := _m.Called(ctx, id)

    var r0 int64
    if rf, ok := ret.Get(0).(func(context.Context, int64) int64); ok {
Severity: Major
Found in internal/model/modelmock/user_groups_provider.go and 5 other locations - About 2 hrs to fix
internal/model/modelmock/group_provider.go on lines 40..58
internal/model/modelmock/user_permissions_provider.go on lines 15..33
internal/model/modelmock/user_provider.go on lines 97..115
internal/model/modelmock/user_provider.go on lines 118..136
internal/model/modelmock/user_provider.go on lines 308..326

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 228.

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

There are no issues that match your filters.

Category
Status