Skip to content

Commit fdfea5a

Browse files
committed
Fix lint (assert.ErrorIs) and remove incorrect login profile+arg conflict
The testifylint linter requires assert.ErrorIs over assert.True(errors.Is). The blanket rejection of positional arg + --profile in login was wrong: `databricks auth login https://host --profile myprofile` is valid (host as positional arg with explicit profile). The profile-first resolution already skips when profileName is set, so no extra guard is needed. Co-authored-by: Isaac
1 parent 6e56039 commit fdfea5a

File tree

2 files changed

+1
-5
lines changed

2 files changed

+1
-5
lines changed

cmd/auth/login.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,6 @@ a new profile is created.
150150
}
151151

152152
// Resolve positional argument as profile or host.
153-
if len(args) > 0 && cmd.Flag("profile").Changed {
154-
return errors.New("please only provide a positional argument or --profile, not both")
155-
}
156153
if len(args) > 0 && authArguments.Host != "" {
157154
return errors.New("please only provide a positional argument or --host, not both")
158155
}

cmd/auth/resolve_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package auth
22

33
import (
4-
"errors"
54
"testing"
65

76
"github.com/databricks/cli/libs/cmdio"
@@ -89,7 +88,7 @@ func TestResolvePositionalArg(t *testing.T) {
8988
profiler := profile.InMemoryProfiler{Profiles: tc.profiles}
9089
profileName, host, err := resolvePositionalArg(ctx, tc.arg, profiler)
9190
if tc.wantErr != nil {
92-
assert.True(t, errors.Is(err, tc.wantErr), "expected %v, got %v", tc.wantErr, err)
91+
assert.ErrorIs(t, err, tc.wantErr)
9392
return
9493
}
9594
require.NoError(t, err)

0 commit comments

Comments
 (0)