Skip to content

Commit c1f741f

Browse files
Format code with gofumpt (#141)
1 parent 7153f5e commit c1f741f

File tree

15 files changed

+10
-24
lines changed

15 files changed

+10
-24
lines changed

command/auth/login/login.go

-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ type LoginOptions struct {
2323

2424
// NewCmdLogin handles the login functionality for the CLI
2525
func NewCmdLogin() *cobra.Command {
26-
2726
doc := heredoc.Docf(`
2827
Log in to DeepSource using the CLI.
2928
@@ -64,7 +63,6 @@ func NewCmdLogin() *cobra.Command {
6463

6564
// Run executes the auth command and starts the login flow if not already authenticated
6665
func (opts *LoginOptions) Run() (err error) {
67-
6866
// Fetch config
6967
cfg, _ := config.GetConfig()
7068
opts.User = cfg.User

command/config/generate/analyzers_input.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ func populateMetadata(optionalFields []string, jsonParsed *gabs.Container) []Ana
132132
func (o *Options) extractRequiredAnalyzerMetaFields() error {
133133
var optionalFields []string
134134
var requiredMetaData []AnalyzerMetadata
135-
var analyzerFieldsData = make(map[string][]AnalyzerMetadata)
135+
analyzerFieldsData := make(map[string][]AnalyzerMetadata)
136136

137137
// Extract `optional_required` fields of analyzer meta of selected analyzers
138138
for _, activatedAnalyzer := range o.ActivatedAnalyzers {

command/config/generate/input.go

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010

1111
// Responsible for collecting user input for generating DeepSource config
1212
func (o *Options) collectUserInput() error {
13-
1413
deepsource, err := deepsource.New(deepsource.ClientOpts{
1514
Token: config.Cfg.Token,
1615
HostName: config.Cfg.Host,

command/config/validate/validate.go

-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ type Options struct{}
2525
// NewCmdValidate handles the validation of the DeepSource config (.deepsource.toml)
2626
// Internally it uses the package `configvalidator` to validate the config
2727
func NewCmdValidate() *cobra.Command {
28-
2928
o := Options{}
3029
cmd := &cobra.Command{
3130
Use: "validate",

command/issues/list/list_test.go

-3
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ func TestListJSON(t *testing.T) {
6363
}
6464

6565
func TestListSARIF(t *testing.T) {
66-
6766
t.Run("must work with single language repositories", func(t *testing.T) {
6867
// export issues to SARIF
6968
issues_data := ReadIssues("./testdata/dummy/issues.json")
@@ -112,7 +111,6 @@ func TestListSARIF(t *testing.T) {
112111
}
113112

114113
func TestFilterIssuesByPath(t *testing.T) {
115-
116114
t.Run("must work with files", func(t *testing.T) {
117115
issues_data := ReadIssues("./testdata/dummy/issues_data_multi.json")
118116
issues_docker := ReadIssues("./testdata/dummy/issues_docker.json")
@@ -137,7 +135,6 @@ func TestFilterIssuesByPath(t *testing.T) {
137135
}
138136

139137
func TestFilterIssuesByAnalyzer(t *testing.T) {
140-
141138
t.Run("must work with a single analyzer", func(t *testing.T) {
142139
issues_data := ReadIssues("./testdata/dummy/issues_data_multi.json")
143140
issues_docker := ReadIssues("./testdata/dummy/issues_docker.json")

command/repo/status/status.go

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ type RepoStatusOptions struct {
2020

2121
// NewCmdRepoStatus handles querying the activation status of the repo supplied as an arg
2222
func NewCmdRepoStatus() *cobra.Command {
23-
2423
opts := RepoStatusOptions{
2524
RepoArg: "",
2625
TokenExpired: config.Cfg.IsExpired(),

command/repo/view/view.go

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ type RepoViewOptions struct {
2727
}
2828

2929
func NewCmdRepoView() *cobra.Command {
30-
3130
opts := RepoViewOptions{
3231
RepoArg: "",
3332
SelectedRemote: &utils.RemoteData{},

configvalidator/generic_config_validator.go

-1
Original file line numberDiff line numberDiff line change
@@ -90,5 +90,4 @@ func (c *ConfigValidator) validateGenericConfig() {
9090
c.validateVersion()
9191
c.validateExcludePatterns()
9292
c.validateTestPatterns()
93-
9493
}

deepsource/analyzers/queries/get_analyzers.go

-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ type IGQLClient interface {
4343
}
4444

4545
func (a AnalyzersRequest) Do(ctx context.Context, client IGQLClient) ([]analyzers.Analyzer, error) {
46-
4746
req := graphql.NewRequest(listAnalyzersQuery)
4847

4948
// set header fields

deepsource/issues/issues_list.go

-1
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,4 @@ type Issue struct {
1919
IssueCode string `json:"issue_code"` // DeepSource code for the issue reported
2020
Location Location `json:"location"` // The location data for the issue reported
2121
Analyzer AnalyzerMeta // The Analyzer which raised the issue
22-
2322
}

utils/cmd_validator.go

-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
// Validates if the number of args passed to a command is exactly same as that required
1111
func ExactArgs(count int) cobra.PositionalArgs {
1212
return func(cmd *cobra.Command, args []string) error {
13-
1413
arg := "argument"
1514
if count > 1 {
1615
arg = "arguments"
@@ -32,7 +31,6 @@ func ExactArgs(count int) cobra.PositionalArgs {
3231

3332
func MaxNArgs(count int) cobra.PositionalArgs {
3433
return func(cmd *cobra.Command, args []string) error {
35-
3634
arg := "argument"
3735
if count > 1 {
3836
arg = "arguments"
@@ -54,7 +52,6 @@ func MaxNArgs(count int) cobra.PositionalArgs {
5452

5553
// Validates if there is any arg passed to a command which doesn't require any
5654
func NoArgs(cmd *cobra.Command, args []string) error {
57-
5855
errorMsg := fmt.Sprintf("`%s` does not require any argument. Please see `%s --help` for the supported flags and their usage.",
5956
cmd.CommandPath(),
6057
cmd.CommandPath())

utils/fetch_analyzers_transformers.go

+8-4
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,15 @@ type DeepSourceTransformersData struct {
2222
TransformerMap map[string]string // Map for {transformer name:shortcode}
2323
}
2424

25-
var AnalyzersData DeepSourceAnalyzersData
26-
var TransformersData DeepSourceTransformersData
25+
var (
26+
AnalyzersData DeepSourceAnalyzersData
27+
TransformersData DeepSourceTransformersData
28+
)
2729

28-
var analyzersAPIResponse []analyzers.Analyzer
29-
var transformersAPIResponse []transformers.Transformer
30+
var (
31+
analyzersAPIResponse []analyzers.Analyzer
32+
transformersAPIResponse []transformers.Transformer
33+
)
3034

3135
// Get the list of all the supported analyzers and transformers with
3236
// their corresponding data like shortcode, metaschema etc.

utils/fetch_remote.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func getRemoteMap(remoteList []string) (map[string][]string, error) {
3131
continue
3232
}
3333

34-
var RepoNameRegexp = regexp.MustCompile(`.+/([^/]+)(\.git)?$`)
34+
RepoNameRegexp := regexp.MustCompile(`.+/([^/]+)(\.git)?$`)
3535

3636
// Parsing out repository name from the remote URL using the above regex
3737
matched := RepoNameRegexp.FindStringSubmatch(remoteURL)

utils/remote_resolver.go

-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ func ResolveRemote(repoArg string) (*RemoteData, error) {
7272

7373
// Utility to parse the --repo flag
7474
func RepoArgumentResolver(arg string) ([]string, error) {
75-
7675
// github.com/deepsourcelabs/cli or gh/deepsourcelabs/cli
7776

7877
argComponents := strings.Split(arg, "/")

version/version_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
)
88

99
func TestBuildInfo_String(t *testing.T) {
10-
1110
date, _ := time.Parse("2006-01-02", "2021-01-21")
1211

1312
type fields struct {
@@ -78,7 +77,6 @@ func TestSetBuildInfo(t *testing.T) {
7877
for _, tt := range tests {
7978
t.Run(tt.name, func(t *testing.T) {
8079
SetBuildInfo(tt.args.version, tt.args.dateStr, tt.args.gitTreeState, tt.args.gitCommit)
81-
8280
})
8381
if !reflect.DeepEqual(buildInfo, want) {
8482
t.Errorf("buildInfo = %v, want %v", buildInfo, want)

0 commit comments

Comments
 (0)