Skip to content

Commit

Permalink
fix(cli): exclude cwd from input path resolution (#1466)
Browse files Browse the repository at this point in the history
  • Loading branch information
noahdietz authored Feb 11, 2025
1 parent ecc28f0 commit a14ed3d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cmd/api-linter/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func newCli(args []string) *cli {
FormatType: fmtFlag,
OutputPath: outFlag,
ExitStatusOnLintFailure: setExitStatusOnLintFailure,
ProtoImportPaths: append(protoImportFlag, "."),
ProtoImportPaths: protoImportFlag,
ProtoDescPath: protoDescFlag,
EnabledRules: ruleEnableFlag,
DisabledRules: ruleDisableFlag,
Expand Down Expand Up @@ -152,7 +152,7 @@ func (c *cli) lint(rules lint.RuleRegistry, configs lint.Configs) error {
var lock sync.Mutex
// Parse proto files into `protoreflect` file descriptors.
p := protoparse.Parser{
ImportPaths: c.ProtoImportPaths,
ImportPaths: append(c.ProtoImportPaths, "."),
IncludeSourceCodeInfo: true,
LookupImport: lookupImport,
ErrorReporter: func(errorWithPos protoparse.ErrorWithPos) error {
Expand Down
3 changes: 1 addition & 2 deletions cmd/api-linter/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func TestNewCli(t *testing.T) {
OutputPath: "out",
FormatType: "json",
ProtoDescPath: []string{"proto_desc1", "proto_desc2"},
ProtoImportPaths: []string{"proto_path_a", "proto_path_b", "."},
ProtoImportPaths: []string{"proto_path_a", "proto_path_b"},
ProtoFiles: []string{"a.proto", "b.proto"},
},
},
Expand All @@ -41,7 +41,6 @@ func TestNewCli(t *testing.T) {
},
wantCli: &cli{
ExitStatusOnLintFailure: true,
ProtoImportPaths: []string{"."},
ProtoFiles: []string{},
},
},
Expand Down

0 comments on commit a14ed3d

Please sign in to comment.