Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
doriable committed Jun 25, 2024
1 parent a657483 commit 1b5e809
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions private/buf/bufctl/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,8 +378,8 @@ func (c *controller) GetTargetImageWithConfigs(
if err != nil {
return nil, err
}
lintConfig := bufconfig.DefaultLintConfigV2
breakingConfig := bufconfig.DefaultBreakingConfigV2
lintConfig := bufconfig.DefaultLintConfigV1
breakingConfig := bufconfig.DefaultBreakingConfigV1
bufYAMLFile, err := bufconfig.GetBufYAMLFileForPrefixOrOverride(
ctx,
bucket,
Expand Down
10 changes: 8 additions & 2 deletions private/bufpkg/bufconfig/buf_yaml_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,13 @@ type BufYAMLFile interface {
ModuleConfigs() []ModuleConfig
// DefaultLintConfig returns the DefaultLintConfig for the File.
//
// For v1 buf.yaml files, this will be the default v1 lint config.
// For v1 buf.yaml files, there is only ever a single ModuleConfig, so that is returned.
// For v2 buf.yaml files, if a top-level lint config exists, then it will be the top-level
// lint config. Otherwise it is the default v2 lint config.
DefaultLintConfig() LintConfig
// DefaultBreakingConfig returns the DefaultBreakingConfig for the File.
//
// For v1 buf.yaml, this will be the default v1 breaking config.
// For v1 buf.yaml files, there is only ever a single ModuleConfig, so that is returned.
// For v2 buf.yaml files, if a top-level breaking config exists, then it will be the top-level
// breaking config. Otherwise it is the default v2 breaking config.
DefaultBreakingConfig() BreakingConfig
Expand Down Expand Up @@ -301,10 +301,16 @@ func (c *bufYAMLFile) ModuleConfigs() []ModuleConfig {
}

func (c *bufYAMLFile) DefaultLintConfig() LintConfig {
if c.defaultLintConfig == nil {
return c.moduleConfigs[0].LintConfig()
}
return c.defaultLintConfig
}

func (c *bufYAMLFile) DefaultBreakingConfig() BreakingConfig {
if c.defaultBreakingConfig == nil {
return c.moduleConfigs[0].BreakingConfig()
}
return c.defaultBreakingConfig
}

Expand Down

0 comments on commit 1b5e809

Please sign in to comment.