1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-01-28 05:47:08 +02:00

chore: update formatting (#4111)

This commit is contained in:
Oliver Nocon 2022-11-08 08:47:38 +01:00 committed by GitHub
parent 5f643826f5
commit 25216b3ef8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
40 changed files with 156 additions and 154 deletions

View File

@ -58,7 +58,7 @@ func runAbapAddonAssemblyKitCheckCVs(config *abapAddonAssemblyKitCheckCVsOptions
return nil
}
//take the product part from CPE and the repositories part from the YAML file
// take the product part from CPE and the repositories part from the YAML file
func combineYAMLRepositoriesWithCPEProduct(addonDescriptor abaputils.AddonDescriptor, addonDescriptorFromCPE abaputils.AddonDescriptor) abaputils.AddonDescriptor {
addonDescriptorFromCPE.Repositories = addonDescriptor.Repositories
return addonDescriptorFromCPE

View File

@ -423,7 +423,7 @@ func (vE *valuesEvaluator) generateValueSlice() []abapbuild.Value {
return values
}
//**********************************Evaluate AddonDescriptor**************************************************************
// **********************************Evaluate AddonDescriptor**************************************************************
type myRepo struct {
abaputils.Repository
}

View File

@ -436,7 +436,7 @@ func generateHTMLDocumentAUnit(parsedXML *AUnitResult) (htmlDocumentString strin
// Object Set Structure
//
//AUnitConfig object for parsing yaml config of software components and packages
// AUnitConfig object for parsing yaml config of software components and packages
type AUnitConfig struct {
Title string `json:"title,omitempty"`
Context string `json:"context,omitempty"`
@ -444,7 +444,7 @@ type AUnitConfig struct {
ObjectSet abaputils.ObjectSet `json:"objectset,omitempty"`
}
//AUnitOptions in form of packages and software components to be checked
// AUnitOptions in form of packages and software components to be checked
type AUnitOptions struct {
Measurements string `json:"measurements,omitempty"`
Scope Scope `json:"scope,omitempty"`
@ -452,20 +452,20 @@ type AUnitOptions struct {
Duration Duration `json:"duration,omitempty"`
}
//Scope in form of packages and software components to be checked
// Scope in form of packages and software components to be checked
type Scope struct {
OwnTests *bool `json:"owntests,omitempty"`
ForeignTests *bool `json:"foreigntests,omitempty"`
}
//RiskLevel in form of packages and software components to be checked
// RiskLevel in form of packages and software components to be checked
type RiskLevel struct {
Harmless *bool `json:"harmless,omitempty"`
Dangerous *bool `json:"dangerous,omitempty"`
Critical *bool `json:"critical,omitempty"`
}
//Duration in form of packages and software components to be checked
// Duration in form of packages and software components to be checked
type Duration struct {
Short *bool `json:"short,omitempty"`
Medium *bool `json:"medium,omitempty"`
@ -476,7 +476,7 @@ type Duration struct {
// AUnit Run Structure
//
//AUnitRun Object for parsing XML
// AUnitRun Object for parsing XML
type AUnitRun struct {
XMLName xml.Name `xml:"run"`
Title string `xml:"title,attr"`
@ -487,24 +487,24 @@ type AUnitRun struct {
Link AUnitLink `xml:"link"`
}
//Progress of AUnit run
// Progress of AUnit run
type Progress struct {
Status string `xml:"status,attr"`
Percentage string `xml:"percentage,attr"`
}
//ExecutedBy User
// ExecutedBy User
type ExecutedBy struct {
User string `xml:"user,attr"`
}
//Time run was started and finished
// Time run was started and finished
type Time struct {
Started string `xml:"started,attr"`
Ended string `xml:"ended,attr"`
}
//AUnitLink containing result locations
// AUnitLink containing result locations
type AUnitLink struct {
Href string `xml:"href,attr"`
Rel string `xml:"rel,attr"`

View File

@ -86,7 +86,7 @@ func runApiKeyValueMapUpload(config *apiKeyValueMapUploadOptions, telemetryData
return errors.Errorf("Failed to upload API key value map artefact, Response Status code: %v", apiProxyUploadStatusResp.StatusCode)
}
//createJSONPayload -return http payload as byte array
// createJSONPayload -return http payload as byte array
func createJSONPayload(config *apiKeyValueMapUploadOptions) (*bytes.Buffer, error) {
jsonObj := gabs.New()
jsonObj.Set(config.Key, "name")

View File

@ -20,7 +20,7 @@ func apiProviderDownloadMockUtilsBundle() *apiProviderDownloadTestUtilsBundle {
return &utilsBundle
}
//Successful API Provider download cases
// Successful API Provider download cases
func TestApiProviderDownloadSuccess(t *testing.T) {
t.Parallel()
t.Run("Successful Download of API Provider", func(t *testing.T) {
@ -64,7 +64,7 @@ func TestApiProviderDownloadSuccess(t *testing.T) {
})
}
//API Provider download failure cases
// API Provider download failure cases
func TestApiProviderDownloadFailure(t *testing.T) {
t.Parallel()

View File

@ -115,7 +115,7 @@ func runIntegrationArtifactDeploy(config *integrationArtifactDeployOptions, tele
return errors.Errorf("integration flow deployment failed, response Status code: %v", deployResp.StatusCode)
}
//pollIFlowDeploymentStatus - Poll the integration flow deployment status, return status or error details
// pollIFlowDeploymentStatus - Poll the integration flow deployment status, return status or error details
func pollIFlowDeploymentStatus(taskId string, retryCount int, config *integrationArtifactDeployOptions, httpClient piperhttp.Sender, apiHost string) error {
if retryCount <= 0 {
@ -152,7 +152,7 @@ func pollIFlowDeploymentStatus(taskId string, retryCount int, config *integratio
return nil
}
//GetHTTPErrorMessage - Return HTTP failure message
// GetHTTPErrorMessage - Return HTTP failure message
func getHTTPErrorMessage(httpErr error, response *http.Response, httpMethod, statusURL string) (string, error) {
responseBody, readErr := ioutil.ReadAll(response.Body)
if readErr != nil {
@ -162,7 +162,7 @@ func getHTTPErrorMessage(httpErr error, response *http.Response, httpMethod, sta
return "", errors.Wrapf(httpErr, "HTTP %v request to %v failed with error: %v", httpMethod, statusURL, responseBody)
}
//getIntegrationArtifactDeployStatus - Get integration artifact Deploy Status
// getIntegrationArtifactDeployStatus - Get integration artifact Deploy Status
func getIntegrationArtifactDeployStatus(config *integrationArtifactDeployOptions, httpClient piperhttp.Sender, apiHost string, taskId string) (string, error) {
httpMethod := "GET"
header := make(http.Header)
@ -201,7 +201,7 @@ func getIntegrationArtifactDeployStatus(config *integrationArtifactDeployOptions
return "", errors.Errorf("failed to get Integration Flow artefact runtime status, response Status code: %v", deployStatusResp.StatusCode)
}
//getIntegrationArtifactDeployError - Get integration artifact deploy error details
// getIntegrationArtifactDeployError - Get integration artifact deploy error details
func getIntegrationArtifactDeployError(config *integrationArtifactDeployOptions, httpClient piperhttp.Sender, apiHost string) (string, error) {
httpMethod := "GET"
header := make(http.Header)

View File

@ -106,7 +106,7 @@ func runIntegrationArtifactGetMplStatus(
return errors.Errorf("Unable to get integration flow MPL status, Response Status code: %v", mplStatusResp.StatusCode)
}
//getIntegrationArtifactMPLError - Get integration artifact MPL error details
// getIntegrationArtifactMPLError - Get integration artifact MPL error details
func getIntegrationArtifactMPLError(commonPipelineEnvironment *integrationArtifactGetMplStatusCommonPipelineEnvironment, mplID string, httpClient piperhttp.Sender, apiHost string) (string, error) {
httpMethod := "GET"
header := make(http.Header)

View File

@ -75,7 +75,7 @@ func runIntegrationArtifactResource(config *integrationArtifactResourceOptions,
}
}
//UploadIntegrationArtifactResource - Upload new resource file to existing integration flow design time artefact
// UploadIntegrationArtifactResource - Upload new resource file to existing integration flow design time artefact
func UploadIntegrationArtifactResource(config *integrationArtifactResourceOptions, httpClient piperhttp.Sender, fileUtils piperutils.FileUtils, apiHost string) error {
httpMethod := "POST"
uploadIflowStatusURL := fmt.Sprintf("%s/api/v1/IntegrationDesigntimeArtifacts(Id='%s',Version='%s')/Resources", apiHost, config.IntegrationFlowID, "Active")
@ -102,7 +102,7 @@ func UploadIntegrationArtifactResource(config *integrationArtifactResourceOption
return HttpResponseHandler(uploadIflowStatusResp, httpErr, &integrationArtifactResourceData)
}
//UpdateIntegrationArtifactResource - Update integration artifact resource file
// UpdateIntegrationArtifactResource - Update integration artifact resource file
func UpdateIntegrationArtifactResource(config *integrationArtifactResourceOptions, httpClient piperhttp.Sender, fileUtils piperutils.FileUtils, apiHost string) error {
httpMethod := "PUT"
header := make(http.Header)
@ -133,7 +133,7 @@ func UpdateIntegrationArtifactResource(config *integrationArtifactResourceOption
return HttpResponseHandler(updateIflowStatusResp, httpErr, &integrationArtifactResourceData)
}
//DeleteIntegrationArtifactResource - Delete integration artifact resource file
// DeleteIntegrationArtifactResource - Delete integration artifact resource file
func DeleteIntegrationArtifactResource(config *integrationArtifactResourceOptions, httpClient piperhttp.Sender, fileUtils piperutils.FileUtils, apiHost string) error {
httpMethod := "DELETE"
header := make(http.Header)
@ -160,7 +160,7 @@ func DeleteIntegrationArtifactResource(config *integrationArtifactResourceOption
return HttpResponseHandler(deleteIflowResourceStatusResp, httpErr, &integrationArtifactResourceData)
}
//GetJSONPayload -return http payload as byte array
// GetJSONPayload -return http payload as byte array
func GetJSONPayload(config *integrationArtifactResourceOptions, mode string, fileUtils piperutils.FileUtils) (*bytes.Buffer, error) {
fileContent, readError := fileUtils.FileRead(config.ResourcePath)
if readError != nil {
@ -186,7 +186,7 @@ func GetJSONPayload(config *integrationArtifactResourceOptions, mode string, fil
return bytes.NewBuffer(jsonBody), nil
}
//GetResourceFileExtension -return resource file extension
// GetResourceFileExtension -return resource file extension
func GetResourceFileExtension(filename string) string {
fileExtension := filepath.Ext(filename)
switch fileExtension {
@ -203,7 +203,7 @@ func GetResourceFileExtension(filename string) string {
}
}
//HttpResponseHandler - handle http response object
// HttpResponseHandler - handle http response object
func HttpResponseHandler(resp *http.Response, httpErr error, integrationArtifactResourceData *integrationArtifactResourceData) error {
if resp != nil && resp.Body != nil {

View File

@ -81,7 +81,7 @@ func runIntegrationArtifactUpload(config *integrationArtifactUploadOptions, tele
return errors.Errorf("Failed to check integration flow availability, Response Status code: %v", iFlowStatusResp.StatusCode)
}
//UploadIntegrationArtifact - Upload new integration artifact
// UploadIntegrationArtifact - Upload new integration artifact
func UploadIntegrationArtifact(config *integrationArtifactUploadOptions, httpClient piperhttp.Sender, fileUtils piperutils.FileUtils, apiHost string) error {
httpMethod := "POST"
uploadIflowStatusURL := fmt.Sprintf("%s/api/v1/IntegrationDesigntimeArtifacts", apiHost)
@ -119,7 +119,7 @@ func UploadIntegrationArtifact(config *integrationArtifactUploadOptions, httpCli
return errors.Errorf("Failed to create Integration Flow artefact, Response Status code: %v", uploadIflowStatusResp.StatusCode)
}
//UpdateIntegrationArtifact - Update existing integration artifact
// UpdateIntegrationArtifact - Update existing integration artifact
func UpdateIntegrationArtifact(config *integrationArtifactUploadOptions, httpClient piperhttp.Sender, fileUtils piperutils.FileUtils, apiHost string) error {
httpMethod := "PUT"
header := make(http.Header)
@ -156,7 +156,7 @@ func UpdateIntegrationArtifact(config *integrationArtifactUploadOptions, httpCli
return errors.Errorf("Failed to update Integration Flow artefact, Response Status code: %v", updateIflowStatusResp.StatusCode)
}
//GetJSONPayloadAsByteArray -return http payload as byte array
// GetJSONPayloadAsByteArray -return http payload as byte array
func GetJSONPayloadAsByteArray(config *integrationArtifactUploadOptions, mode string, fileUtils piperutils.FileUtils) (*bytes.Buffer, error) {
fileContent, readError := fileUtils.FileRead(config.FilePath)
if readError != nil {

View File

@ -230,12 +230,12 @@ type dockerClientMock struct {
localPath string
}
//DownloadImage download the image to the specified path
// DownloadImage download the image to the specified path
func (c *dockerClientMock) DownloadImage(imageSource, filePath string) (v1.Image, error) {
return &fake.FakeImage{}, nil // fmt.Errorf("%s", filePath)
}
//DownloadImage download the image to the specified path
// DownloadImage download the image to the specified path
func (c *dockerClientMock) DownloadImageContent(imageSource, filePath string) (v1.Image, error) {
return &fake.FakeImage{}, nil // fmt.Errorf("%s", filePath)
}

View File

@ -473,7 +473,7 @@ func copyFileFromPwdToHome(xsSessionFile string, fileUtils piperutils.FileUtils)
return nil
}
//GetAction ...
// GetAction ...
func (a Action) GetAction() (string, error) {
switch a {
case Resume, Abort, Retry:
@ -483,7 +483,7 @@ func (a Action) GetAction() (string, error) {
}
//GetDeployCommand ...
// GetDeployCommand ...
func (m DeployMode) GetDeployCommand() (string, error) {
switch m {

View File

@ -103,7 +103,7 @@ func (bundle *AakBundleMock) ReadAddonDescriptor(FileName string) (abaputils.Add
return addonDescriptor, err
}
//*****************************other client mock *******************************
// *****************************other client mock *******************************
type AakBundleMockNewMC struct {
*mock.ExecMockRunner
*abapbuild.MockClient

View File

@ -43,7 +43,7 @@ const (
dummyResultName string = "Dummy"
)
//******** structs needed for json convertion ********
// ******** structs needed for json convertion ********
type jsonBuild struct {
Build struct {
BuildID string `json:"build_id"`
@ -576,7 +576,7 @@ func (in inputForPost) String() string {
return fmt.Sprintf(`{ "phase": "%s", "values": [%s]}`, in.phase, in.values.String())
}
//******** unmarshal function ************
// ******** unmarshal function ************
func unmarshalTasks(body []byte, connector Connector) ([]task, error) {
var tasks []task

View File

@ -249,7 +249,7 @@ type AbapEnvironmentRunATCCheckOptions struct {
* Structs for ABAP in general *
********************************/
//AbapEnvironmentOptions contains cloud foundry fields and the host parameter for connections to ABAP Environment instances
// AbapEnvironmentOptions contains cloud foundry fields and the host parameter for connections to ABAP Environment instances
type AbapEnvironmentOptions struct {
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`

View File

@ -251,7 +251,7 @@ func GetStatus(failureMessage string, connectionDetails ConnectionDetailsHTTP, c
return body, resp.Status, nil
}
//GetRepositories for parsing one or multiple branches and repositories from repositories file or branchName and repositoryName configuration
// GetRepositories for parsing one or multiple branches and repositories from repositories file or branchName and repositoryName configuration
func GetRepositories(config *RepositoriesConfig, branchRequired bool) ([]Repository, error) {
var repositories = make([]Repository, 0)
if reflect.DeepEqual(RepositoriesConfig{}, config) {
@ -429,7 +429,7 @@ type LogResults struct {
Timestamp string `json:"timestamp"`
}
//RepositoriesConfig struct for parsing one or multiple branches and repositories configurations
// RepositoriesConfig struct for parsing one or multiple branches and repositories configurations
type RepositoriesConfig struct {
BranchName string
CommitID string

View File

@ -6,7 +6,7 @@ import (
"github.com/SAP/jenkins-library/pkg/log"
)
//ObjectSet in form of packages and software components to be checked
// ObjectSet in form of packages and software components to be checked
type ObjectSet struct {
PackageNames []Package `json:"packages,omitempty"`
SoftwareComponents []SoftwareComponents `json:"softwarecomponents,omitempty"`
@ -16,7 +16,7 @@ type ObjectSet struct {
Set []Set `json:"set,omitempty"`
}
//MultiPropertySet that can possibly contain any subsets/object of the OSL
// MultiPropertySet that can possibly contain any subsets/object of the OSL
type MultiPropertySet struct {
Type string `json:"type,omitempty"`
PackageNames []Package `json:"packages,omitempty"`
@ -33,7 +33,7 @@ type MultiPropertySet struct {
SourceSystems []SourceSystem `json:"sourcesystems,omitempty"`
}
//Set
// Set
type Set struct {
Type string `json:"type,omitempty"`
Set []Set `json:"set,omitempty"`
@ -44,89 +44,89 @@ type Set struct {
ObjectTypeSet []ObjectTypeSet `json:"objecttype,omitempty"`
}
//PackageSet in form of packages to be checked
// PackageSet in form of packages to be checked
type PackageSet struct {
Name string `json:"name,omitempty"`
IncludeSubpackages *bool `json:"includesubpackages,omitempty"`
}
//FlatObjectSet
// FlatObjectSet
type FlatObjectSet struct {
Name string `json:"name,omitempty"`
Type string `json:"type,omitempty"`
}
//ComponentSet in form of software components to be checked
// ComponentSet in form of software components to be checked
type ComponentSet struct {
Name string `json:"name,omitempty"`
}
//TransportSet in form of transports to be checked
// TransportSet in form of transports to be checked
type TransportSet struct {
Number string `json:"number,omitempty"`
}
//ObjectTypeSet
// ObjectTypeSet
type ObjectTypeSet struct {
Name string `json:"name,omitempty"`
}
//Package for MPS
// Package for MPS
type Package struct {
Name string `json:"name,omitempty"`
}
//Packagetree for MPS
// Packagetree for MPS
type PackageTree struct {
Name string `json:"name,omitempty"`
}
//ObjectTypeGroup
// ObjectTypeGroup
type ObjectTypeGroup struct {
Name string `json:"name,omitempty"`
}
//ObjectType
// ObjectType
type ObjectType struct {
Name string `json:"name,omitempty"`
}
//Owner
// Owner
type Owner struct {
Name string `json:"name,omitempty"`
}
//ReleaseState
// ReleaseState
type ReleaseState struct {
Value string `json:"value,omitempty"`
}
//Version
// Version
type Version struct {
Value string `json:"value,omitempty"`
}
//ApplicationComponent
// ApplicationComponent
type ApplicationComponent struct {
Name string `json:"name,omitempty"`
}
//SoftwareComponents
// SoftwareComponents
type SoftwareComponents struct {
Name string `json:"name,omitempty"`
}
//TransportLayer
// TransportLayer
type TransportLayer struct {
Name string `json:"name,omitempty"`
}
//Language
// Language
type Language struct {
Value string `json:"value,omitempty"`
}
//SourceSystem
// SourceSystem
type SourceSystem struct {
Name string `json:"name,omitempty"`
}

View File

@ -29,7 +29,7 @@ type Variable struct {
AllowOverride bool
}
//UpdateVariables updates variables in build definition or creates them if they are missing
// UpdateVariables updates variables in build definition or creates them if they are missing
func (bc *BuildClientImpl) UpdateVariables(variables []Variable) error {
if len(variables) == 0 {
return errors.New("error: slice variables must not be empty")
@ -74,7 +74,7 @@ func (bc *BuildClientImpl) UpdateVariables(variables []Variable) error {
return nil
}
//NewBuildClient Create a client to interact with the Build area
// NewBuildClient Create a client to interact with the Build area
func NewBuildClient(organization string, personalAccessToken string, project string, pipelineID int) (BuildClient, error) {
if organization == "" {
return nil, errors.New("error: organization must not be empty")

View File

@ -12,31 +12,31 @@ import (
"github.com/pkg/errors"
)
//Utils for apim
// Utils for apim
type Utils interface {
InitAPIM() error
IsPayloadJSON() bool
}
//OdataUtils for apim
// OdataUtils for apim
type OdataUtils interface {
MakeOdataQuery() (string, error)
}
//OdataParameters struct
// OdataParameters struct
type OdataParameters struct {
Filter, Search string
Top, Skip int
Orderby, Select, Expand string
}
//Bundle struct
// Bundle struct
type Bundle struct {
APIServiceKey, Host, Payload string
Client piperhttp.Sender
}
//InitAPIM() fumnction initialize APIM bearer token for API access
// InitAPIM() fumnction initialize APIM bearer token for API access
func (apim *Bundle) InitAPIM() error {
serviceKey, err := cpi.ReadCpiServiceKey(apim.APIServiceKey)
if err != nil {
@ -60,7 +60,7 @@ func (apim *Bundle) InitAPIM() error {
return nil
}
//IsJSON checks given string is valid json or not
// IsJSON checks given string is valid json or not
func (apim *Bundle) IsPayloadJSON() bool {
var js json.RawMessage
return json.Unmarshal([]byte(apim.Payload), &js) == nil

View File

@ -165,7 +165,7 @@ type ShortDescription struct {
Text string `json:"shortDescription"`
}
//DetailedResult - DetailedResult Structure
// DetailedResult - DetailedResult Structure
type DetailedResult struct {
XMLName xml.Name `xml:"CxXMLResults"`
InitiatorName string `xml:"InitiatorName,attr"`

View File

@ -8,14 +8,14 @@ import (
"github.com/SAP/jenkins-library/pkg/log"
)
//LoginCheck checks if user is logged in to Cloud Foundry with the receiver provided
//to the function call.
// LoginCheck checks if user is logged in to Cloud Foundry with the receiver provided
// to the function call.
func (cf *CFUtils) LoginCheck(options LoginOptions) (bool, error) {
return cf.loggedIn, nil
}
//Login logs user in to Cloud Foundry via cf cli.
//Checks if user is logged in first, if not perform 'cf login' command with appropriate parameters
// Login logs user in to Cloud Foundry via cf cli.
// Checks if user is logged in first, if not perform 'cf login' command with appropriate parameters
func (cf *CFUtils) Login(options LoginOptions) error {
var err error
@ -62,8 +62,8 @@ func (cf *CFUtils) Login(options LoginOptions) error {
return nil
}
//Logout logs User out of Cloud Foundry
//Logout can be perforned via 'cf logout' command regardless if user is logged in or not
// Logout logs User out of Cloud Foundry
// Logout can be perforned via 'cf logout' command regardless if user is logged in or not
func (cf *CFUtils) Logout() error {
_c := cf.Exec
@ -85,7 +85,7 @@ func (cf *CFUtils) Logout() error {
return nil
}
//LoginOptions for logging in to CF
// LoginOptions for logging in to CF
type LoginOptions struct {
CfAPIEndpoint string
CfOrg string

View File

@ -59,7 +59,7 @@ func (cf *CFUtils) ReadServiceKey(options ServiceKeyOptions) (string, error) {
return serviceKeyJSON, err
}
//ServiceKeyOptions for reading CF Service Key
// ServiceKeyOptions for reading CF Service Key
type ServiceKeyOptions struct {
CfAPIEndpoint string
CfOrg string

View File

@ -90,7 +90,7 @@ func (c *Command) GetStdout() io.Writer {
return c.stdout
}
//GetStderr Retursn the writer for stderr
// GetStderr Retursn the writer for stderr
func (c *Command) GetStderr() io.Writer {
return c.stderr
}
@ -125,7 +125,8 @@ func (c *Command) RunShell(shell, script string) error {
// RunExecutable runs the specified executable with parameters
// !! While the cmd.Env is applied during command execution, it is NOT involved when the actual executable is resolved.
// Thus the executable needs to be on the PATH of the current process and it is not sufficient to alter the PATH on cmd.Env.
//
// Thus the executable needs to be on the PATH of the current process and it is not sufficient to alter the PATH on cmd.Env.
func (c *Command) RunExecutable(executable string, params ...string) error {
c.prepareOut()
@ -152,7 +153,8 @@ func (c *Command) RunExecutable(executable string, params ...string) error {
// RunExecutableInBackground runs the specified executable with parameters in the background non blocking
// !! While the cmd.Env is applied during command execution, it is NOT involved when the actual executable is resolved.
// Thus the executable needs to be on the PATH of the current process and it is not sufficient to alter the PATH on cmd.Env.
//
// Thus the executable needs to be on the PATH of the current process and it is not sufficient to alter the PATH on cmd.Env.
func (c *Command) RunExecutableInBackground(executable string, params ...string) (Execution, error) {
c.prepareOut()

View File

@ -13,7 +13,7 @@ import (
"github.com/stretchr/testify/assert"
)
//based on https://golang.org/src/os/exec/exec_test.go
// based on https://golang.org/src/os/exec/exec_test.go
func helperCommand(command string, s ...string) (cmd *exec.Cmd) {
cs := []string{"-test.run=TestHelperProcess", "--", command}
cs = append(cs, s...)
@ -232,8 +232,8 @@ func TestCmdPipes(t *testing.T) {
})
}
//based on https://golang.org/src/os/exec/exec_test.go
//this is not directly executed
// based on https://golang.org/src/os/exec/exec_test.go
// this is not directly executed
func TestHelperProcess(*testing.T) {
if os.Getenv("GO_WANT_HELPER_PROCESS") != "1" {

View File

@ -6,7 +6,7 @@ import (
"sync"
)
//errCopyStdout and errCopyStderr are filled after the command execution after Wait() terminates
// errCopyStdout and errCopyStderr are filled after the command execution after Wait() terminates
type execution struct {
cmd *exec.Cmd
wg sync.WaitGroup

View File

@ -17,35 +17,35 @@ import (
"github.com/pkg/errors"
)
//CommonUtils for CPI
// CommonUtils for CPI
type CommonUtils interface {
GetBearerToken() (string, error)
}
//HttpCPIUtils for CPI
// HttpCPIUtils for CPI
type HttpCPIUtils interface {
HandleHTTPFileDownloadResponse() error
}
//HTTPUploadUtils for CPI
// HTTPUploadUtils for CPI
type HTTPUploadUtils interface {
HandleHTTPFileUploadResponse() error
HandleHTTPGetRequestResponse() (string, error)
}
//TokenParameters struct
// TokenParameters struct
type TokenParameters struct {
TokenURL, Username, Password string
Client piperhttp.Sender
}
//HttpParameters struct
// HttpParameters struct
type HttpFileDownloadRequestParameters struct {
ErrMessage, FileDownloadPath string
Response *http.Response
}
//HTTPFileUploadRequestParameters struct
// HTTPFileUploadRequestParameters struct
type HttpFileUploadRequestParameters struct {
ErrMessage, FilePath, HTTPMethod, HTTPURL, SuccessMessage string
Response *http.Response

View File

@ -12,7 +12,7 @@ import (
"github.com/pkg/errors"
)
//GetCPIFunctionMockResponse -Generate mock response payload for different CPI functions
// GetCPIFunctionMockResponse -Generate mock response payload for different CPI functions
func GetCPIFunctionMockResponse(functionName, testType string) (*http.Response, error) {
switch functionName {
case "IntegrationArtifactDeploy", "PositiveAndUnDeployIntegrationDesigntimeArtifact":
@ -75,7 +75,7 @@ func GetCPIFunctionMockResponse(functionName, testType string) (*http.Response,
}
}
//GetEmptyHTTPResponseBodyAndErrorNil -Empty http respose body
// GetEmptyHTTPResponseBodyAndErrorNil -Empty http respose body
func GetEmptyHTTPResponseBodyAndErrorNil() (*http.Response, error) {
res := http.Response{
StatusCode: 202,
@ -84,7 +84,7 @@ func GetEmptyHTTPResponseBodyAndErrorNil() (*http.Response, error) {
return &res, nil
}
//GetParameterKeyMissingResponseBody -Parameter key missing http respose body
// GetParameterKeyMissingResponseBody -Parameter key missing http respose body
func GetParameterKeyMissingResponseBody() (*http.Response, error) {
res := http.Response{
StatusCode: 404,
@ -99,7 +99,7 @@ func GetParameterKeyMissingResponseBody() (*http.Response, error) {
return &res, errors.New("Not found - either wrong version for the given Id or wrong parameter key")
}
//GetNegativeCaseHTTPResponseBodyAndErrorNil -Negative case http respose body
// GetNegativeCaseHTTPResponseBodyAndErrorNil -Negative case http respose body
func GetNegativeCaseHTTPResponseBodyAndErrorNil() (*http.Response, error) {
res := http.Response{
StatusCode: 400,
@ -114,7 +114,7 @@ func GetNegativeCaseHTTPResponseBodyAndErrorNil() (*http.Response, error) {
return &res, nil
}
//GetIntegrationArtifactGetMplStatusCommandMockResponse -Provide http respose body
// GetIntegrationArtifactGetMplStatusCommandMockResponse -Provide http respose body
func GetIntegrationArtifactGetMplStatusCommandMockResponse(testType string) (*http.Response, error) {
if testType == "Positive" {
res := http.Response{
@ -161,7 +161,7 @@ func GetIntegrationArtifactGetMplStatusCommandMockResponse(testType string) (*ht
return &res, errors.New("Unable to get integration flow MPL status, Response Status code:400")
}
//GetIntegrationArtifactGetServiceEndpointCommandMockResponse -Provide http respose body
// GetIntegrationArtifactGetServiceEndpointCommandMockResponse -Provide http respose body
func GetIntegrationArtifactGetServiceEndpointCommandMockResponse(testCaseType string) (*http.Response, error) {
if testCaseType == "PositiveAndGetetIntegrationArtifactGetServiceResBody" {
return GetIntegrationArtifactGetServiceEndpointPositiveCaseRespBody()
@ -179,7 +179,7 @@ func GetIntegrationArtifactGetServiceEndpointCommandMockResponse(testCaseType st
return &res, errors.New("Unable to get integration flow service endpoint, Response Status code:400")
}
//TriggerIntegrationTestMockResponse
// TriggerIntegrationTestMockResponse
func TriggerIntegrationTestMockResponse(testCaseType string) (*http.Response, error) {
if testCaseType == "Positive" {
return &http.Response{
@ -199,7 +199,7 @@ func TriggerIntegrationTestMockResponse(testCaseType string) (*http.Response, er
return &res, errors.New("Unable to trigger integration test, Response Status code:400")
}
//GetIntegrationArtifactGetServiceEndpointPositiveCaseRespBody -Provide http respose body for positive case
// GetIntegrationArtifactGetServiceEndpointPositiveCaseRespBody -Provide http respose body for positive case
func GetIntegrationArtifactGetServiceEndpointPositiveCaseRespBody() (*http.Response, error) {
resp := http.Response{
@ -238,7 +238,7 @@ func GetIntegrationArtifactGetServiceEndpointPositiveCaseRespBody() (*http.Respo
return &resp, nil
}
//GetRespBodyHTTPStatusOK -Provide http respose body for Http StatusOK
// GetRespBodyHTTPStatusOK -Provide http respose body for Http StatusOK
func GetRespBodyHTTPStatusOK() (*http.Response, error) {
resp := http.Response{
@ -248,7 +248,7 @@ func GetRespBodyHTTPStatusOK() (*http.Response, error) {
return &resp, nil
}
//GetRespBodyHTTPStatusCreated -Provide http respose body for Http StatusOK
// GetRespBodyHTTPStatusCreated -Provide http respose body for Http StatusOK
func GetRespBodyHTTPStatusCreated() (*http.Response, error) {
resp := http.Response{
@ -258,7 +258,7 @@ func GetRespBodyHTTPStatusCreated() (*http.Response, error) {
return &resp, nil
}
//GetRespBodyHTTPStatusServiceNotFound -Provide http respose body for Http URL not Found
// GetRespBodyHTTPStatusServiceNotFound -Provide http respose body for Http URL not Found
func GetRespBodyHTTPStatusServiceNotFound() (*http.Response, error) {
resp := http.Response{
@ -268,7 +268,7 @@ func GetRespBodyHTTPStatusServiceNotFound() (*http.Response, error) {
return &resp, errors.New("Integration Package not found")
}
//GetRespBodyHTTPStatusServiceErrorResponse -Provide http respose body for server error
// GetRespBodyHTTPStatusServiceErrorResponse -Provide http respose body for server error
func GetRespBodyHTTPStatusServiceErrorResponse() (*http.Response, error) {
resp := http.Response{
@ -278,25 +278,25 @@ func GetRespBodyHTTPStatusServiceErrorResponse() (*http.Response, error) {
return &resp, errors.New("401 Unauthorized")
}
//IntegrationArtifactDownloadCommandMockResponse -Provide http respose body
// IntegrationArtifactDownloadCommandMockResponse -Provide http respose body
func IntegrationArtifactDownloadCommandMockResponse(testType string) (*http.Response, error) {
return GetMockResponseByTestTypeAndMockFunctionName("IntegrationArtifactDownloadCommandMockResponse", testType)
}
//GetIntegrationDesigntimeArtifactMockResponse -Provide http respose body
// GetIntegrationDesigntimeArtifactMockResponse -Provide http respose body
func GetIntegrationDesigntimeArtifactMockResponse(testType string) (*http.Response, error) {
return GetMockResponseByTestTypeAndMockFunctionName("GetIntegrationDesigntimeArtifactMockResponse", testType)
}
//IntegrationDesigntimeArtifactUpdateMockResponse -Provide http respose body
// IntegrationDesigntimeArtifactUpdateMockResponse -Provide http respose body
func IntegrationDesigntimeArtifactUpdateMockResponse(testType string) (*http.Response, error) {
return GetMockResponseByTestTypeAndMockFunctionName("IntegrationDesigntimeArtifactUpdateMockResponse", testType)
}
//GetMockResponseByTestTypeAndMockFunctionName - Get mock response by testtype and mock function name
// GetMockResponseByTestTypeAndMockFunctionName - Get mock response by testtype and mock function name
func GetMockResponseByTestTypeAndMockFunctionName(mockFuntionName, testType string) (*http.Response, error) {
response, error := GetPositiveCaseResponseByTestType(testType)
@ -348,7 +348,7 @@ func GetMockResponseByTestTypeAndMockFunctionName(mockFuntionName, testType stri
return response, error
}
//NegtiveResForIntegrationArtifactGenericCommandMockResponse -Nagative Case http response body
// NegtiveResForIntegrationArtifactGenericCommandMockResponse -Nagative Case http response body
func NegtiveResForIntegrationArtifactGenericCommandMockResponse(message string) (*http.Response, error) {
res := http.Response{
@ -364,7 +364,7 @@ func NegtiveResForIntegrationArtifactGenericCommandMockResponse(message string)
return &res, errors.New(message)
}
//UpdateIntegrationDesigntimeArtifactMockResponse -Provide http respose body
// UpdateIntegrationDesigntimeArtifactMockResponse -Provide http respose body
func UpdateIntegrationDesigntimeArtifactMockResponse(testType string) (*http.Response, error) {
response, error := GetRespBodyHTTPStatusCreated()
@ -386,7 +386,7 @@ func UpdateIntegrationDesigntimeArtifactMockResponse(testType string) (*http.Res
return response, error
}
//IntegrationArtifactDownloadCommandMockResponsePositiveCaseRespBody -Provide http respose body for positive case
// IntegrationArtifactDownloadCommandMockResponsePositiveCaseRespBody -Provide http respose body for positive case
func IntegrationArtifactDownloadCommandMockResponsePositiveCaseRespBody() (*http.Response, error) {
header := make(http.Header)
headerValue := "attachment; filename=flow1.zip"
@ -399,7 +399,7 @@ func IntegrationArtifactDownloadCommandMockResponsePositiveCaseRespBody() (*http
return &resp, nil
}
//GetPositiveCaseResponseByTestType - get postive response by test case type
// GetPositiveCaseResponseByTestType - get postive response by test case type
func GetPositiveCaseResponseByTestType(testType string) (*http.Response, error) {
switch testType {
case "PositiveAndGetetIntegrationArtifactDownloadResBody":
@ -423,7 +423,7 @@ func GetPositiveCaseResponseByTestType(testType string) (*http.Response, error)
}
}
//GetCPIFunctionNameByURLCheck - get postive response by test case type
// GetCPIFunctionNameByURLCheck - get postive response by test case type
func GetCPIFunctionNameByURLCheck(url, method, testType string) string {
switch url {
case "https://demo/api/v1/IntegrationDesigntimeArtifacts(Id='flow4',Version='1.0.4')":
@ -445,7 +445,7 @@ func GetCPIFunctionNameByURLCheck(url, method, testType string) string {
}
}
//GetFunctionNameByTestTypeAndMethod -get function name by test tyep
// GetFunctionNameByTestTypeAndMethod -get function name by test tyep
func GetFunctionNameByTestTypeAndMethod(method, testType string) string {
switch testType {
@ -486,7 +486,7 @@ func GetFunctionNameByTestTypeAndMethod(method, testType string) string {
return ""
}
//GetFunctionNamePositiveAndUpdateIntegrationDesigntimeArtifactResBody -Get Function Name
// GetFunctionNamePositiveAndUpdateIntegrationDesigntimeArtifactResBody -Get Function Name
func GetFunctionNamePositiveAndUpdateIntegrationDesigntimeArtifactResBody(method string) string {
if method == "GET" {
return "IntegrationDesigntimeArtifactUpdate"
@ -497,7 +497,7 @@ func GetFunctionNamePositiveAndUpdateIntegrationDesigntimeArtifactResBody(method
return ""
}
//GetFunctionNamePositiveAndCreateIntegrationDesigntimeArtifactResBody -Get Function Name
// GetFunctionNamePositiveAndCreateIntegrationDesigntimeArtifactResBody -Get Function Name
func GetFunctionNamePositiveAndCreateIntegrationDesigntimeArtifactResBody(method string) string {
if method == "GET" {
return "GetIntegrationDesigntimeArtifact"
@ -508,19 +508,19 @@ func GetFunctionNamePositiveAndCreateIntegrationDesigntimeArtifactResBody(method
return ""
}
//GetIntegrationArtifactDeployStatusMockResponse -Provide http respose body
// GetIntegrationArtifactDeployStatusMockResponse -Provide http respose body
func GetIntegrationArtifactDeployStatusMockResponse(testType string) (*http.Response, error) {
return GetMockResponseByTestTypeAndMockFunctionName("GetIntegrationArtifactDeployStatusMockResponse", testType)
}
//GetIntegrationArtifactDeployErrorDetailsMockResponse -Provide http respose body
// GetIntegrationArtifactDeployErrorDetailsMockResponse -Provide http respose body
func GetIntegrationArtifactDeployErrorDetailsMockResponse(testType string) (*http.Response, error) {
return GetMockResponseByTestTypeAndMockFunctionName("GetIntegrationArtifactDeployErrorDetailsMockResponse", "PositiveAndGetDeployedIntegrationDesigntimeArtifactErrorResBody")
}
//GetIntegrationArtifactDeployStatusMockResponseBody -Provide http respose body
// GetIntegrationArtifactDeployStatusMockResponseBody -Provide http respose body
func GetIntegrationArtifactDeployStatusMockResponseBody() (*http.Response, error) {
resp := http.Response{
@ -530,7 +530,7 @@ func GetIntegrationArtifactDeployStatusMockResponseBody() (*http.Response, error
return &resp, nil
}
//GetIntegrationArtifactDeployStatusErrorMockResponseBody -Provide http respose body
// GetIntegrationArtifactDeployStatusErrorMockResponseBody -Provide http respose body
func GetIntegrationArtifactDeployStatusErrorMockResponseBody() (*http.Response, error) {
resp := http.Response{
@ -540,7 +540,7 @@ func GetIntegrationArtifactDeployStatusErrorMockResponseBody() (*http.Response,
return &resp, nil
}
//GetIntegrationArtifactDeployStatusPayload -Get Payload
// GetIntegrationArtifactDeployStatusPayload -Get Payload
func GetIntegrationArtifactDeployStatusPayload(status string) string {
jsonByte := []byte(`{
@ -565,7 +565,7 @@ func GetIntegrationArtifactDeployStatusPayload(status string) string {
return strings.Replace(string(jsonByte), "StatusValue", status, 1)
}
//GetIntegrationArtifactDeployErrorStatusMockResponseBody -Provide http respose body
// GetIntegrationArtifactDeployErrorStatusMockResponseBody -Provide http respose body
func GetIntegrationArtifactDeployErrorStatusMockResponseBody() (*http.Response, error) {
resp := http.Response{

View File

@ -96,7 +96,7 @@ type ClientOptions struct {
ImageFormat string
}
//Download interface for download an image to a local path
// Download interface for download an image to a local path
type Download interface {
DownloadImage(imageSource, targetFile string) (v1.Image, error)
DownloadImageContent(imageSource, targetDir string) (v1.Image, error)
@ -111,7 +111,7 @@ func (c *Client) SetOptions(options ClientOptions) {
c.imageFormat = options.ImageFormat
}
//DownloadImageContent downloads the image content into the given targetDir. Returns with an error if the targetDir doesnt exist
// DownloadImageContent downloads the image content into the given targetDir. Returns with an error if the targetDir doesnt exist
func (c *Client) DownloadImageContent(imageSource, targetDir string) (v1.Image, error) {
if fileInfo, err := os.Stat(targetDir); err != nil {
return nil, err

View File

@ -236,7 +236,7 @@ type ToolComponent struct {
Guid string `json:"guid"`
}
//SarifRuleProperties
// SarifRuleProperties
type SarifRuleProperties struct {
Accuracy string `json:"accuracy,omitempty"`
Impact string `json:"impact,omitempty"`

View File

@ -11,7 +11,7 @@ import (
"github.com/SAP/jenkins-library/pkg/piperutils"
)
//Downloader ...
// Downloader ...
type Downloader interface {
SetOptions(options ClientOptions)
DownloadFile(url, filename string, header http.Header, cookies []*http.Cookie) error

View File

@ -12,7 +12,7 @@ import (
// StringCredentials store only secret text
type StringCredentials = gojenkins.StringCredentials
//UsernameCredentials struct representing credential for storing username-password pair
// UsernameCredentials struct representing credential for storing username-password pair
type UsernameCredentials = gojenkins.UsernameCredentials
// SSHCredentials store credentials for ssh keys.

View File

@ -9,7 +9,7 @@ import (
"github.com/sirupsen/logrus"
)
//PiperLogFormatter is the custom formatter of piper
// PiperLogFormatter is the custom formatter of piper
type PiperLogFormatter struct {
logrus.TextFormatter
logFormat string
@ -21,7 +21,7 @@ const (
logFormatWithTimestamp = "timestamp"
)
//Format the log message
// Format the log message
func (formatter *PiperLogFormatter) Format(entry *logrus.Entry) (bytes []byte, err error) {
message := ""

View File

@ -97,7 +97,7 @@ func (a *AzureDevOpsConfigProvider) OrchestratorType() string {
return "Azure"
}
//GetBuildStatus returns status of the build. Return variables are aligned with Jenkins build statuses.
// GetBuildStatus returns status of the build. Return variables are aligned with Jenkins build statuses.
func (a *AzureDevOpsConfigProvider) GetBuildStatus() string {
// cases to align with Jenkins: SUCCESS, FAILURE, NOT_BUILD, ABORTED
switch buildStatus := getEnv("AGENT_JOBSTATUS", "FAILURE"); buildStatus {

View File

@ -150,7 +150,7 @@ func (f Files) Chmod(path string, mode os.FileMode) error {
// from https://golangcode.com/unzip-files-in-go/ with the following license:
// MIT License
//
// Copyright (c) 2017 Edd Turtle
// # Copyright (c) 2017 Edd Turtle
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

View File

@ -8,7 +8,7 @@ func Keys[M ~map[K]V, K comparable, V any](m M) []K {
return r
}
//Values returns the slice of values of the map provided
// Values returns the slice of values of the map provided
func Values[M ~map[K]V, K comparable, V any](m M) []V {
r := make([]V, 0, len(m))
for _, v := range m {

View File

@ -5,7 +5,7 @@ import (
"strings"
)
//ContainsInt checks whether the element is part of the slice
// ContainsInt checks whether the element is part of the slice
func ContainsInt(s []int, e int) bool {
for _, a := range s {
if a == e {
@ -15,12 +15,12 @@ func ContainsInt(s []int, e int) bool {
return false
}
//ContainsString checks whether the element is part of the slice
// ContainsString checks whether the element is part of the slice
func ContainsString(s []string, e string) bool {
return FindString(s, e) >= 0
}
//FindString returns the position of element e in the given slice or -1 if it's not in
// FindString returns the position of element e in the given slice or -1 if it's not in
func FindString(s []string, e string) int {
for i, a := range s {
if a == e {
@ -31,7 +31,7 @@ func FindString(s []string, e string) int {
return -1
}
//ContainsStringPart checks whether the element is contained as part of one of the elements of the slice
// ContainsStringPart checks whether the element is contained as part of one of the elements of the slice
func ContainsStringPart(s []string, part string) bool {
for _, a := range s {
if strings.Contains(a, part) {
@ -53,12 +53,12 @@ func RemoveAll(s []string, e string) ([]string, bool) {
return r, len(s) != len(r)
}
//Prefix adds a prefix to each element of the slice
// Prefix adds a prefix to each element of the slice
func Prefix(in []string, prefix string) []string {
return _prefix(in, prefix, true)
}
//PrefixIfNeeded adds a prefix to each element of the slice if not already prefixed
// PrefixIfNeeded adds a prefix to each element of the slice if not already prefixed
func PrefixIfNeeded(in []string, prefix string) []string {
return _prefix(in, prefix, false)
}
@ -73,7 +73,7 @@ func _prefix(in []string, prefix string, always bool) (out []string) {
return
}
//Trim removes dangling whitespaces from each element of the slice, empty elements are dropped
// Trim removes dangling whitespaces from each element of the slice, empty elements are dropped
func Trim(in []string) (out []string) {
for _, element := range in {
if trimmed := strings.TrimSpace(element); len(trimmed) > 0 {

View File

@ -6,13 +6,13 @@ const (
vulnerabilitySeverityThreshold = 7.0
)
//HasFailed checks the return status of the provided result
// HasFailed checks the return status of the provided result
func HasFailed(result ResultData) bool {
//TODO: check this in PollForResult and return error once
return len(result.Result.Status) > 0 && result.Result.Status == statusFailed
}
//HasSevereVulnerabilities checks if any non-historic, non-triaged, non-excluded vulnerability has a CVSS score above the defined threshold
// HasSevereVulnerabilities checks if any non-historic, non-triaged, non-excluded vulnerability has a CVSS score above the defined threshold
func HasSevereVulnerabilities(result Result, excludeCVEs string) bool {
for _, component := range result.Components {
for _, vulnerability := range component.Vulns {

View File

@ -31,12 +31,12 @@ type Product struct {
FileName string `json:"name,omitempty"`
}
//ResultData holds the information about the protecode result
// ResultData holds the information about the protecode result
type ResultData struct {
Result Result `json:"results,omitempty"`
}
//Result holds the detail information about the protecode result
// Result holds the detail information about the protecode result
type Result struct {
ProductID int `json:"product_id,omitempty"`
ReportURL string `json:"report_url,omitempty"`
@ -44,26 +44,26 @@ type Result struct {
Components []Component `json:"components,omitempty"`
}
//Component the protecode component information
// Component the protecode component information
type Component struct {
Vulns []Vulnerability `json:"vulns,omitempty"`
}
//Vulnerability the protecode vulnerability information
// Vulnerability the protecode vulnerability information
type Vulnerability struct {
Exact bool `json:"exact,omitempty"`
Vuln Vuln `json:"vuln,omitempty"`
Triage []Triage `json:"triage,omitempty"`
}
//Vuln holds the inforamtion about the vulnerability
// Vuln holds the inforamtion about the vulnerability
type Vuln struct {
Cve string `json:"cve,omitempty"`
Cvss float64 `json:"cvss,omitempty"`
Cvss3Score string `json:"cvss3_score,omitempty"`
}
//Triage holds the triaging information
// Triage holds the triaging information
type Triage struct {
ID int `json:"id,omitempty"`
VulnID string `json:"vuln_id,omitempty"`
@ -77,7 +77,7 @@ type Triage struct {
User User `json:"user,omitempty"`
}
//User holds the user information
// User holds the user information
type User struct {
ID int `json:"id,omitempty"`
Email string `json:"email,omitempty"`
@ -86,7 +86,7 @@ type User struct {
Username string `json:"username,omitempty"`
}
//Protecode ist the protecode client which is used by the step
// Protecode ist the protecode client which is used by the step
type Protecode struct {
serverURL string
client piperHttp.Uploader
@ -105,7 +105,7 @@ func makeProtecode(opts Options) Protecode {
return ret
}
//Options struct which can be used to configure the Protecode struct
// Options struct which can be used to configure the Protecode struct
type Options struct {
ServerURL string
Duration time.Duration
@ -115,7 +115,7 @@ type Options struct {
Logger *logrus.Entry
}
//SetOptions setter function to set the internal properties of the protecode
// SetOptions setter function to set the internal properties of the protecode
func (pc *Protecode) SetOptions(options Options) {
pc.serverURL = options.ServerURL
pc.client = &piperHttp.Client{}
@ -139,7 +139,7 @@ func (pc *Protecode) SetOptions(options Options) {
pc.client.SetOptions(httpOptions)
}
//SetHttpClient setter function to set the http client
// SetHttpClient setter function to set the http client
func (pc *Protecode) SetHttpClient(client piperHttp.Uploader) {
pc.client = client
}
@ -451,7 +451,7 @@ func scanInProgress(status string) bool {
return status != statusReady && status != statusFailed
}
//PollForResult polls the protecode scan for the result scan
// PollForResult polls the protecode scan for the result scan
func (pc *Protecode) PollForResult(productID int, timeOutInMinutes string) ResultData {
var response ResultData

View File

@ -15,7 +15,7 @@ import (
"github.com/SAP/jenkins-library/pkg/reporting"
)
//ReportData is representing the data of the step report JSON
// ReportData is representing the data of the step report JSON
type ReportData struct {
Target string `json:"target,omitempty"`
Mandatory bool `json:"mandatory,omitempty"`

View File

@ -8,7 +8,7 @@ import (
const reportFileName = "sonarscan.json"
//ReportData is representing the data of the step report JSON
// ReportData is representing the data of the step report JSON
type ReportData struct {
ServerURL string `json:"serverUrl"`
ProjectKey string `json:"projectKey"`

View File

@ -18,8 +18,8 @@ type TaskReportData struct {
ServerVersion string `properties:"serverVersion"`
}
//ReadTaskReport expects a file ".scannerwork/report-task.txt" to exist in the provided workspace directory,
//and parses its contents into the returned TaskReportData struct.
// ReadTaskReport expects a file ".scannerwork/report-task.txt" to exist in the provided workspace directory,
// and parses its contents into the returned TaskReportData struct.
func ReadTaskReport(workspace string) (result TaskReportData, err error) {
reportFile := filepath.Join(workspace, ".scannerwork", "report-task.txt")
// read file content