Skip to content

Commit

Permalink
clean up linting config
Browse files Browse the repository at this point in the history
  • Loading branch information
DoctorVin committed Nov 21, 2024
1 parent 40fb6c3 commit c510b26
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 46 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/push-pr-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ jobs:
go-version-file: go.mod

- name: golangci-lint
run: make lint
uses: golangci/golangci-lint-action@v6
with:
args: --config .golangci.yml --timeout 2m
version: v1.61.0

- name: Test
run: go test ./...
Expand Down
11 changes: 4 additions & 7 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ service:
linters-settings:
govet:
auto-fix: true
check-shadowing: true
shadow: true
settings:
printf:
funcs:
Expand Down Expand Up @@ -63,10 +63,9 @@ linters:
# additional linters
- bodyclose
- gocritic
- goerr113
- err113
- goimports
- revive
- gomnd
- misspell
- noctx
- stylecheck
Expand All @@ -75,12 +74,10 @@ linters:
enable-all: false
disable-all: true

run:
# build-tags:
skip-dirs:
issues:
exclude-dirs:
- internal/fixtures

issues:
exclude-rules:
- linters:
- gosec
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ REPO := "https://github.com/metal-toolbox/alloy.git"

## lint
lint:
go run github.com/golangci/golangci-lint/cmd/[email protected] run --config .golangci.yml --timeout=2m
golangci-lint run --config .golangci.yml --timeout=2m

## Go test
test: lint
Expand Down
31 changes: 0 additions & 31 deletions internal/collector/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,37 +226,6 @@ type AssetIterCollector struct {
concurrency int32
}

// NewAssetIterCollector is a constructor method that returns an AssetIterCollector.
func NewAssetIterCollector(
ctx context.Context,
storeKind model.StoreKind,
appKind model.AppKind,
cfg *app.Configuration,
syncWG *sync.WaitGroup,
logger *logrus.Logger,
) (*AssetIterCollector, error) {
repository, err := store.NewRepository(ctx, storeKind, appKind, cfg, logger)
if err != nil {
return nil, err
}

queryor, err := device.NewQueryor(appKind, logger)
if err != nil {
return nil, err
}

assetIterator := NewAssetIterator(repository, logger)

return &AssetIterCollector{
concurrency: int32(cfg.Concurrency),
queryor: queryor,
assetIterator: *assetIterator,
repository: repository,
syncWG: syncWG,
logger: logger,
}, nil
}

// NewAssetIterCollectorWithStore is a constructor method that accepts an initialized store to return an AssetIterCollector.
func NewAssetIterCollectorWithStore(
appKind model.AppKind,
Expand Down
12 changes: 6 additions & 6 deletions internal/store/fleetdb/components.go
Original file line number Diff line number Diff line change
Expand Up @@ -1015,8 +1015,8 @@ func (r *Store) setAttributes(component *fleetdbapi.ServerComponent, attr *attri
}

// skip min sized json data containing just the braces `{}`
min := 2
if len(data) == min {
smallest := 2
if len(data) == smallest {
return
}

Expand Down Expand Up @@ -1071,8 +1071,8 @@ func (r *Store) setStatusVA(component *fleetdbapi.ServerComponent, statusesVA []
}

// skip empty json data containing just the braces `[{}]`
min := 4
if len(data) == min {
smallest := 4
if len(data) == smallest {
return
}

Expand Down Expand Up @@ -1128,8 +1128,8 @@ func (r *Store) setFirmwareVA(deviceVendor string, component *fleetdbapi.ServerC
}

// skip empty json data containing just the braces `{}`
min := 2
if len(data) == min {
smallest := 2
if len(data) == smallest {
return
}

Expand Down

0 comments on commit c510b26

Please sign in to comment.