chore: linter violations in test files for multiple linters

feat/library
moonD4rk 1 year ago
parent aa2e1af5b5
commit d87ef03ae0
No known key found for this signature in database
GPG Key ID: 5AB6217E08D39ABA
  1. 10
      .golangci.yml
  2. 8
      browser.go
  3. 9
      chromium.go
  4. 3
      chromium_test.go
  5. 4
      consts.go

@ -60,9 +60,15 @@ issues:
- G502 - G502
- G505 - G505
exclude-rules: exclude-rules:
- path: browser/browser\.go - path: _test\.go
linters: linters:
- 'unused' - gocyclo
- errcheck
- dupl
- gosec
- unparam
- staticcheck
- paralleltest
max-issues-per-linter: 0 max-issues-per-linter: 0
max-same-issues: 0 max-same-issues: 0

@ -39,7 +39,7 @@ func (c *chromium) AllBrowsingData() ([]BrowserData, error) {
return nil, nil return nil, nil
} }
func (f *firefox) BrowsingData(items []browserDataType) (BrowserData, error) { func (f *firefox) BrowsingData(_ []browserDataType) (BrowserData, error) {
return nil, nil return nil, nil
} }
@ -68,8 +68,7 @@ func (b browser) Type() browserType {
} }
} }
var ( var browsers = map[browser]Browser{
browsers = map[browser]Browser{
Chrome: &chromium{ Chrome: &chromium{
name: Chrome, name: Chrome,
storage: chromeStorageName, storage: chromeStorageName,
@ -82,5 +81,4 @@ var (
profilePath: "", profilePath: "",
}, },
Yandex: &chromium{}, Yandex: &chromium{},
} }
)

@ -33,10 +33,7 @@ func (c *chromium) Init() error {
if err := c.initProfile(); err != nil { if err := c.initProfile(); err != nil {
return fmt.Errorf("profile path '%s' does not exist %w", c.profilePath, ErrBrowserNotExists) return fmt.Errorf("profile path '%s' does not exist %w", c.profilePath, ErrBrowserNotExists)
} }
if err := c.initMasterKey(); err != nil { return c.initMasterKey()
return err
}
return nil
} }
func (c *chromium) initBrowserData() error { func (c *chromium) initBrowserData() error {
@ -94,9 +91,7 @@ func (c *chromium) findAllProfiles() ([]string, error) {
} }
func (c *chromium) initMasterKey() error { func (c *chromium) initMasterKey() error {
var ( var stdout, stderr bytes.Buffer
stdout, stderr bytes.Buffer
)
args := []string{"find-generic-password", "-wa", strings.TrimSpace(c.storage)} args := []string{"find-generic-password", "-wa", strings.TrimSpace(c.storage)}
cmd := exec.Command("security", args...) //nolint:gosec cmd := exec.Command("security", args...) //nolint:gosec
cmd.Stdout = &stdout cmd.Stdout = &stdout

@ -4,8 +4,7 @@ import (
"testing" "testing"
) )
func TestChromium_Init(t *testing.T) { func TestChromium_Init(_ *testing.T) {
} }
func BenchmarkChromium_Init(b *testing.B) { func BenchmarkChromium_Init(b *testing.B) {

@ -17,9 +17,7 @@ const (
arcStorageName = "Arc" arcStorageName = "Arc"
) )
var ( var homeDir, _ = os.UserHomeDir()
homeDir, _ = os.UserHomeDir()
)
var ( var (
chromeProfilePath = homeDir + "/Library/Application Support/Google/Chrome/Default/" chromeProfilePath = homeDir + "/Library/Application Support/Google/Chrome/Default/"

Loading…
Cancel
Save