1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-14 11:03:09 +02:00

Fix CodeClimate finding

This commit is contained in:
Sascha Vornheder 2019-11-12 13:55:32 +01:00
parent d87d27325c
commit 85570095c5
3 changed files with 36 additions and 34 deletions

View File

@ -13,26 +13,26 @@ import (
"github.com/ghodss/yaml" "github.com/ghodss/yaml"
) )
// StepData defines the metadata for a step, like step descriptions, parameters, ... // ContextDefaultData defines the metadata for a step, like step descriptions, parameters, ...
type ContextDefaultData struct { type ContextDefaultData struct {
Metadata ContextDefaultMetadata `json:"metadata"` Metadata ContextDefaultMetadata `json:"metadata"`
Parameters []ContextDefaultParameters `json:"params"` Parameters []ContextDefaultParameters `json:"params"`
} }
// StepMetadata defines the metadata for a step, like step descriptions, parameters, ... // ContextDefaultMetadata defines the metadata for a step, like step descriptions, parameters, ...
type ContextDefaultMetadata struct { type ContextDefaultMetadata struct {
Name string `json:"name"` Name string `json:"name"`
Description string `json:"description"` Description string `json:"description"`
LongDescription string `json:"longDescription,omitempty"` LongDescription string `json:"longDescription,omitempty"`
} }
// StepParameters defines the parameters for a step // ContextDefaultParameters defines the parameters for a step
type ContextDefaultParameters struct { type ContextDefaultParameters struct {
Name string `json:"name"` Name string `json:"name"`
Description string `json:"description"` Description string `json:"description"`
} }
// ReadPipelineStepData loads step definition in yaml format // ReadPipelineContextDefaultData loads step definition in yaml format
func (m *ContextDefaultData) readPipelineContextDefaultData(metadata io.ReadCloser) { func (m *ContextDefaultData) readPipelineContextDefaultData(metadata io.ReadCloser) {
defer metadata.Close() defer metadata.Close()
content, err := ioutil.ReadAll(metadata) content, err := ioutil.ReadAll(metadata)
@ -41,6 +41,7 @@ func (m *ContextDefaultData) readPipelineContextDefaultData(metadata io.ReadClos
checkError(err) checkError(err)
} }
// ReadContextDefaultMap maps the default descriptions into a map
func (c *ContextDefaultData) readContextDefaultMap() map[string]string { func (c *ContextDefaultData) readContextDefaultMap() map[string]string {
var m map[string]string = make(map[string]string) var m map[string]string = make(map[string]string)

View File

@ -36,3 +36,4 @@ params:
description: as dockerWorkspace for the sidecar container description: as dockerWorkspace for the sidecar container
- name: stashContent - name: stashContent
description: Specific stashes that should be considered for the step execution. description: Specific stashes that should be considered for the step execution.