Skip to content

Commit

Permalink
Fix magic number warning by extracting constant
Browse files Browse the repository at this point in the history
  • Loading branch information
johnboyes authored Feb 10, 2024
1 parent 36c0771 commit ea99d18
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion internal/github/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,10 @@ func (a *Action) pullRequestNumber() int {
}

func (a *Action) outputResult(result string) {
const UserReadWriteFilePermission = 0o644
labelCheckOutput := fmt.Sprintf("label_check=%s", result)

Check failure on line 129 in internal/github/action.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] internal/github/action.go#L129

assignments should only be cuddled with other assignments (wsl)
Raw output
internal/github/action.go:129:2: assignments should only be cuddled with other assignments (wsl)
	labelCheckOutput := fmt.Sprintf("label_check=%s", result)
	^
gitHubOutputFileName := filepath.Clean(os.Getenv("GITHUB_OUTPUT"))
githubOutputFile, err := os.OpenFile(gitHubOutputFileName, os.O_APPEND|os.O_WRONLY, 0o644) //nolint:gosec
githubOutputFile, err := os.OpenFile(gitHubOutputFileName, os.O_APPEND|os.O_WRONLY, UserReadWriteFilePermission) //nolint:gosec,lll
panic.IfError(err)
_, err = githubOutputFile.WriteString(labelCheckOutput)
if err != nil {

Check failure on line 134 in internal/github/action.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] internal/github/action.go#L134

only one cuddle assignment allowed before if statement (wsl)
Raw output
internal/github/action.go:134:2: only one cuddle assignment allowed before if statement (wsl)
	if err != nil {
	^
Expand Down

0 comments on commit ea99d18

Please sign in to comment.