piotrkowalczuk/charon

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

Summary

Maintainability
F
5 days
Test Coverage

Method UserProvider.CreateSuperuser has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

func (_m *UserProvider) CreateSuperuser(ctx context.Context, username string, password []byte, FirstName string, LastName string) (*model.UserEntity, error) {
Severity: Minor
Found in internal/model/modelmock/user_provider.go - About 35 mins to fix

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

    func (_m *UserProvider) SetPermissions(ctx context.Context, id int64, permissions ...charon.Permission) (int64, int64, error) {
        _va := make([]interface{}, len(permissions))
        for _i := range permissions {
            _va[_i] = permissions[_i]
        }
    Severity: Major
    Found in internal/model/modelmock/user_provider.go and 1 other location - About 6 hrs to fix
    internal/model/modelmock/group_provider.go on lines 174..206

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

    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 *UserProvider) UpdateOneByID(_a0 context.Context, _a1 int64, _a2 *model.UserPatch) (*model.UserEntity, error) {
        ret := _m.Called(_a0, _a1, _a2)
    
        var r0 *model.UserEntity
        if rf, ok := ret.Get(0).(func(context.Context, int64, *model.UserPatch) *model.UserEntity); ok {
    Severity: Major
    Found in internal/model/modelmock/user_provider.go and 2 other locations - About 3 hrs to fix
    internal/model/modelmock/group_provider.go on lines 209..229
    internal/model/modelmock/refresh_token_provider.go on lines 107..127

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

    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 *UserProvider) Find(_a0 context.Context, _a1 *model.UserFindExpr) ([]*model.UserEntity, error) {
        ret := _m.Called(_a0, _a1)
    
        var r0 []*model.UserEntity
        if rf, ok := ret.Get(0).(func(context.Context, *model.UserFindExpr) []*model.UserEntity); ok {
    Severity: Major
    Found in internal/model/modelmock/user_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_groups_provider.go on lines 57..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 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 *UserProvider) Insert(_a0 context.Context, _a1 *model.UserEntity) (*model.UserEntity, error) {
        ret := _m.Called(_a0, _a1)
    
        var r0 *model.UserEntity
        if rf, ok := ret.Get(0).(func(context.Context, *model.UserEntity) *model.UserEntity); ok {
    Severity: Major
    Found in internal/model/modelmock/user_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_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

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

    func (_m *UserProvider) Create(_a0 context.Context, _a1 *model.UserEntity) (*model.UserEntity, error) {
        ret := _m.Called(_a0, _a1)
    
        var r0 *model.UserEntity
        if rf, ok := ret.Get(0).(func(context.Context, *model.UserEntity) *model.UserEntity); ok {
    Severity: Major
    Found in internal/model/modelmock/user_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_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 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 5 locations. Consider refactoring.
    Open

    func (_m *UserProvider) FindOneByUsername(_a0 context.Context, _a1 string) (*model.UserEntity, error) {
        ret := _m.Called(_a0, _a1)
    
        var r0 *model.UserEntity
        if rf, ok := ret.Get(0).(func(context.Context, string) *model.UserEntity); ok {
    Severity: Major
    Found in internal/model/modelmock/user_provider.go and 4 other locations - About 3 hrs to fix
    internal/model/modelmock/group_provider.go on lines 107..127
    internal/model/modelmock/permission_provider.go on lines 85..105
    internal/model/modelmock/refresh_token_provider.go on lines 61..81
    internal/model/modelmock/user_provider.go on lines 162..182

    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

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

    func (_m *UserProvider) FindOneByID(_a0 context.Context, _a1 int64) (*model.UserEntity, error) {
        ret := _m.Called(_a0, _a1)
    
        var r0 *model.UserEntity
        if rf, ok := ret.Get(0).(func(context.Context, int64) *model.UserEntity); ok {
    Severity: Major
    Found in internal/model/modelmock/user_provider.go and 4 other locations - About 3 hrs to fix
    internal/model/modelmock/group_provider.go on lines 107..127
    internal/model/modelmock/permission_provider.go on lines 85..105
    internal/model/modelmock/refresh_token_provider.go on lines 61..81
    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

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

    func (_m *UserProvider) IsGranted(ctx context.Context, id int64, permission charon.Permission) (bool, error) {
        ret := _m.Called(ctx, id, permission)
    
        var r0 bool
        if rf, ok := ret.Get(0).(func(context.Context, int64, charon.Permission) bool); ok {
    Severity: Major
    Found in internal/model/modelmock/user_provider.go and 1 other location - About 3 hrs to fix
    internal/model/modelmock/group_provider.go on lines 153..171

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

    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 *UserProvider) RegistrationConfirmation(ctx context.Context, id int64, confirmationToken string) (int64, error) {
        ret := _m.Called(ctx, id, confirmationToken)
    
        var r0 int64
        if rf, ok := ret.Get(0).(func(context.Context, int64, string) int64); ok {
    Severity: Major
    Found in internal/model/modelmock/user_provider.go and 1 other location - About 2 hrs to fix
    internal/model/modelmock/user_groups_provider.go on lines 36..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 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 *UserProvider) UpdateLastLoginAt(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_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_groups_provider.go on lines 15..33
    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

    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

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

    func (_m *UserProvider) DeleteOneByID(_a0 context.Context, _a1 int64) (int64, error) {
        ret := _m.Called(_a0, _a1)
    
        var r0 int64
        if rf, ok := ret.Get(0).(func(context.Context, int64) int64); ok {
    Severity: Major
    Found in internal/model/modelmock/user_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_groups_provider.go on lines 15..33
    internal/model/modelmock/user_permissions_provider.go on lines 15..33
    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

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

    func (_m *UserProvider) Exists(_a0 context.Context, _a1 int64) (bool, error) {
        ret := _m.Called(_a0, _a1)
    
        var r0 bool
        if rf, ok := ret.Get(0).(func(context.Context, int64) bool); ok {
    Severity: Major
    Found in internal/model/modelmock/user_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_groups_provider.go on lines 15..33
    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 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