Skip to content

Commit

Permalink
fix: Always camel case never snake
Browse files Browse the repository at this point in the history
  • Loading branch information
jskrill committed Nov 5, 2023
1 parent b4316bd commit 8808870
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 21 deletions.
24 changes: 12 additions & 12 deletions server/core/config/raw/autodiscover_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

func TestAutoDiscover_UnmarshalYAML(t *testing.T) {
auto_discover_enabled := valid.AutoDiscoverEnabledMode
autoDiscoverEnabled := valid.AutoDiscoverEnabledMode
cases := []struct {
description string
input string
Expand All @@ -29,7 +29,7 @@ func TestAutoDiscover_UnmarshalYAML(t *testing.T) {
mode: enabled
`,
exp: raw.AutoDiscover{
Mode: &auto_discover_enabled,
Mode: &autoDiscoverEnabled,
},
},
}
Expand All @@ -45,10 +45,10 @@ mode: enabled
}

func TestAutoDiscover_Validate(t *testing.T) {
auto_discover_auto := valid.AutoDiscoverAutoMode
auto_discover_enabled := valid.AutoDiscoverEnabledMode
auto_discover_disabled := valid.AutoDiscoverDisabledMode
random_string := valid.AutoDiscoverMode("random_string")
autoDiscoverAuto := valid.AutoDiscoverAutoMode
autoDiscoverEnabled := valid.AutoDiscoverEnabledMode
autoDiscoverDisabled := valid.AutoDiscoverDisabledMode
randomString := valid.AutoDiscoverMode("random_string")
cases := []struct {
description string
input raw.AutoDiscover
Expand All @@ -62,28 +62,28 @@ func TestAutoDiscover_Validate(t *testing.T) {
{
description: "mode set to auto",
input: raw.AutoDiscover{
Mode: &auto_discover_auto,
Mode: &autoDiscoverAuto,
},
errContains: nil,
},
{
description: "mode set to disabled",
input: raw.AutoDiscover{
Mode: &auto_discover_disabled,
Mode: &autoDiscoverDisabled,
},
errContains: nil,
},
{
description: "mode set to enabled",
input: raw.AutoDiscover{
Mode: &auto_discover_enabled,
Mode: &autoDiscoverEnabled,
},
errContains: nil,
},
{
description: "mode set to random string",
input: raw.AutoDiscover{
Mode: &random_string,
Mode: &randomString,
},
errContains: String("valid value"),
},
Expand All @@ -100,7 +100,7 @@ func TestAutoDiscover_Validate(t *testing.T) {
}

func TestAutoDiscover_ToValid(t *testing.T) {
auto_discover_enabled := valid.AutoDiscoverEnabledMode
autoDiscoverEnabled := valid.AutoDiscoverEnabledMode
cases := []struct {
description string
input raw.AutoDiscover
Expand All @@ -116,7 +116,7 @@ func TestAutoDiscover_ToValid(t *testing.T) {
{
description: "value set",
input: raw.AutoDiscover{
Mode: &auto_discover_enabled,
Mode: &autoDiscoverEnabled,
},
exp: &valid.AutoDiscover{
Mode: valid.AutoDiscoverEnabledMode,
Expand Down
4 changes: 2 additions & 2 deletions server/core/config/raw/global_cfg.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ func (r Repo) Validate() error {
}

autoDiscoverValid := func(value interface{}) error {
var autoDiscover *AutoDiscover = value.(*AutoDiscover)
autoDiscover := value.(*AutoDiscover)
if autoDiscover != nil {
return autoDiscover.Validate()
}
Expand Down Expand Up @@ -325,7 +325,7 @@ OuterGlobalImportReqs:
mergedImportReqs = append(mergedImportReqs, globalReq)
}

var autoDiscover *valid.AutoDiscover = nil
var autoDiscover *valid.AutoDiscover
if r.AutoDiscover != nil {
autoDiscover = r.AutoDiscover.ToValid()
}
Expand Down
2 changes: 1 addition & 1 deletion server/core/config/raw/repo_cfg.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (r RepoCfg) ToValid() valid.RepoCfg {
abortOnExcecutionOrderFail = *r.AbortOnExcecutionOrderFail
}

var autoDiscover *valid.AutoDiscover = nil
var autoDiscover *valid.AutoDiscover
if r.AutoDiscover != nil {
autoDiscover = r.AutoDiscover.ToValid()
}
Expand Down
10 changes: 5 additions & 5 deletions server/core/config/raw/repo_cfg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
)

func TestConfig_UnmarshalYAML(t *testing.T) {
auto_discover_enabled := valid.AutoDiscoverEnabledMode
autoDiscoverEnabled := valid.AutoDiscoverEnabledMode
cases := []struct {
description string
input string
Expand Down Expand Up @@ -153,7 +153,7 @@ allowed_regexp_prefixes:
- staging/`,
exp: raw.RepoCfg{
Version: Int(3),
AutoDiscover: &raw.AutoDiscover{Mode: &auto_discover_enabled},
AutoDiscover: &raw.AutoDiscover{Mode: &autoDiscoverEnabled},
Automerge: Bool(true),
ParallelApply: Bool(true),
ParallelPlan: Bool(false),
Expand Down Expand Up @@ -236,7 +236,7 @@ func TestConfig_Validate(t *testing.T) {
}

func TestConfig_ToValid(t *testing.T) {
auto_discover_enabled := valid.AutoDiscoverEnabledMode
autoDiscoverEnabled := valid.AutoDiscoverEnabledMode
cases := []struct {
description string
input raw.RepoCfg
Expand Down Expand Up @@ -324,7 +324,7 @@ func TestConfig_ToValid(t *testing.T) {
description: "autodiscover included",
input: raw.RepoCfg{
Version: Int(2),
AutoDiscover: &raw.AutoDiscover{Mode: &auto_discover_enabled},
AutoDiscover: &raw.AutoDiscover{Mode: &autoDiscoverEnabled},
},
exp: valid.RepoCfg{
Version: 2,
Expand Down Expand Up @@ -371,7 +371,7 @@ func TestConfig_ToValid(t *testing.T) {
Automerge: Bool(true),
ParallelApply: Bool(true),
AutoDiscover: &raw.AutoDiscover{
Mode: &auto_discover_enabled,
Mode: &autoDiscoverEnabled,
},
Workflows: map[string]raw.Workflow{
"myworkflow": {
Expand Down
2 changes: 1 addition & 1 deletion server/events/project_command_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ func (p *DefaultProjectCommandBuilder) buildAllCommandsByCfg(ctx *command.Contex
if repoCfg.AutoDiscover != nil {
defaultAutoDiscoverMode = repoCfg.AutoDiscover.Mode
}
// If auto_discovery is enabled, we never want to skip cloning
// If auto discover is enabled, we never want to skip cloning
if !repoCfg.AutoDiscoverEnabled(defaultAutoDiscoverMode) {
if len(repoCfg.Projects) > 0 {
matchingProjects, err := p.ProjectFinder.DetermineProjectsViaConfig(ctx.Log, modifiedFiles, repoCfg, "", nil)
Expand Down

0 comments on commit 8808870

Please sign in to comment.