@@ -28,15 +28,15 @@ func NewRunner() *DefaultRunner {
2828// nolint: gocyclo
2929func (* DefaultRunner ) Run (propertyGetter func (string ) (string , bool ), changedSourceLinesSource io.Reader , reportDefaultOut io.Writer ) error {
3030
31- rawSourceDirs , found := getActiveEnvVariable ( propertyGetter , "PLUGIN_SOURCE_DIRS" , "PARAMETER_SOURCE_DIRS" )
31+ rawSourceDirs , found := propertyGetter ( "PARAMETER_SOURCE_DIRS" )
3232 if ! found {
3333 return errors .New ("Missing property PARAMETER_SOURCE_DIRS" )
3434 }
35- logrus .Info (fmt .Sprintf ("PLUGIN_SOURCE_DIRS set to %v" , rawSourceDirs ))
35+ logrus .Info (fmt .Sprintf ("PARAMETER_SOURCE_DIRS set to %v" , rawSourceDirs ))
3636
3737 sourceDirs := parseSourceDirs (rawSourceDirs )
3838
39- coverageType , found := getActiveEnvVariable ( propertyGetter , "PLUGIN_COVERAGE_TYPE" , "PARAMETER_COVERAGE_TYPE" )
39+ coverageType , found := propertyGetter ( "PARAMETER_COVERAGE_TYPE" )
4040 if ! found {
4141 return errors .New ("Missing property PARAMETER_COVERAGE_TYPE" )
4242 }
@@ -46,36 +46,36 @@ func (*DefaultRunner) Run(propertyGetter func(string) (string, bool), changedSou
4646 return errors .Wrap (getLoaderErr , "Failed opening coverage loader" )
4747 }
4848
49- coverageFile , found := getActiveEnvVariable ( propertyGetter , "PLUGIN_COVERAGE_FILE" , "PARAMETER_COVERAGE_FILE" )
49+ coverageFile , found := propertyGetter ( "PARAMETER_COVERAGE_FILE" )
5050 if ! found {
5151 return errors .New ("Missing property PARAMETER_COVERAGE_FILE" )
5252 }
5353
54- module , found := getActiveEnvVariable ( propertyGetter , "PLUGIN_MODULE" , "PARAMETER_MODULE" )
54+ module , found := propertyGetter ( "PARAMETER_MODULE" )
5555 if ! found {
5656 logrus .Info ("PARAMETER_MODULE was missing defaulting to false" )
5757 module = ""
5858 }
5959
60- ghAPIKey , ghAPIKeyFound := getActiveEnvVariable ( propertyGetter , "PLUGIN_GH_API_KEY" , "PARAMETER_GH_API_KEY" )
60+ ghAPIKey , ghAPIKeyFound := propertyGetter ( "PARAMETER_GH_API_KEY" )
6161 if ! ghAPIKeyFound {
6262 logrus .Info ("PARAMETER_GH_API_KEY was missing, will not send report to PR comments" )
6363 }
6464
65- ghAPIBaseURL , ghAPIBaseURLFound := getActiveEnvVariable ( propertyGetter , "PLUGIN_GH_API_BASE_URL" , "PARAMETER_GH_API_BASE_URL" )
65+ ghAPIBaseURL , ghAPIBaseURLFound := propertyGetter ( "PARAMETER_GH_API_BASE_URL" )
6666 if ! ghAPIBaseURLFound {
6767 logrus .Info ("PARAMETER_GH_API_BASE_URL was missing, will not send report to PR comments" )
6868 }
6969
70- repoPR , repoPRFound := getActiveEnvVariable ( propertyGetter , "DRONE_PULL_REQUEST" , "BUILD_PULL_REQUEST_NUMBER" )
70+ repoPR , repoPRFound := propertyGetter ( "BUILD_PULL_REQUEST_NUMBER" )
7171 if ! repoPRFound {
7272 logrus .Info ("BUILD_PULL_REQUEST_NUMBER was missing, will not send report to PR comments" )
7373 }
74- repoOwner , repoOwnerFound := getActiveEnvVariable ( propertyGetter , "DRONE_REPO_OWNER" , "REPOSITORY_ORG" )
74+ repoOwner , repoOwnerFound := propertyGetter ( "REPOSITORY_ORG" )
7575 if ! repoOwnerFound {
7676 logrus .Info ("REPOSITORY_ORG was missing, will not send report to PR comments" )
7777 }
78- repoName , repoNameFound := getActiveEnvVariable ( propertyGetter , "DRONE_REPO_NAME" , "REPOSITORY_NAME" )
78+ repoName , repoNameFound := propertyGetter ( "REPOSITORY_NAME" )
7979 if ! repoNameFound {
8080 logrus .Info ("REPOSITORY_NAME was missing, will not send report to PR comments" )
8181 }
@@ -89,15 +89,15 @@ func (*DefaultRunner) Run(propertyGetter func(string) (string, bool), changedSou
8989 return errors .Wrap (changedLinesErr , "Failed loading changed lines" )
9090 }
9191
92- debugStr , found := getActiveEnvVariable ( propertyGetter , "PLUGIN_DEBUG" , "PARAMETER_DEBUG" )
92+ debugStr , found := propertyGetter ( "PARAMETER_DEBUG" )
9393 if ! found {
94- logrus .Info ("PLUGIN_DEBUG was missing defaulting to false" )
94+ logrus .Info ("PARAMETER_DEBUG was missing defaulting to false" )
9595 debugStr = "false"
9696 }
9797
9898 debug , parseDebugErr := strconv .ParseBool (debugStr )
9999 if parseDebugErr != nil {
100- logrus .Info ("PLUGIN_DEBUG was invalid, defaulting to false" )
100+ logrus .Info ("PARAMETER_DEBUG was invalid, defaulting to false" )
101101 debug = false
102102 }
103103
@@ -144,11 +144,3 @@ func getCoverageReportLoader(coverageType string, sourceDirs []string) (coverage
144144 }
145145
146146}
147-
148- func getActiveEnvVariable (propertyGetter func (string ) (string , bool ), droneVar , velaVar string ) (string , bool ) {
149- value , droneVarFound := propertyGetter (droneVar )
150- if ! droneVarFound {
151- return propertyGetter (velaVar )
152- }
153- return value , droneVarFound
154- }
0 commit comments