evalphobia/aws-sdk-go-wrapper

View on GitHub

Showing 22 of 174 total issues

File type.go has 693 lines of code (exceeds 500 allowed). Consider refactoring.
Open

package dynamodb

import (
    "strconv"
    "time"
Severity: Minor
Found in dynamodb/type.go - About 6 hrs to fix

    Method CopyObjectRequest.ToInput has 117 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (r CopyObjectRequest) ToInput() *SDK.CopyObjectInput {
        in := &SDK.CopyObjectInput{}
    
        if r.SrcBucket != "" && r.SrcPath != "" {
            in.SetCopySource(fmt.Sprintf("/%s/%s", r.SrcBucket, r.SrcPath))
    Severity: Major
    Found in s3/request_type.go - About 3 hrs to fix

      ConditionList has 30 methods (exceeds 20 allowed). Consider refactoring.
      Open

      type ConditionList struct {
          keyAttributes map[string]string
          conditions    map[string]*Condition
          filters       map[string]*Condition
      
      
      Severity: Minor
      Found in dynamodb/condition.go - About 3 hrs to fix

        TableDesign has 30 methods (exceeds 20 allowed). Consider refactoring.
        Open

        type TableDesign struct {
            // for create table
            name          string
            readCapacity  int64
            writeCapacity int64
        Severity: Minor
        Found in dynamodb/table_design.go - About 3 hrs to fix

          Method CopyObjectRequest.ToInput has a Cognitive Complexity of 40 (exceeds 20 allowed). Consider refactoring.
          Open

          func (r CopyObjectRequest) ToInput() *SDK.CopyObjectInput {
              in := &SDK.CopyObjectInput{}
          
              if r.SrcBucket != "" && r.SrcPath != "" {
                  in.SetCopySource(fmt.Sprintf("/%s/%s", r.SrcBucket, r.SrcPath))
          Severity: Minor
          Found in s3/request_type.go - About 3 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

          Rekognition has 28 methods (exceeds 20 allowed). Consider refactoring.
          Open

          func (svc *Rekognition) DetectFacesFromLocalFile(filepath string) (*FaceDetailResponse, error) {
              byt, err := ioutil.ReadFile(filepath)
              if err != nil {
                  return nil, err
              }
          Severity: Minor
          Found in rekognition/client_api.go - About 3 hrs to fix

            IAM has 28 methods (exceeds 20 allowed). Consider refactoring.
            Open

            type IAM struct {
                client *SDK.IAM
            
                logger log.Logger
            }
            Severity: Minor
            Found in iam/client.go - About 3 hrs to fix

              SNS has 25 methods (exceeds 20 allowed). Consider refactoring.
              Open

              type SNS struct {
                  client *SDK.SNS
              
                  logger       log.Logger
                  prefix       string
              Severity: Minor
              Found in sns/client.go - About 2 hrs to fix

                Queue has 25 methods (exceeds 20 allowed). Consider refactoring.
                Open

                type Queue struct {
                    service *SQS
                
                    name           string
                    nameWithPrefix string
                Severity: Minor
                Found in sqs/queue.go - About 2 hrs to fix

                  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

                          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

                            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

                              Function TestFaceDetail_FilterFaceByConfidenceAndSize has 59 lines of code (exceeds 50 allowed). Consider refactoring.
                              Open

                              func TestFaceDetail_FilterFaceByConfidenceAndSize(t *testing.T) {
                                  a := assert.New(t)
                              
                                  tests := []struct {
                                      Confidence   float64
                              Severity: Minor
                              Found in rekognition/response_type_test.go - About 1 hr to fix

                                Method AttributeValue.ToSDK has 59 lines of code (exceeds 50 allowed). Consider refactoring.
                                Open

                                func (r AttributeValue) ToSDK() *SDK.AttributeValue {
                                    o := SDK.AttributeValue{}
                                
                                    switch {
                                    case len(r.Binary) != 0:
                                Severity: Minor
                                Found in dynamodb/type.go - About 1 hr to fix

                                  Function NewListObjectsResponse has 51 lines of code (exceeds 50 allowed). Consider refactoring.
                                  Open

                                  func NewListObjectsResponse(out *SDK.ListObjectsV2Output) ListObjectsResponse {
                                      r := ListObjectsResponse{}
                                      if out == nil {
                                          return r
                                      }
                                  Severity: Minor
                                  Found in s3/response_type.go - About 1 hr to fix

                                    Function TestScanWithCondition has 51 lines of code (exceeds 50 allowed). Consider refactoring.
                                    Open

                                    func TestScanWithCondition(t *testing.T) {
                                        assert := assert.New(t)
                                    
                                        tests := []struct {
                                            limit                int
                                    Severity: Minor
                                    Found in dynamodb/table_test.go - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language