jkawamoto/roadie

View on GitHub
cloud/azure/resource/models/generic_resource.go

Summary

Maintainability
B
6 hrs
Test Coverage

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

func (m *GenericResource) Validate(formats strfmt.Registry) error {
    var res []error

    if err := m.Resource.Validate(formats); err != nil {
        res = append(res, err)
Severity: Major
Found in cloud/azure/resource/models/generic_resource.go and 3 other locations - About 3 hrs to fix
cloud/azure/compute/models/virtual_machine.go on lines 101..132
cloud/azure/compute/models/virtual_machine_scale_set.go on lines 100..131
cloud/azure/compute/models/virtual_machine_scale_set_vm.go on lines 114..145

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

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

func (m *GenericResource) validateSku(formats strfmt.Registry) error {

    if swag.IsZero(m.Sku) { // not required
        return nil
    }
Severity: Major
Found in cloud/azure/resource/models/generic_resource.go and 19 other locations - About 1 hr to fix
cloud/azure/resource/models/deployment_extended.go on lines 58..75
cloud/azure/resource/models/deployment_operation.go on lines 44..61
cloud/azure/resource/models/deployment_operation_properties.go on lines 75..92
cloud/azure/resource/models/deployment_operation_properties.go on lines 94..111
cloud/azure/resource/models/deployment_operation_properties.go on lines 113..130
cloud/azure/resource/models/deployment_properties.go on lines 70..87
cloud/azure/resource/models/deployment_properties.go on lines 130..147
cloud/azure/resource/models/deployment_properties.go on lines 149..166
cloud/azure/resource/models/deployment_properties_extended.go on lines 101..118
cloud/azure/resource/models/deployment_properties_extended.go on lines 188..205
cloud/azure/resource/models/deployment_properties_extended.go on lines 234..251
cloud/azure/resource/models/deployment_validate_result.go on lines 44..61
cloud/azure/resource/models/deployment_validate_result.go on lines 63..80
cloud/azure/resource/models/generic_resource.go on lines 98..115
cloud/azure/resource/models/generic_resource.go on lines 130..147
cloud/azure/resource/models/resource_group.go on lines 68..85
cloud/azure/resource/models/resource_group_export_result.go on lines 39..56
cloud/azure/resource/models/tag_details.go on lines 52..69
cloud/azure/resource/models/tag_value.go on lines 42..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 139.

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

func (m *GenericResource) validateIdentity(formats strfmt.Registry) error {

    if swag.IsZero(m.Identity) { // not required
        return nil
    }
Severity: Major
Found in cloud/azure/resource/models/generic_resource.go and 19 other locations - About 1 hr to fix
cloud/azure/resource/models/deployment_extended.go on lines 58..75
cloud/azure/resource/models/deployment_operation.go on lines 44..61
cloud/azure/resource/models/deployment_operation_properties.go on lines 75..92
cloud/azure/resource/models/deployment_operation_properties.go on lines 94..111
cloud/azure/resource/models/deployment_operation_properties.go on lines 113..130
cloud/azure/resource/models/deployment_properties.go on lines 70..87
cloud/azure/resource/models/deployment_properties.go on lines 130..147
cloud/azure/resource/models/deployment_properties.go on lines 149..166
cloud/azure/resource/models/deployment_properties_extended.go on lines 101..118
cloud/azure/resource/models/deployment_properties_extended.go on lines 188..205
cloud/azure/resource/models/deployment_properties_extended.go on lines 234..251
cloud/azure/resource/models/deployment_validate_result.go on lines 44..61
cloud/azure/resource/models/deployment_validate_result.go on lines 63..80
cloud/azure/resource/models/generic_resource.go on lines 130..147
cloud/azure/resource/models/generic_resource.go on lines 149..166
cloud/azure/resource/models/resource_group.go on lines 68..85
cloud/azure/resource/models/resource_group_export_result.go on lines 39..56
cloud/azure/resource/models/tag_details.go on lines 52..69
cloud/azure/resource/models/tag_value.go on lines 42..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 139.

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

func (m *GenericResource) validatePlan(formats strfmt.Registry) error {

    if swag.IsZero(m.Plan) { // not required
        return nil
    }
Severity: Major
Found in cloud/azure/resource/models/generic_resource.go and 19 other locations - About 1 hr to fix
cloud/azure/resource/models/deployment_extended.go on lines 58..75
cloud/azure/resource/models/deployment_operation.go on lines 44..61
cloud/azure/resource/models/deployment_operation_properties.go on lines 75..92
cloud/azure/resource/models/deployment_operation_properties.go on lines 94..111
cloud/azure/resource/models/deployment_operation_properties.go on lines 113..130
cloud/azure/resource/models/deployment_properties.go on lines 70..87
cloud/azure/resource/models/deployment_properties.go on lines 130..147
cloud/azure/resource/models/deployment_properties.go on lines 149..166
cloud/azure/resource/models/deployment_properties_extended.go on lines 101..118
cloud/azure/resource/models/deployment_properties_extended.go on lines 188..205
cloud/azure/resource/models/deployment_properties_extended.go on lines 234..251
cloud/azure/resource/models/deployment_validate_result.go on lines 44..61
cloud/azure/resource/models/deployment_validate_result.go on lines 63..80
cloud/azure/resource/models/generic_resource.go on lines 98..115
cloud/azure/resource/models/generic_resource.go on lines 149..166
cloud/azure/resource/models/resource_group.go on lines 68..85
cloud/azure/resource/models/resource_group_export_result.go on lines 39..56
cloud/azure/resource/models/tag_details.go on lines 52..69
cloud/azure/resource/models/tag_value.go on lines 42..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 139.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

There are no issues that match your filters.

Category
Status