Skip to content

Commit

Permalink
Update golangcilint config and fix minor remarks
Browse files Browse the repository at this point in the history
  • Loading branch information
Bios-Marcel committed Dec 21, 2024
1 parent 03785c6 commit 7677830
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 12 deletions.
16 changes: 13 additions & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ linters:
enable-all: true
disable:
## These are deprecated
- execinquery
- exportloopref
- gomnd

## These are too strict for our taste
# Whitespace linter
Expand All @@ -23,7 +21,13 @@ linters:
# I don't really care about cyclopmatic complexity
- cyclop
- gocognit

# I don't see the harm in returning an interface
- ireturn
# Too many false positives, due to easyjson rn
- recvcheck
# While aligned tags look nice, i can't be arsed doing it manually.
- tagalign

## Useful, but we won't use it for now, maybe later
# Allows us to define rules for dependencies
- depguard
Expand Down Expand Up @@ -61,6 +65,12 @@ linters-settings:
# This has false positives and provides little value.
- ifElseChain

gosec:
excludes:
# weak number generator stuff; mostly false positives, as we don't do
# security sensitive things anyway.
- G404

revive:
rules:
- name: var-naming
Expand Down
2 changes: 1 addition & 1 deletion internal/api/createparse.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func parseIntValue(toParse string, lower, upper int, valueName string) (int, err
// ParseBoolean checks whether the given value is either "true" or "false".
// The checks are case-insensitive. If an empty string is supplied, false
// is returned. All other invalid input will return an error.
func ParseBoolean(valueName string, value string) (bool, error) {
func ParseBoolean(valueName, value string) (bool, error) {
if value == "" {
return false, nil
}
Expand Down
2 changes: 1 addition & 1 deletion internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ type Config struct {
RootPath string `env:"ROOT_PATH"`
// RootURL is similar to RootPath, but contains only the protocol and
// domain. So it could be https://painting.com. This is required for some
// non critical functionallity, such as metadata tags.
// non critical functionality, such as metadata tags.
RootURL string `env:"ROOT_URL"`
CPUProfilePath string `env:"CPU_PROFILE_PATH"`
// LobbySettingDefaults is used for the server side rendering of the lobby
Expand Down
2 changes: 1 addition & 1 deletion internal/frontend/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ type BasePageConfig struct {
RootPath string `json:"rootPath"`
// RootURL is similar to RootPath, but contains only the protocol and
// domain. So it could be https://painting.com. This is required for some
// non critical functionallity, such as metadata tags.
// non critical functionality, such as metadata tags.
RootURL string `json:"rootUrl"`
// CacheBust is a string that is appended to all resources to prevent
// browsers from using cached data of a previous version, but still have
Expand Down
6 changes: 3 additions & 3 deletions internal/game/lobby.go
Original file line number Diff line number Diff line change
Expand Up @@ -1146,11 +1146,11 @@ func (lobby *Lobby) Shutdown() {
lobby.Broadcast(&EventTypeOnly{Type: EventTypeShutdown})
}

// ScoreCalculation allows having different scoring systems for
// ScoreCalculation allows having different scoring systems for a lobby.
type ScoreCalculation interface {
Identifier() string
CalculateGuesserScore(*Lobby) int
CalculateDrawerScore(*Lobby) int
CalculateGuesserScore(lobby *Lobby) int
CalculateDrawerScore(lobby *Lobby) int
}

var ChillScoring = &adjustableScoringAlgorithm{
Expand Down
4 changes: 1 addition & 3 deletions internal/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
package version

import (
"fmt"
"regexp"
)

Expand All @@ -20,9 +19,8 @@ func init() {

if Version != "dev" {
// version-commit_count_after_version-hash
hashRegex := regexp.MustCompile("v.+?(?:-\\d+?-g(.+?)(?:$|-))")
hashRegex := regexp.MustCompile(`v.+?(?:-\d+?-g(.+?)(?:$|-))`)
match := hashRegex.FindStringSubmatch(Version)
fmt.Println(match, len(match))
if len(match) == 2 {
Commit = match[1]
}
Expand Down

0 comments on commit 7677830

Please sign in to comment.