rancher/opni-monitoring

View on GitHub

Showing 55 of 150 total issues

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

func (c *CRDStore) ListRoleBindings(ctx context.Context) (*core.RoleBindingList, error) {
    list := &v1beta1.RoleBindingList{}
    err := c.client.List(ctx, list, client.InNamespace(c.namespace))
    if err != nil {
        return nil, err
Severity: Major
Found in pkg/storage/crds/rbac_store.go and 1 other location - About 1 hr to fix
pkg/storage/crds/rbac_store.go on lines 82..95

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

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) ListRoles(ctx context.Context) (*core.RoleList, error) {
    list := &v1beta1.RoleList{}
    err := c.client.List(ctx, list, client.InNamespace(c.namespace))
    if err != nil {
        return nil, err
Severity: Major
Found in pkg/storage/crds/rbac_store.go and 1 other location - About 1 hr to fix
pkg/storage/crds/rbac_store.go on lines 97..110

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

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 (e *EtcdStore) CreateRoleBinding(ctx context.Context, roleBinding *core.RoleBinding) error {
    ctx, ca := context.WithTimeout(ctx, e.CommandTimeout)
    defer ca()
    data, err := protojson.Marshal(roleBinding)
    if err != nil {
Severity: Major
Found in pkg/storage/etcd/rbac_store.go and 1 other location - About 1 hr to fix
pkg/storage/etcd/rbac_store.go on lines 14..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 174.

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 (e *EtcdStore) CreateRole(ctx context.Context, role *core.Role) error {
    ctx, ca := context.WithTimeout(ctx, e.CommandTimeout)
    defer ca()
    data, err := protojson.Marshal(role)
    if err != nil {
Severity: Major
Found in pkg/storage/etcd/rbac_store.go and 1 other location - About 1 hr to fix
pkg/storage/etcd/rbac_store.go on lines 58..70

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

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 (in *KeyringList) DeepCopyInto(out *KeyringList) {
    *out = *in
    out.TypeMeta = in.TypeMeta
    in.ListMeta.DeepCopyInto(&out.ListMeta)
    if in.Items != nil {
Severity: Major
Found in pkg/sdk/api/v1beta1/zz_generated.deepcopy.go and 5 other locations - About 1 hr to fix
pkg/sdk/api/v1beta1/zz_generated.deepcopy.go on lines 66..77
pkg/sdk/api/v1beta1/zz_generated.deepcopy.go on lines 127..138
pkg/sdk/api/v1beta1/zz_generated.deepcopy.go on lines 201..212
pkg/sdk/api/v1beta1/zz_generated.deepcopy.go on lines 441..452
pkg/sdk/api/v1beta1/zz_generated.deepcopy.go on lines 473..484

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

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 (in *RoleBindingList) DeepCopyInto(out *RoleBindingList) {
    *out = *in
    out.TypeMeta = in.TypeMeta
    in.ListMeta.DeepCopyInto(&out.ListMeta)
    if in.Items != nil {
Severity: Major
Found in pkg/sdk/api/v1beta1/zz_generated.deepcopy.go and 5 other locations - About 1 hr to fix
pkg/sdk/api/v1beta1/zz_generated.deepcopy.go on lines 66..77
pkg/sdk/api/v1beta1/zz_generated.deepcopy.go on lines 127..138
pkg/sdk/api/v1beta1/zz_generated.deepcopy.go on lines 201..212
pkg/sdk/api/v1beta1/zz_generated.deepcopy.go on lines 351..362
pkg/sdk/api/v1beta1/zz_generated.deepcopy.go on lines 473..484

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

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 (in *BootstrapTokenList) DeepCopyInto(out *BootstrapTokenList) {
    *out = *in
    out.TypeMeta = in.TypeMeta
    in.ListMeta.DeepCopyInto(&out.ListMeta)
    if in.Items != nil {
Severity: Major
Found in pkg/sdk/api/v1beta1/zz_generated.deepcopy.go and 5 other locations - About 1 hr to fix
pkg/sdk/api/v1beta1/zz_generated.deepcopy.go on lines 127..138
pkg/sdk/api/v1beta1/zz_generated.deepcopy.go on lines 201..212
pkg/sdk/api/v1beta1/zz_generated.deepcopy.go on lines 351..362
pkg/sdk/api/v1beta1/zz_generated.deepcopy.go on lines 441..452
pkg/sdk/api/v1beta1/zz_generated.deepcopy.go on lines 473..484

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

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 (in *RoleList) DeepCopyInto(out *RoleList) {
    *out = *in
    out.TypeMeta = in.TypeMeta
    in.ListMeta.DeepCopyInto(&out.ListMeta)
    if in.Items != nil {
Severity: Major
Found in pkg/sdk/api/v1beta1/zz_generated.deepcopy.go and 5 other locations - About 1 hr to fix
pkg/sdk/api/v1beta1/zz_generated.deepcopy.go on lines 66..77
pkg/sdk/api/v1beta1/zz_generated.deepcopy.go on lines 127..138
pkg/sdk/api/v1beta1/zz_generated.deepcopy.go on lines 201..212
pkg/sdk/api/v1beta1/zz_generated.deepcopy.go on lines 351..362
pkg/sdk/api/v1beta1/zz_generated.deepcopy.go on lines 441..452

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

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 (in *ClusterList) DeepCopyInto(out *ClusterList) {
    *out = *in
    out.TypeMeta = in.TypeMeta
    in.ListMeta.DeepCopyInto(&out.ListMeta)
    if in.Items != nil {
Severity: Major
Found in pkg/sdk/api/v1beta1/zz_generated.deepcopy.go and 5 other locations - About 1 hr to fix
pkg/sdk/api/v1beta1/zz_generated.deepcopy.go on lines 66..77
pkg/sdk/api/v1beta1/zz_generated.deepcopy.go on lines 201..212
pkg/sdk/api/v1beta1/zz_generated.deepcopy.go on lines 351..362
pkg/sdk/api/v1beta1/zz_generated.deepcopy.go on lines 441..452
pkg/sdk/api/v1beta1/zz_generated.deepcopy.go on lines 473..484

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

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 (in *GatewayList) DeepCopyInto(out *GatewayList) {
    *out = *in
    out.TypeMeta = in.TypeMeta
    in.ListMeta.DeepCopyInto(&out.ListMeta)
    if in.Items != nil {
Severity: Major
Found in pkg/sdk/api/v1beta1/zz_generated.deepcopy.go and 5 other locations - About 1 hr to fix
pkg/sdk/api/v1beta1/zz_generated.deepcopy.go on lines 66..77
pkg/sdk/api/v1beta1/zz_generated.deepcopy.go on lines 127..138
pkg/sdk/api/v1beta1/zz_generated.deepcopy.go on lines 351..362
pkg/sdk/api/v1beta1/zz_generated.deepcopy.go on lines 441..452
pkg/sdk/api/v1beta1/zz_generated.deepcopy.go on lines 473..484

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

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) GetRoleBinding(ctx context.Context, ref *core.Reference) (*core.RoleBinding, error) {
    rb := &v1beta1.RoleBinding{}
    err := c.client.Get(ctx, client.ObjectKey{
        Name:      ref.Id,
        Namespace: c.namespace,
Severity: Major
Found in pkg/storage/crds/rbac_store.go and 1 other location - About 1 hr to fix
pkg/storage/crds/rbac_store.go on lines 33..46

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

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) GetRole(ctx context.Context, ref *core.Reference) (*core.Role, error) {
    role := &v1beta1.Role{}
    err := c.client.Get(ctx, client.ObjectKey{
        Name:      ref.Id,
        Namespace: c.namespace,
Severity: Major
Found in pkg/storage/crds/rbac_store.go and 1 other location - About 1 hr to fix
pkg/storage/crds/rbac_store.go on lines 67..80

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

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

    if addr := r.gateway.Spec.Management.HTTPListenAddress; addr != "" {
        parts := strings.Split(addr, ":")
        if len(parts) != 2 {
            return nil, fmt.Errorf("invalid HTTP listen address %q", addr)
        }
Severity: Major
Found in pkg/sdk/resources/gateway/ports.go and 1 other location - About 1 hr to fix
pkg/sdk/resources/gateway/ports.go on lines 47..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 156.

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

    if addr := r.gateway.Spec.Management.WebListenAddress; addr != "" {
        parts := strings.Split(addr, ":")
        if len(parts) != 2 {
            return nil, fmt.Errorf("invalid Web listen address %q", addr)
        }
Severity: Major
Found in pkg/sdk/resources/gateway/ports.go and 1 other location - About 1 hr to fix
pkg/sdk/resources/gateway/ports.go on lines 32..46

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

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 (e *EtcdStore) DeleteRoleBinding(ctx context.Context, ref *core.Reference) error {
    ctx, ca := context.WithTimeout(ctx, e.CommandTimeout)
    defer ca()
    resp, err := e.Client.Delete(ctx, path.Join(e.Prefix, roleBindingKey, ref.Id))
    if err != nil {
Severity: Major
Found in pkg/storage/etcd/rbac_store.go and 1 other location - About 1 hr to fix
pkg/storage/etcd/rbac_store.go on lines 28..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 154.

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 (e *EtcdStore) DeleteRole(ctx context.Context, ref *core.Reference) error {
    ctx, ca := context.WithTimeout(ctx, e.CommandTimeout)
    defer ca()
    resp, err := e.Client.Delete(ctx, path.Join(e.Prefix, roleKey, ref.Id))
    if err != nil {
Severity: Major
Found in pkg/storage/etcd/rbac_store.go and 1 other location - About 1 hr to fix
pkg/storage/etcd/rbac_store.go on lines 72..83

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

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 BuildTokensListCmd() *cobra.Command {
    return &cobra.Command{
        Use:   "list",
        Short: "List bootstrap tokens",
        Run: func(cmd *cobra.Command, args []string) {
Severity: Major
Found in pkg/opnim/commands/tokens.go and 2 other locations - About 1 hr to fix
pkg/opnim/commands/rbac.go on lines 118..130
pkg/opnim/commands/rbac.go on lines 194..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 144.

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 BuildRoleBindingsListCmd() *cobra.Command {
    return &cobra.Command{
        Use:   "list",
        Short: "List role bindings",
        Run: func(cmd *cobra.Command, args []string) {
Severity: Major
Found in pkg/opnim/commands/rbac.go and 2 other locations - About 1 hr to fix
pkg/opnim/commands/rbac.go on lines 118..130
pkg/opnim/commands/tokens.go on lines 79..91

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

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 BuildRolesListCmd() *cobra.Command {
    return &cobra.Command{
        Use:   "list",
        Short: "List roles",
        Run: func(cmd *cobra.Command, args []string) {
Severity: Major
Found in pkg/opnim/commands/rbac.go and 2 other locations - About 1 hr to fix
pkg/opnim/commands/rbac.go on lines 194..206
pkg/opnim/commands/tokens.go on lines 79..91

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

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 configLocation == "" {
                // find config file
                path, err := config.FindConfig()
                if err != nil {
                    if errors.Is(err, config.ErrConfigNotFound) {
Severity: Minor
Found in pkg/opnim/commands/agent.go and 1 other location - About 55 mins to fix
pkg/opnim/util/config.go on lines 17..33

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

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