mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 04:14:39 +03:00
committed by
GitHub
parent
90baf7a469
commit
30879389ec
4
.github/workflows/golangci-lint.yml
vendored
4
.github/workflows/golangci-lint.yml
vendored
@@ -36,13 +36,13 @@ jobs:
|
||||
uses: golangci/golangci-lint-action@v2
|
||||
with:
|
||||
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
|
||||
version: v1.45.2
|
||||
version: latest
|
||||
|
||||
# Optional: working directory, useful for monorepos
|
||||
# working-directory: somedir
|
||||
|
||||
# Optional: golangci-lint command line arguments.
|
||||
args: --modules-download-mode=vendor --timeout=3m
|
||||
args: --modules-download-mode=vendor --timeout=5m
|
||||
|
||||
# Optional: show only new issues if it's a pull request. The default value is `false`.
|
||||
# only-new-issues: true
|
||||
|
||||
@@ -1,22 +1,19 @@
|
||||
# options for analysis running
|
||||
run:
|
||||
timeout: 3m
|
||||
timeout: 5m
|
||||
modules-download-mode: vendor
|
||||
|
||||
linters:
|
||||
disable-all: true
|
||||
enable:
|
||||
# Default set of linters from golangci-lint
|
||||
- deadcode
|
||||
- errcheck
|
||||
- gosimple
|
||||
- govet
|
||||
- ineffassign
|
||||
- staticcheck
|
||||
- structcheck
|
||||
- typecheck
|
||||
- unused
|
||||
- varcheck
|
||||
# Linters added by the stash project.
|
||||
# - contextcheck
|
||||
- dogsled
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package desktop
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
@@ -93,7 +92,7 @@ func writeStashIcon(faviconProvider FaviconProvider) {
|
||||
c := config.GetInstance()
|
||||
if !c.IsNewSystem() {
|
||||
iconPath := path.Join(c.GetConfigPath(), "icon.png")
|
||||
err := ioutil.WriteFile(iconPath, faviconProvider.GetFaviconPng(), 0644)
|
||||
err := os.WriteFile(iconPath, faviconProvider.GetFaviconPng(), 0644)
|
||||
if err != nil {
|
||||
logger.Errorf("Couldn't write icon file: %s", err.Error())
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
package desktop
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strings"
|
||||
@@ -19,7 +18,7 @@ func isService() bool {
|
||||
|
||||
func isServerDockerized() bool {
|
||||
_, dockerEnvErr := os.Stat("/.dockerenv")
|
||||
cgroups, _ := ioutil.ReadFile("/proc/self/cgroup")
|
||||
cgroups, _ := os.ReadFile("/proc/self/cgroup")
|
||||
if !os.IsNotExist(dockerEnvErr) || strings.Contains(string(cgroups), "docker") {
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -310,6 +310,7 @@ func (i *Instance) GetNotificationsEnabled() bool {
|
||||
|
||||
// GetShowOneTimeMovedNotification shows whether a small notification to inform the user that Stash
|
||||
// will no longer show a terminal window, and instead will be available in the tray, should be shown.
|
||||
//
|
||||
// It is true when an existing system is started after upgrading, and set to false forever after it is shown.
|
||||
func (i *Instance) GetShowOneTimeMovedNotification() bool {
|
||||
return i.getBool(ShowOneTimeMovedNotification)
|
||||
|
||||
@@ -32,14 +32,14 @@ func toSnakeCase(v string) string {
|
||||
|
||||
func fromSnakeCase(v string) string {
|
||||
var buf bytes.Buffer
|
||||
cap := false
|
||||
capvar := false
|
||||
for i, c := range v {
|
||||
switch {
|
||||
case c == '_' && i > 0:
|
||||
cap = true
|
||||
case cap:
|
||||
capvar = true
|
||||
case capvar:
|
||||
buf.WriteRune(unicode.ToUpper(c))
|
||||
cap = false
|
||||
capvar = false
|
||||
default:
|
||||
buf.WriteRune(c)
|
||||
}
|
||||
|
||||
@@ -487,11 +487,9 @@ func (p *SceneFilenameParser) parseScenes(repo models.ReaderRepository, scenes [
|
||||
}
|
||||
p.setParserResult(repo, *sceneHolder, r)
|
||||
|
||||
if r != nil {
|
||||
ret = append(ret, r)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import (
|
||||
"image"
|
||||
"image/draw"
|
||||
"image/png"
|
||||
"io/ioutil"
|
||||
"math"
|
||||
"os"
|
||||
"sort"
|
||||
@@ -85,7 +84,7 @@ func (g *InteractiveHeatmapSpeedGenerator) Generate() error {
|
||||
}
|
||||
|
||||
func (g *InteractiveHeatmapSpeedGenerator) LoadFunscriptData(path string) (Script, error) {
|
||||
data, err := ioutil.ReadFile(path)
|
||||
data, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
return Script{}, err
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime/pprof"
|
||||
@@ -307,7 +306,7 @@ func writeStashIcon() {
|
||||
}
|
||||
|
||||
iconPath := filepath.Join(instance.Config.GetConfigPath(), "icon.png")
|
||||
err := ioutil.WriteFile(iconPath, p.GetFaviconPng(), 0644)
|
||||
err := os.WriteFile(iconPath, p.GetFaviconPng(), 0644)
|
||||
if err != nil {
|
||||
logger.Errorf("Couldn't write icon file: %s", err.Error())
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package scene
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
@@ -68,7 +67,7 @@ func migrateSceneFiles(oldName, newName string) {
|
||||
|
||||
// #2481: migrate vtt file contents in addition to renaming
|
||||
func migrateVttFile(vttPath, oldSpritePath, newSpritePath string) {
|
||||
contents, err := ioutil.ReadFile(vttPath)
|
||||
contents, err := os.ReadFile(vttPath)
|
||||
if err != nil {
|
||||
logger.Errorf("Error reading %s for vtt migration: %v", vttPath, err)
|
||||
return
|
||||
@@ -79,7 +78,7 @@ func migrateVttFile(vttPath, oldSpritePath, newSpritePath string) {
|
||||
|
||||
contents = bytes.ReplaceAll(contents, []byte(oldSpriteBasename), []byte(newSpriteBasename))
|
||||
|
||||
if err := ioutil.WriteFile(vttPath, contents, 0644); err != nil {
|
||||
if err := os.WriteFile(vttPath, contents, 0644); err != nil {
|
||||
logger.Errorf("Error writing %s for vtt migration: %v", vttPath, err)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"mime/multipart"
|
||||
"net/http"
|
||||
"os"
|
||||
@@ -1042,7 +1041,7 @@ func (c *Client) submitDraft(ctx context.Context, query string, input interface{
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
responseBytes, err := ioutil.ReadAll(resp.Body)
|
||||
responseBytes, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -219,6 +219,7 @@ func (f *filterBuilder) addWith(sql string, args ...interface{}) {
|
||||
}
|
||||
|
||||
// addRecursiveWith adds a with clause and arguments to the filter, and sets it to recursive
|
||||
//
|
||||
//nolint:unused
|
||||
func (f *filterBuilder) addRecursiveWith(sql string, args ...interface{}) {
|
||||
if sql == "" {
|
||||
|
||||
@@ -12,6 +12,7 @@ type StrFormatMap map[string]interface{}
|
||||
// StrFormatMap.
|
||||
//
|
||||
// For example,
|
||||
//
|
||||
// StrFormat("{foo} bar {baz}", StrFormatMap{
|
||||
// "foo": "bar",
|
||||
// "baz": "abc",
|
||||
|
||||
Reference in New Issue
Block a user