rancher/opni-monitoring

View on GitHub

Showing 150 of 150 total issues

Method requestBuilder.Do has 5 return statements (exceeds 4 allowed).
Open

func (rb *requestBuilder) Do() (code int, body []byte, err error) {
    nonce, mac, err := b2mac.New512([]byte(rb.gatewayClient.id),
        rb.req.Request().Body(), rb.gatewayClient.sharedKeys.ClientKey)
    if err != nil {
        return 0, nil, err
Severity: Major
Found in pkg/clients/gateway_client.go - About 35 mins to fix

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

        if len(notifyAfter) > 0 {
            go func(d time.Duration) {
                for {
                    select {
                    case <-done:
    Severity: Minor
    Found in pkg/util/waitctx/context.go and 1 other location - About 35 mins to fix
    pkg/util/waitctx/context.go on lines 129..140

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

    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

        if len(notifyAfter) > 0 {
            go func(d time.Duration) {
                for {
                    select {
                    case <-done:
    Severity: Minor
    Found in pkg/util/waitctx/context.go and 1 other location - About 35 mins to fix
    pkg/util/waitctx/context.go on lines 83..94

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

    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 (c *CRDStore) DeleteRoleBinding(ctx context.Context, ref *core.Reference) error {
        return c.client.Delete(ctx, &v1beta1.RoleBinding{
            ObjectMeta: metav1.ObjectMeta{
                Name:      ref.Id,
                Namespace: c.namespace,
    Severity: Minor
    Found in pkg/storage/crds/rbac_store.go and 1 other location - About 30 mins to fix
    pkg/storage/crds/rbac_store.go on lines 24..31

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

    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 (c *CRDStore) DeleteRole(ctx context.Context, ref *core.Reference) error {
        return c.client.Delete(ctx, &v1beta1.Role{
            ObjectMeta: metav1.ObjectMeta{
                Name:      ref.Id,
                Namespace: c.namespace,
    Severity: Minor
    Found in pkg/storage/crds/rbac_store.go and 1 other location - About 30 mins to fix
    pkg/storage/crds/rbac_store.go on lines 58..65

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

    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 (s *kvStoreServer) Get(ctx context.Context, key *Key) (*Value, error) {
        data, err := s.store.Get(ctx, key.GetKey())
        if err != nil {
            return nil, err
        }
    Severity: Minor
    Found in pkg/plugins/apis/system/kvstore.go and 1 other location - About 30 mins to fix
    pkg/plugins/apis/system/kvstore.go on lines 34..42

    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

    func (s *kvStoreServer) ListKeys(ctx context.Context, key *Key) (*KeyList, error) {
        items, err := s.store.ListKeys(ctx, key.GetKey())
        if err != nil {
            return nil, err
        }
    Severity: Minor
    Found in pkg/plugins/apis/system/kvstore.go and 1 other location - About 30 mins to fix
    pkg/plugins/apis/system/kvstore.go on lines 24..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 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

                case v1beta1.AuthProviderOpenID:
                    mw, err := openid.New(ctx, ap.Spec)
                    if err != nil {
                        panic(fmt.Errorf("failed to create OpenID auth provider: %w", err))
                    }
    Severity: Minor
    Found in pkg/machinery/auth_providers.go and 1 other location - About 30 mins to fix
    pkg/machinery/auth_providers.go on lines 27..34

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

    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

                case v1beta1.AuthProviderNoAuth:
                    mw, err := noauth.New(ctx, ap.Spec)
                    if err != nil {
                        panic(fmt.Errorf("failed to create noauth auth provider: %w", err))
                    }
    Severity: Minor
    Found in pkg/machinery/auth_providers.go and 1 other location - About 30 mins to fix
    pkg/machinery/auth_providers.go on lines 19..26

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

    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 TLSConfig has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
    Open

    func TLSConfig(pins []*PublicKeyPin) (*tls.Config, error) {
        if len(pins) == 0 {
            return nil, ErrNoPins
        }
        copiedPins := make([]*PublicKeyPin, len(pins))
    Severity: Minor
    Found in pkg/pkp/tls.go - About 25 mins 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

    Severity
    Category
    Status
    Source
    Language