mittwald/goharbor-client

View on GitHub

Showing 90 of 163 total issues

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

func (c *RESTClient) ListAllRepositories(ctx context.Context) ([]*model.Repository, error) {
    var repositories []*model.Repository
    page := c.Options.Page

    params := &repository.ListAllRepositoriesParams{
Severity: Major
Found in apiv2/pkg/clients/repository/repository.go and 1 other location - About 3 hrs to fix
apiv2/pkg/clients/registry/registry.go on lines 98..134

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

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 *RESTClient) ListRegistries(ctx context.Context) ([]*model.Registry, error) {
    var registries []*model.Registry
    page := c.Options.Page

    params := &registry.ListRegistriesParams{
Severity: Major
Found in apiv2/pkg/clients/registry/registry.go and 1 other location - About 3 hrs to fix
apiv2/pkg/clients/repository/repository.go on lines 81..117

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

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

package robot

import (
    "net/http"

Severity: Major
Found in apiv2/pkg/clients/robot/robot_errors.go and 1 other location - About 3 hrs to fix
apiv2/pkg/clients/robotv1/robotv1_errors.go on lines 1..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 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

package robotv1

import (
    "net/http"

Severity: Major
Found in apiv2/pkg/clients/robotv1/robotv1_errors.go and 1 other location - About 3 hrs to fix
apiv2/pkg/clients/robot/robot_errors.go on lines 1..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 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 3 locations. Consider refactoring.
Open

    t.Run("PositiveQuota", func(t *testing.T) {
        pc := project.NewClient(clienttesting.V2SwaggerClient, clienttesting.DefaultOpts, clienttesting.AuthInfo)
        err := pc.NewProject(ctx, &modelv2.ProjectReq{
            ProjectName:  testProjectName,
            StorageLimit: &storageLimitPositive,
Severity: Major
Found in apiv2/pkg/clients/quota/quota_integration_test.go and 2 other locations - About 2 hrs to fix
apiv2/pkg/clients/quota/quota_integration_test.go on lines 126..146
apiv2/pkg/clients/quota/quota_integration_test.go on lines 151..170

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

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

    t.Run("NullQuota", func(t *testing.T) {
        pc := project.NewClient(clienttesting.V2SwaggerClient, clienttesting.DefaultOpts, clienttesting.AuthInfo)
        err := pc.NewProject(ctx, &modelv2.ProjectReq{
            ProjectName:  testProjectName,
            StorageLimit: &storageLimitNegative,
Severity: Major
Found in apiv2/pkg/clients/quota/quota_integration_test.go and 2 other locations - About 2 hrs to fix
apiv2/pkg/clients/quota/quota_integration_test.go on lines 80..99
apiv2/pkg/clients/quota/quota_integration_test.go on lines 126..146

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

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

    t.Run("NegativeQuota_2", func(t *testing.T) {
        pc := project.NewClient(clienttesting.V2SwaggerClient, clienttesting.DefaultOpts, clienttesting.AuthInfo)
        err := pc.NewProject(ctx, &modelv2.ProjectReq{
            ProjectName:  testProjectName,
            StorageLimit: &storageLimitNegative,
Severity: Major
Found in apiv2/pkg/clients/quota/quota_integration_test.go and 2 other locations - About 2 hrs to fix
apiv2/pkg/clients/quota/quota_integration_test.go on lines 80..99
apiv2/pkg/clients/quota/quota_integration_test.go on lines 151..170

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

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 *RESTClient) ListUsers(ctx context.Context) ([]*model.UserResp, error) {
    var users []*model.UserResp
    page := c.Options.Page

    params := user.ListUsersParams{
Severity: Major
Found in apiv2/pkg/clients/user/user.go and 1 other location - About 2 hrs to fix
apiv2/pkg/clients/auditlog/auditlog.go on lines 39..75

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

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 *RESTClient) ListAuditLogs(ctx context.Context) ([]*model.AuditLog, error) {
    var auditLogs []*model.AuditLog
    page := c.Options.Page

    params := auditlog.ListAuditLogsParams{
Severity: Major
Found in apiv2/pkg/clients/auditlog/auditlog.go and 1 other location - About 2 hrs to fix
apiv2/pkg/clients/user/user.go on lines 132..168

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

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 TestRESTClient_AddProjectWebhookPolicy(t *testing.T) {
    apiClient, mockClient := APIandMockClientsForTests()

    newPolicy := &modelv2.WebhookPolicy{
        Enabled: true,
Severity: Major
Found in apiv2/pkg/clients/webhook/webhook_test.go and 1 other location - About 2 hrs to fix
apiv2/pkg/clients/webhook/webhook_test.go on lines 104..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 230.

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 TestRESTClient_UpdateProjectWebhookPolicy(t *testing.T) {
    apiClient, mockClient := APIandMockClientsForTests()

    newPolicy := &modelv2.WebhookPolicy{
        Enabled: true,
Severity: Major
Found in apiv2/pkg/clients/webhook/webhook_test.go and 1 other location - About 2 hrs to fix
apiv2/pkg/clients/webhook/webhook_test.go on lines 70..102

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

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 TestRESTClient_NewProject_ErrProjectInternalErrors(t *testing.T) {
    apiClient, mockClient := APIandMockClientsForTests()

    createParams := &projectapi.CreateProjectParams{
        Project: pReq,
Severity: Major
Found in apiv2/pkg/clients/project/project_test.go and 2 other locations - About 2 hrs to fix
apiv2/pkg/clients/project/project_test.go on lines 116..138
apiv2/pkg/clients/project/project_test.go on lines 215..236

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

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 TestRESTClient_NewProject_ErrProjectUnauthorized(t *testing.T) {
    apiClient, mockClient := APIandMockClientsForTests()

    createParams := &projectapi.CreateProjectParams{
        Project: pReq,
Severity: Major
Found in apiv2/pkg/clients/project/project_test.go and 2 other locations - About 2 hrs to fix
apiv2/pkg/clients/project/project_test.go on lines 192..213
apiv2/pkg/clients/project/project_test.go on lines 215..236

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

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 TestRESTClient_NewProject_ErrProjectIDNotExists(t *testing.T) {
    apiClient, mockClient := APIandMockClientsForTests()

    createParams := &projectapi.CreateProjectParams{
        Project: pReq,
Severity: Major
Found in apiv2/pkg/clients/project/project_test.go and 2 other locations - About 2 hrs to fix
apiv2/pkg/clients/project/project_test.go on lines 116..138
apiv2/pkg/clients/project/project_test.go on lines 192..213

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

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 TestRESTClient_UpdateScanAllSchedule(t *testing.T) {
    apiClient, mockClient := APIandMockClientsForTests()

    params := &scan_all.UpdateScanAllScheduleParams{
        Context: ctx,
Severity: Major
Found in apiv2/pkg/clients/scanall/scanall_test.go and 1 other location - About 2 hrs to fix
apiv2/pkg/clients/scanall/scanall_test.go on lines 32..59

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 217.

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 TestRESTClient_CreateScanAllSchedule(t *testing.T) {
    apiClient, mockClient := APIandMockClientsForTests()

    params := &scan_all.CreateScanAllScheduleParams{
        Context: ctx,
Severity: Major
Found in apiv2/pkg/clients/scanall/scanall_test.go and 1 other location - About 2 hrs to fix
apiv2/pkg/clients/scanall/scanall_test.go on lines 84..111

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

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 TestRESTClient_ListPurgeHistory(t *testing.T) {
    apiClient, mockClient := APIandMockClientsForTests()

    listParams := &purge.GetPurgeHistoryParams{
        Page:     &apiClient.Options.Page,
Severity: Major
Found in apiv2/pkg/clients/purge/purge_test.go and 1 other location - About 2 hrs to fix
apiv2/pkg/clients/auditlog/auditlog_test.go on lines 32..53

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

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 TestRESTClient_ListAuditLogs(t *testing.T) {
    apiClient, mockClient := APIandMockClientsForTests()

    listAuditLogsParams := &auditlog.ListAuditLogsParams{
        Page:     &apiClient.Options.Page,
Severity: Major
Found in apiv2/pkg/clients/auditlog/auditlog_test.go and 1 other location - About 2 hrs to fix
apiv2/pkg/clients/purge/purge_test.go on lines 61..81

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

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 TestRESTClient_GetProjectMetadataValue_ValuesUndefined has 80 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func TestRESTClient_GetProjectMetadataValue_ValuesUndefined(t *testing.T) {
    apiClient, mockClient := APIandMockClientsForTests()

    getParams := &projectmeta.GetProjectMetadataParams{
        MetaName:        "",
Severity: Major
Found in apiv2/pkg/clients/projectmeta/projectmeta_test.go - About 2 hrs to fix

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

        t.Run("PositiveLimit", func(t *testing.T) {
            updateParams := &quota.UpdateQuotaParams{
                Hard: &modelv2.QuotaUpdateReq{
                    Hard: modelv2.ResourceList{
                        string(types.ResourceStorage): testStorageLimitPositive,
    Severity: Major
    Found in apiv2/pkg/clients/quota/quota_test.go and 2 other locations - About 2 hrs to fix
    apiv2/pkg/clients/quota/quota_test.go on lines 134..156
    apiv2/pkg/clients/quota/quota_test.go on lines 158..180

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

    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