piotrkowalczuk/charon

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

Summary

Maintainability
D
2 days
Test Coverage

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

func (_m *PermissionProvider) Register(ctx context.Context, permissions charon.Permissions) (int64, int64, int64, error) {
    ret := _m.Called(ctx, permissions)

    var r0 int64
    if rf, ok := ret.Get(0).(func(context.Context, charon.Permissions) int64); ok {
Severity: Major
Found in internal/model/modelmock/permission_provider.go and 1 other location - About 5 hrs to fix
internal/model/modelmock/permission_registry.go on lines 29..61

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

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

func (_m *PermissionProvider) Find(ctx context.Context, criteria *model.PermissionFindExpr) ([]*model.PermissionEntity, error) {
    ret := _m.Called(ctx, criteria)

    var r0 []*model.PermissionEntity
    if rf, ok := ret.Get(0).(func(context.Context, *model.PermissionFindExpr) []*model.PermissionEntity); ok {
Severity: Major
Found in internal/model/modelmock/permission_provider.go and 4 other locations - About 3 hrs to fix
internal/model/modelmock/group_provider.go on lines 61..81
internal/model/modelmock/refresh_token_provider.go on lines 38..58
internal/model/modelmock/user_groups_provider.go on lines 57..77
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 *PermissionProvider) Insert(ctx context.Context, entity *model.PermissionEntity) (*model.PermissionEntity, error) {
    ret := _m.Called(ctx, entity)

    var r0 *model.PermissionEntity
    if rf, ok := ret.Get(0).(func(context.Context, *model.PermissionEntity) *model.PermissionEntity); ok {
Severity: Major
Found in internal/model/modelmock/permission_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/refresh_token_provider.go on lines 15..35
internal/model/modelmock/user_groups_provider.go on lines 80..100
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 3 locations. Consider refactoring.
Open

func (_m *PermissionProvider) FindByUserID(ctx context.Context, userID int64) ([]*model.PermissionEntity, error) {
    ret := _m.Called(ctx, userID)

    var r0 []*model.PermissionEntity
    if rf, ok := ret.Get(0).(func(context.Context, int64) []*model.PermissionEntity); ok {
Severity: Major
Found in internal/model/modelmock/permission_provider.go and 2 other locations - About 3 hrs to fix
internal/model/modelmock/group_provider.go on lines 84..104
internal/model/modelmock/permission_provider.go on lines 39..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 278.

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

func (_m *PermissionProvider) FindByGroupID(ctx context.Context, groupID int64) ([]*model.PermissionEntity, error) {
    ret := _m.Called(ctx, groupID)

    var r0 []*model.PermissionEntity
    if rf, ok := ret.Get(0).(func(context.Context, int64) []*model.PermissionEntity); ok {
Severity: Major
Found in internal/model/modelmock/permission_provider.go and 2 other locations - About 3 hrs to fix
internal/model/modelmock/group_provider.go on lines 84..104
internal/model/modelmock/permission_provider.go on lines 62..82

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

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

func (_m *PermissionProvider) FindOneByID(ctx context.Context, id int64) (*model.PermissionEntity, error) {
    ret := _m.Called(ctx, id)

    var r0 *model.PermissionEntity
    if rf, ok := ret.Get(0).(func(context.Context, int64) *model.PermissionEntity); ok {
Severity: Major
Found in internal/model/modelmock/permission_provider.go and 4 other locations - About 3 hrs to fix
internal/model/modelmock/group_provider.go on lines 107..127
internal/model/modelmock/refresh_token_provider.go on lines 61..81
internal/model/modelmock/user_provider.go on lines 162..182
internal/model/modelmock/user_provider.go on lines 185..205

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

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