evalphobia/aws-sdk-go-wrapper

View on GitHub

Showing 174 of 174 total issues

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

func TestEnvEndpoint(t *testing.T) {
    assert := assert.New(t)

    tests := []struct {
        isSuccess bool
Severity: Major
Found in config/env_test.go and 1 other location - About 2 hrs to fix
config/env_test.go on lines 11..43

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

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

func NewPlatformAttributesFromMap(attr map[string]*string) PlatformAttributes {
    a := PlatformAttributes{}
    if len(attr) == 0 {
        return a
    }
Severity: Minor
Found in sns/type.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

Table has 23 methods (exceeds 20 allowed). Consider refactoring.
Open

type Table struct {
    service        *DynamoDB
    name           string
    nameWithPrefix string
    design         *TableDesign
Severity: Minor
Found in dynamodb/table.go - About 2 hrs to fix

    Bucket has 22 methods (exceeds 20 allowed). Consider refactoring.
    Open

    type Bucket struct {
        service *S3
    
        name           string
        nameWithPrefix string
    Severity: Minor
    Found in s3/bucket.go - About 2 hrs to fix

      Function NewFaceDetailFromAWSFaceDetail has 82 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func NewFaceDetailFromAWSFaceDetail(face *SDK.FaceDetail) *FaceDetail {
          f := &FaceDetail{}
          if face.AgeRange != nil {
              f.HasAgeRange = true
              f.AgeRangeHigh = int(*face.AgeRange.High)
      Severity: Major
      Found in rekognition/response_type.go - About 2 hrs to fix

        Method GetCostAndUsageInput.ToInput has 80 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (u GetCostAndUsageInput) ToInput() *SDK.GetCostAndUsageInput {
            in := &SDK.GetCostAndUsageInput{}
        
            // set NextPageToken
            if u.NextPageToken != "" {
        Severity: Major
        Found in costexplorer/request_type.go - About 2 hrs to fix

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

          func (svc *Rekognition) detectLabels(input *SDK.DetectLabelsInput) (*LabelResponse, error) {
              op, err := svc.client.DetectLabels(input)
              if err != nil {
                  svc.Errorf("error on `DetectLabels` operation; error=%s;", err.Error())
                  return nil, err
          Severity: Major
          Found in rekognition/client_api.go and 1 other location - About 2 hrs to fix
          rekognition/client_api.go on lines 53..72

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

          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 (svc *Rekognition) detectFaces(input *SDK.DetectFacesInput) (*FaceDetailResponse, error) {
              op, err := svc.client.DetectFaces(input)
              if err != nil {
                  svc.Errorf("error on `DetectFaces` operation; error=%s;", err.Error())
                  return nil, err
          Severity: Major
          Found in rekognition/client_api.go and 1 other location - About 2 hrs to fix
          rekognition/client_api.go on lines 113..132

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

          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 (svc *IAM) listUserPolicies(input *SDK.ListUserPoliciesInput) ([]string, error) {
              // set default limit
              if input.MaxItems == nil {
                  input.MaxItems = pointers.Long64(1000)
              }
          Severity: Major
          Found in iam/client.go and 2 other locations - About 2 hrs to fix
          iam/client.go on lines 141..161
          iam/client.go on lines 191..211

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

          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 (svc *IAM) listRolePolicies(input *SDK.ListRolePoliciesInput) ([]string, error) {
              // set default limit
              if input.MaxItems == nil {
                  input.MaxItems = pointers.Long64(1000)
              }
          Severity: Major
          Found in iam/client.go and 2 other locations - About 2 hrs to fix
          iam/client.go on lines 79..99
          iam/client.go on lines 141..161

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

          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 (svc *IAM) listGroupPolicies(input *SDK.ListGroupPoliciesInput) ([]string, error) {
              // set default limit
              if input.MaxItems == nil {
                  input.MaxItems = pointers.Long64(1000)
              }
          Severity: Major
          Found in iam/client.go and 2 other locations - About 2 hrs to fix
          iam/client.go on lines 79..99
          iam/client.go on lines 191..211

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

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

          func NewPlatformAttributesFromMap(attr map[string]*string) PlatformAttributes {
              a := PlatformAttributes{}
              if len(attr) == 0 {
                  return a
              }
          Severity: Minor
          Found in sns/type.go - About 1 hr to fix

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

            func NewGroup(g *SDK.Group) Group {
                gg := Group{}
                if g.Arn != nil {
                    gg.ARN = *g.Arn
                }
            Severity: Major
            Found in iam/type_group.go and 1 other location - About 1 hr to fix
            iam/type_role.go on lines 21..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 187.

            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 NewRole(r *SDK.Role) Role {
                rr := Role{}
                if r.Arn != nil {
                    rr.ARN = *r.Arn
                }
            Severity: Major
            Found in iam/type_role.go and 1 other location - About 1 hr to fix
            iam/type_group.go on lines 19..37

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

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

            func TestNew(t *testing.T) {
                assert := assert.New(t)
            
                svc, err := New(getTestConfig())
                assert.NoError(err)
            Severity: Major
            Found in xray/client_test.go and 4 other locations - About 1 hr to fix
            dynamodb/client_test.go on lines 35..51
            kinesis/client_test.go on lines 52..68
            s3/client_test.go on lines 53..69
            sqs/client_test.go on lines 40..56

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

            func TestNew(t *testing.T) {
                assert := assert.New(t)
            
                svc, err := New(getTestConfig())
                assert.NoError(err)
            Severity: Major
            Found in kinesis/client_test.go and 4 other locations - About 1 hr to fix
            dynamodb/client_test.go on lines 35..51
            s3/client_test.go on lines 53..69
            sqs/client_test.go on lines 40..56
            xray/client_test.go on lines 31..47

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

            func TestNewClient(t *testing.T) {
                assert := assert.New(t)
            
                svc, err := New(getTestConfig())
                assert.NoError(err)
            Severity: Major
            Found in sqs/client_test.go and 4 other locations - About 1 hr to fix
            dynamodb/client_test.go on lines 35..51
            kinesis/client_test.go on lines 52..68
            s3/client_test.go on lines 53..69
            xray/client_test.go on lines 31..47

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

            func TestNew(t *testing.T) {
                assert := assert.New(t)
            
                svc, err := New(getTestConfig())
                assert.NoError(err)
            Severity: Major
            Found in s3/client_test.go and 4 other locations - About 1 hr to fix
            dynamodb/client_test.go on lines 35..51
            kinesis/client_test.go on lines 52..68
            sqs/client_test.go on lines 40..56
            xray/client_test.go on lines 31..47

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

            func TestNew(t *testing.T) {
                assert := assert.New(t)
            
                svc, err := New(getTestConfig())
                assert.NoError(err)
            Severity: Major
            Found in dynamodb/client_test.go and 4 other locations - About 1 hr to fix
            kinesis/client_test.go on lines 52..68
            s3/client_test.go on lines 53..69
            sqs/client_test.go on lines 40..56
            xray/client_test.go on lines 31..47

            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

            Method Config.AWSConfig has 61 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func (c Config) AWSConfig() *aws.Config {
                cred := c.awsCredentials()
                awsConf := &aws.Config{
                    Credentials: cred,
                    Region:      pointers.String(c.getRegion()),
            Severity: Minor
            Found in config/config.go - About 1 hr to fix
              Severity
              Category
              Status
              Source
              Language