rancher/opni-monitoring

View on GitHub

Showing 150 of 150 total issues

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

Method ClientConfig.Bootstrap has 68 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (c *ClientConfig) Bootstrap(
    ctx context.Context,
    ident ident.Provider,
) (keyring.Keyring, error) {
    if c.Token == nil {
Severity: Minor
Found in pkg/bootstrap/client.go - About 1 hr to fix

    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

    Function DecodeAuthHeader has a Cognitive Complexity of 28 (exceeds 20 allowed). Consider refactoring.
    Open

    func DecodeAuthHeader(header string) (id []byte, nonce uuid.UUID, mac []byte, err error) {
        if !strings.HasPrefix(header, "MAC ") {
            return nil, uuid.Nil, nil, errors.New("incorrect authorization type")
        }
        trimmed := strings.TrimSpace(strings.TrimPrefix(header, "MAC"))
    Severity: Minor
    Found in pkg/b2mac/header.go - About 1 hr 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

    Method Reconciler.optionalContainerPorts has 64 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (r *Reconciler) optionalContainerPorts() ([]corev1.ContainerPort, error) {
        lg := r.logger
        var ports []corev1.ContainerPort
        if addr := r.gateway.Spec.Management.GRPCListenAddress; strings.HasPrefix(addr, "tcp://") {
            parts := strings.Split(addr, ":")
    Severity: Minor
    Found in pkg/sdk/resources/gateway/ports.go - About 1 hr to fix

      Method Agent.streamRulesToGateway has 63 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (a *Agent) streamRulesToGateway(ctx context.Context) error {
          lg := a.logger
          updateC, err := a.streamRuleGroupUpdates(ctx)
          if err != nil {
              a.logger.With(
      Severity: Minor
      Found in pkg/agent/rules.go - About 1 hr to fix

        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

        Method ServerConfig.handleBootstrapAuth has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring.
        Open

        func (h ServerConfig) handleBootstrapAuth(c *fiber.Ctx) error {
            lg := c.Context().Logger()
            authHeader := strings.TrimSpace(c.Get("Authorization"))
            if strings.TrimSpace(authHeader) == "" {
                return c.SendStatus(fiber.StatusUnauthorized)
        Severity: Minor
        Found in pkg/bootstrap/server.go - About 1 hr 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

        Method PrometheusRuleFinder.findRulesInNamespace has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring.
        Open

        func (f *PrometheusRuleFinder) findRulesInNamespace(
            ctx context.Context,
            namespace string,
        ) ([]rulefmt.RuleGroup, error) {
            lg := f.logger
        Severity: Minor
        Found in pkg/rules/prometheusrule.go - About 1 hr 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

        Function BuildAgentCmd has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring.
        Open

        func BuildAgentCmd() *cobra.Command {
            lg := logger.New()
            var configLocation string
        
            agentCmd := &cobra.Command{
        Severity: Minor
        Found in pkg/opnim/commands/agent.go - About 1 hr 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

        Method ServerConfig.handleBootstrapAuth has 15 return statements (exceeds 4 allowed).
        Open

        func (h ServerConfig) handleBootstrapAuth(c *fiber.Ctx) error {
            lg := c.Context().Logger()
            authHeader := strings.TrimSpace(c.Get("Authorization"))
            if strings.TrimSpace(authHeader) == "" {
                return c.SendStatus(fiber.StatusUnauthorized)
        Severity: Major
        Found in pkg/bootstrap/server.go - About 1 hr to fix

          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

          Severity
          Category
          Status
          Source
          Language