jkawamoto/roadie

View on GitHub

Showing 2,161 of 2,161 total issues

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

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

    if err := m.validateDefault(formats); err != nil {
        // prop
Severity: Major
Found in cloud/azure/batch/models/exit_conditions.go and 17 other locations - About 2 hrs to fix
cloud/azure/batch/models/certificate_add_parameter.go on lines 42..69
cloud/azure/batch/models/certificate_reference.go on lines 46..73
cloud/azure/batch/models/job_patch_parameter.go on lines 47..74
cloud/azure/batch/models/job_preparation_task.go on lines 55..82
cloud/azure/batch/models/job_preparation_task_execution_information.go on lines 62..89
cloud/azure/batch/models/job_schedule_add_parameter.go on lines 44..71
cloud/azure/batch/models/job_update_parameter.go on lines 48..75
cloud/azure/batch/models/pool_patch_parameter.go on lines 39..66
cloud/azure/batch/models/pool_update_properties_parameter.go on lines 43..70
cloud/azure/batch/models/start_task_information.go on lines 58..85
cloud/azure/batch/models/subtask_information.go on lines 60..87
cloud/azure/compute/models/image_data_disk.go on lines 41..68
cloud/azure/compute/models/usage.go on lines 37..64
cloud/azure/compute/models/virtual_machine_scale_set_data_disk.go on lines 40..67
cloud/azure/compute/models/virtual_machine_scale_set_ip_configuration_properties.go on lines 33..60
cloud/azure/compute/models/virtual_machine_scale_set_vm_profile.go on lines 31..58
cloud/azure/resource/models/deployment_properties.go on lines 41..68

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

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

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

    if err := m.validateConstraints(formats); err != nil {
        // prop
Severity: Major
Found in cloud/azure/batch/models/job_update_parameter.go and 17 other locations - About 2 hrs to fix
cloud/azure/batch/models/certificate_add_parameter.go on lines 42..69
cloud/azure/batch/models/certificate_reference.go on lines 46..73
cloud/azure/batch/models/exit_conditions.go on lines 33..60
cloud/azure/batch/models/job_patch_parameter.go on lines 47..74
cloud/azure/batch/models/job_preparation_task.go on lines 55..82
cloud/azure/batch/models/job_preparation_task_execution_information.go on lines 62..89
cloud/azure/batch/models/job_schedule_add_parameter.go on lines 44..71
cloud/azure/batch/models/pool_patch_parameter.go on lines 39..66
cloud/azure/batch/models/pool_update_properties_parameter.go on lines 43..70
cloud/azure/batch/models/start_task_information.go on lines 58..85
cloud/azure/batch/models/subtask_information.go on lines 60..87
cloud/azure/compute/models/image_data_disk.go on lines 41..68
cloud/azure/compute/models/usage.go on lines 37..64
cloud/azure/compute/models/virtual_machine_scale_set_data_disk.go on lines 40..67
cloud/azure/compute/models/virtual_machine_scale_set_ip_configuration_properties.go on lines 33..60
cloud/azure/compute/models/virtual_machine_scale_set_vm_profile.go on lines 31..58
cloud/azure/resource/models/deployment_properties.go on lines 41..68

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

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

func TestCmdQueueLog(t *testing.T) {

    var stdout bytes.Buffer
    var stderr bytes.Buffer
    p := mock.NewProvider()
Severity: Major
Found in command/queue_test.go - About 2 hrs to fix

    Function TestCmdDataPut has 85 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func TestCmdDataPut(t *testing.T) {
    
        var err error
        var output bytes.Buffer
        opt := optDataPut{
    Severity: Major
    Found in command/data_test.go - About 2 hrs to fix

      Function TestCmdTaskLog has 84 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func TestCmdTaskLog(t *testing.T) {
      
          var stdout bytes.Buffer
          var stderr bytes.Buffer
          p := mock.NewProvider()
      Severity: Major
      Found in command/queue_test.go - About 2 hrs to fix

        Function TestArchive has 84 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func TestArchive(t *testing.T) {
        
            var err error
            root := ".."
        
        
        Severity: Major
        Found in command/util/archive_test.go - About 2 hrs to fix

          Function TestDeleteTask has 84 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func TestDeleteTask(t *testing.T) {
          
              var err error
              ctx := context.Background()
              m := NewQueueManager()
          Severity: Major
          Found in cloud/mock/queue_test.go - About 2 hrs to fix

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

                for _, c := range cases {
            
                    tmp, err := ioutil.TempDir("", "TestCmdResultGet")
                    if err != nil {
                        t.Fatalf("TempDir returns an error: %v", err)
            Severity: Major
            Found in command/result_test.go and 1 other location - About 2 hrs to fix
            command/helper_test.go on lines 157..182

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

            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

                for _, c := range cases {
            
                    tmp, err := ioutil.TempDir("", "")
                    if err != nil {
                        t.Fatalf("TempDir returns an error: %v", err)
            Severity: Major
            Found in command/helper_test.go and 1 other location - About 2 hrs to fix
            command/result_test.go on lines 173..198

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

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

            func (o *FileListFromTaskParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
            
                r.SetTimeout(o.requestTimeout)
                var res []error
            
            
            Severity: Major
            Found in cloud/azure/batch/client/files/file_list_from_task_parameters.go - About 2 hrs to fix

              Method FileListFromComputeNodeParams.WriteToRequest has 82 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func (o *FileListFromComputeNodeParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
              
                  r.SetTimeout(o.requestTimeout)
                  var res []error
              
              

                Method FileDeleteFromTaskParams.WriteToRequest has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring.
                Open

                func (o *FileDeleteFromTaskParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
                
                    r.SetTimeout(o.requestTimeout)
                    var res []error
                
                
                Severity: Minor
                Found in cloud/azure/batch/client/files/file_delete_from_task_parameters.go - About 2 hrs 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 FileDeleteFromComputeNodeParams.WriteToRequest has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring.
                Open

                func (o *FileDeleteFromComputeNodeParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
                
                    r.SetTimeout(o.requestTimeout)
                    var res []error
                
                

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

                func (o *VirtualMachineExtensionImagesListVersionsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
                
                    r.SetTimeout(o.timeout)
                    var res []error
                
                

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

                func (s *StorageService) UploadWithMetadata(
                    ctx context.Context, container, filename string, in io.Reader, props *storage.BlobProperties, metadata storage.BlobMetadata) (err error) {
                
                    // Check the target container exists.
                    containerRef := s.Client.GetContainerReference(container)
                Severity: Major
                Found in cloud/azure/storage.go - About 2 hrs to fix

                  ComputeNodeRebootParams has 21 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  type ComputeNodeRebootParams struct {
                  
                      /*APIVersion
                        Client API Version.
                  
                  

                    ComputeNodeGetParams has 21 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                    type ComputeNodeGetParams struct {
                    
                        /*NrDollarSelect
                          An OData $select clause.
                    
                    
                    Severity: Minor
                    Found in cloud/azure/batch/client/compute_nodes/compute_node_get_parameters.go - About 2 hrs to fix

                      ComputeNodeDeleteUserParams has 21 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                      type ComputeNodeDeleteUserParams struct {
                      
                          /*APIVersion
                            Client API Version.
                      
                      

                        ComputeNodeReimageParams has 21 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                        type ComputeNodeReimageParams struct {
                        
                            /*APIVersion
                              Client API Version.
                        
                        

                          ComputeNodeDisableSchedulingParams has 21 methods (exceeds 20 allowed). Consider refactoring.
                          Open

                          type ComputeNodeDisableSchedulingParams struct {
                          
                              /*APIVersion
                                Client API Version.
                          
                          
                            Severity
                            Category
                            Status
                            Source
                            Language