-
Notifications
You must be signed in to change notification settings - Fork 95
enable gocognit linter #1037
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
grishagavrin
wants to merge
35
commits into
ydb-platform:master
Choose a base branch
from
grishagavrin:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
enable gocognit linter #1037
Changes from all commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
e39fb38
refactor internal/stack/record and upload with off gocognit linter
grishagavrin a33374f
refactor sugar/path and upload with off gocognit linter
grishagavrin 90dd596
refactor sugar/path.removeWithPrefix and upload with off gocognit linter
grishagavrin 3047f3f
refactor sugar/path.removeEntry and upload with off gocognit linter
grishagavrin f203aa4
refactor sugar/path.removeEntry and upload with off gocognit linter w…
grishagavrin b5dcd3c
refactor internal/xsql/dsn and upload with off gocognit linter
grishagavrin efc29c9
refactor internal/backoff/backoff_test and upload with off gocognit l…
grishagavrin c6ef237
refactor internal/decimal/decimal and upload with off gocognit linter
grishagavrin 9d5e827
refactor internal/table/client and upload with off gocognit linter
grishagavrin 3343652
refactor internal/table/retry_test and upload with off gocognit linter
grishagavrin 2ba5042
refactor metrics/sql and upload with off gocognit linter
grishagavrin 3d56192
refactor metrics/driver and upload with off gocognit linter
grishagavrin 7386724
refactor log/sql and upload with off gocognit linter
grishagavrin 50d2eae
refactor internal/table/scanner/scanner_test.go and upload with off g…
grishagavrin 1edb132
refactor log/topic and upload with off gocognit linter
grishagavrin 5ce51c4
refactor internal/table/scanner/scanner and upload with off gocognit …
grishagavrin a2bf458
refactor log/driver and upload with off gocognit linter
grishagavrin 14394d5
refactor internal/topic/topicwriterinternal/queue_test and upload wit…
grishagavrin c97da45
refactor retry/retry and upload with off gocognit linter
grishagavrin 4765323
refactor internal/cmd/gtrace/main and upload with off gocognit linter
grishagavrin a3735b0
undo because check-codegen is falling
grishagavrin e06bc0e
refactor internal/bind/params and upload with off gocognit linter
grishagavrin 12265dc
refactor internal/cmd/gtrace/main manually checks tests and upload wi…
grishagavrin 0ed37d8
refactor internal/cmd/gtrace/main.iterateOverWriter manually checks t…
grishagavrin 3108b41
refactor internal/cmd/gtrace/main.findGtraceGen manually checks tests…
grishagavrin e7b2d6c
refactor internal/cmd/gtrace/main.findCommentsWithGtrace manually che…
grishagavrin ec004e4
refactor internal/cmd/gtrace/main.findCommentsWithGtrace manually che…
grishagavrin 84d7f17
refactor internal/cmd/gtrace/main.findCommentsWithGtrace checks on no…
grishagavrin c7cb479
refactor log/table manually checks tests and upload with off gocognit…
grishagavrin 3053edb
refactor log/table manually checks tests and upload with off gocognit…
grishagavrin 0b86a1c
refactor log/table manually checks tests and upload with off gocognit…
grishagavrin e81deb1
refactor log/table manually checks tests and upload with off gocognit…
grishagavrin bd278ba
refactor log/table manually checks tests and upload with off gocognit…
grishagavrin 57a84ee
gocognit linter on
grishagavrin d81f128
Merge branch 'master' into master
asmyasnikov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -230,7 +230,6 @@ linters: | |
- forcetypeassert | ||
- funlen | ||
- gochecknoglobals | ||
- gocognit | ||
- godot | ||
- goerr113 | ||
- golint | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -179,30 +179,11 @@ func Params(args ...interface{}) (parameters []*params.Parameter, _ error) { | |
for i, arg := range args { | ||
switch x := arg.(type) { | ||
case driver.NamedValue: | ||
if x.Name == "" { | ||
switch xx := x.Value.(type) { | ||
case *params.Parameters: | ||
if len(args) > 1 { | ||
return nil, xerrors.WithStackTrace(errMultipleQueryParameters) | ||
} | ||
parameters = *xx | ||
case *params.Parameter: | ||
parameters = append(parameters, xx) | ||
default: | ||
x.Name = fmt.Sprintf("$p%d", i) | ||
param, err := toYdbParam(x.Name, x.Value) | ||
if err != nil { | ||
return nil, xerrors.WithStackTrace(err) | ||
} | ||
parameters = append(parameters, param) | ||
} | ||
} else { | ||
param, err := toYdbParam(x.Name, x.Value) | ||
if err != nil { | ||
return nil, xerrors.WithStackTrace(err) | ||
} | ||
parameters = append(parameters, param) | ||
driverNamedParams, err := checkDriverNamedValue(i, params, x, args) | ||
if err != nil { | ||
return nil, err | ||
} | ||
params = driverNamedParams | ||
case sql.NamedArg: | ||
if x.Name == "" { | ||
return nil, xerrors.WithStackTrace(errUnnamedParam) | ||
|
@@ -233,3 +214,40 @@ func Params(args ...interface{}) (parameters []*params.Parameter, _ error) { | |
|
||
return parameters, nil | ||
} | ||
|
||
// checkDriverNamedValue checks the driver.NamedValue and adds it to the params slice. | ||
func checkDriverNamedValue( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. appendParams or tryAppendParams? |
||
i int, | ||
params []table.ParameterOption, | ||
x driver.NamedValue, | ||
args []interface{}, | ||
) ([]table.ParameterOption, error) { | ||
if x.Name == "" { | ||
switch xx := x.Value.(type) { | ||
case *table.QueryParameters: | ||
if len(args) > 1 { | ||
return nil, xerrors.WithStackTrace(errMultipleQueryParameters) | ||
} | ||
xx.Each(func(name string, v types.Value) { | ||
params = append(params, table.ValueParam(name, v)) | ||
}) | ||
case table.ParameterOption: | ||
params = append(params, xx) | ||
default: | ||
x.Name = fmt.Sprintf("$p%d", i) | ||
param, err := toYdbParam(x.Name, x.Value) | ||
if err != nil { | ||
return nil, xerrors.WithStackTrace(err) | ||
} | ||
params = append(params, param) | ||
} | ||
} else { | ||
param, err := toYdbParam(x.Name, x.Value) | ||
if err != nil { | ||
return nil, xerrors.WithStackTrace(err) | ||
} | ||
params = append(params, param) | ||
} | ||
|
||
return params, nil | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to test for newest func