Showing 22 of 174 total issues
File type.go
has 693 lines of code (exceeds 500 allowed). Consider refactoring. Open
Open
package dynamodb
import (
"strconv"
"time"
Method CopyObjectRequest.ToInput
has 117 lines of code (exceeds 50 allowed). Consider refactoring. Open
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))
TableDesign
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
Open
type TableDesign struct {
// for create table
name string
readCapacity int64
writeCapacity int64
ConditionList
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
Open
type ConditionList struct {
keyAttributes map[string]string
conditions map[string]*Condition
filters map[string]*Condition
Method CopyObjectRequest.ToInput
has a Cognitive Complexity of 40 (exceeds 20 allowed). Consider refactoring. Open
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))
- Read upRead up
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
Open
func (svc *Rekognition) DetectFacesFromLocalFile(filepath string) (*FaceDetailResponse, error) {
byt, err := ioutil.ReadFile(filepath)
if err != nil {
return nil, err
}
IAM
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
Open
type IAM struct {
client *SDK.IAM
logger log.Logger
}
Queue
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
Open
type Queue struct {
service *SQS
name string
nameWithPrefix string
SNS
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
Open
type SNS struct {
client *SDK.SNS
logger log.Logger
prefix string
Function NewPlatformAttributesFromMap
has a Cognitive Complexity of 34 (exceeds 20 allowed). Consider refactoring. Open
Open
func NewPlatformAttributesFromMap(attr map[string]*string) PlatformAttributes {
a := PlatformAttributes{}
if len(attr) == 0 {
return a
}
- Read upRead up
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
Open
type Table struct {
service *DynamoDB
name string
nameWithPrefix string
design *TableDesign
Bucket
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
Open
type Bucket struct {
service *S3
name string
nameWithPrefix string
Function NewFaceDetailFromAWSFaceDetail
has 82 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func NewFaceDetailFromAWSFaceDetail(face *SDK.FaceDetail) *FaceDetail {
f := &FaceDetail{}
if face.AgeRange != nil {
f.HasAgeRange = true
f.AgeRangeHigh = int(*face.AgeRange.High)
Method GetCostAndUsageInput.ToInput
has 80 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (u GetCostAndUsageInput) ToInput() *SDK.GetCostAndUsageInput {
in := &SDK.GetCostAndUsageInput{}
// set NextPageToken
if u.NextPageToken != "" {
Function NewPlatformAttributesFromMap
has 74 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func NewPlatformAttributesFromMap(attr map[string]*string) PlatformAttributes {
a := PlatformAttributes{}
if len(attr) == 0 {
return a
}
Method Config.AWSConfig
has 61 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (c Config) AWSConfig() *aws.Config {
cred := c.awsCredentials()
awsConf := &aws.Config{
Credentials: cred,
Region: pointers.String(c.getRegion()),
Method AttributeValue.ToSDK
has 59 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (r AttributeValue) ToSDK() *SDK.AttributeValue {
o := SDK.AttributeValue{}
switch {
case len(r.Binary) != 0:
Function TestFaceDetail_FilterFaceByConfidenceAndSize
has 59 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func TestFaceDetail_FilterFaceByConfidenceAndSize(t *testing.T) {
a := assert.New(t)
tests := []struct {
Confidence float64
Function TestScanWithCondition
has 51 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func TestScanWithCondition(t *testing.T) {
assert := assert.New(t)
tests := []struct {
limit int
Function NewListObjectsResponse
has 51 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func NewListObjectsResponse(out *SDK.ListObjectsV2Output) ListObjectsResponse {
r := ListObjectsResponse{}
if out == nil {
return r
}