Skip to content

Commit

Permalink
.golangci.yml: update rules (#825)
Browse files Browse the repository at this point in the history
* .golangci.yml: update rules

* make nix-flake-update

* update llvm_11 -> llvm_12

---------

Co-authored-by: aalu1418 <[email protected]>
  • Loading branch information
jmank88 and aalu1418 authored Aug 21, 2024
1 parent 43e8f68 commit cd3dcc5
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 56 deletions.
35 changes: 33 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ linters:
- whitespace
- depguard
- containedctx
- fatcontext
- mirror
- loggercheck
linters-settings:
exhaustive:
default-signifies-exhaustive: true
Expand All @@ -31,8 +34,21 @@ linters-settings:
# - G304
# - G404
govet:
# report about shadowed variables
check-shadowing: true
enable:
- shadow
settings:
printf:
# Additionally check custom logger
funcs:
- (github.com/smartcontractkit/chainlink-common/pkg/logger.Logger).Debugf
- (github.com/smartcontractkit/chainlink-common/pkg/logger.Logger).Infof
- (github.com/smartcontractkit/chainlink-common/pkg/logger.Logger).Warnf
- (github.com/smartcontractkit/chainlink-common/pkg/logger.Logger).Errorf
- (github.com/smartcontractkit/chainlink-common/pkg/logger.Logger).Panicf
- (github.com/smartcontractkit/chainlink-common/pkg/logger.Logger).Fatalf
- (github.com/smartcontractkit/chainlink-common/pkg/logger.SugaredLogger).AssumptionViolationf
- (github.com/smartcontractkit/chainlink-common/pkg/logger.SugaredLogger).Tracef
- (github.com/smartcontractkit/chainlink-common/pkg/logger.SugaredLogger).Criticalf
errorlint:
# Allow formatting of errors without %w
errorf: false
Expand Down Expand Up @@ -113,6 +129,21 @@ linters-settings:
desc: Use gopkg.in/guregu/null.v4 instead
- pkg: "gopkg.in/guregu/null.v3"
desc: Use gopkg.in/guregu/null.v4 instead
- pkg: github.com/go-gorm/gorm
desc: Use github.com/jmoiron/sqlx directly instead
loggercheck:
# Check that *w logging functions have even number of args (i.e., well formed key-value pairs).
rules:
- (github.com/smartcontractkit/chainlink-common/pkg/logger.Logger).Debugw
- (github.com/smartcontractkit/chainlink-common/pkg/logger.Logger).Infow
- (github.com/smartcontractkit/chainlink-common/pkg/logger.Logger).Warnw
- (github.com/smartcontractkit/chainlink-common/pkg/logger.Logger).Errorw
- (github.com/smartcontractkit/chainlink-common/pkg/logger.Logger).Panicw
- (github.com/smartcontractkit/chainlink-common/pkg/logger.Logger).Fatalw
- (github.com/smartcontractkit/chainlink-common/pkg/logger.SugaredLogger).AssumptionViolationw
- (github.com/smartcontractkit/chainlink-common/pkg/logger.SugaredLogger).Tracew
- (github.com/smartcontractkit/chainlink-common/pkg/logger.SugaredLogger).Criticalw
- (github.com/smartcontractkit/chainlink-common/pkg/logger.SugaredLogger).With
issues:
exclude-rules:
- path: test
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ ifneq ($(CI),true)
endif
endif

.PHONY: nix-flake-update
nix-flake-update:
docker run -it --rm -v $(shell pwd):/repo -e NIX_USER_CONF_FILES=/repo/nix.conf --workdir /repo nixos/nix:latest /bin/sh -c "nix flake update"

.PHONY: projectserum_version
projectserum_version:
@echo "${PROJECT_SERUM_VERSION}"
Expand Down
58 changes: 12 additions & 46 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions integration-tests/config/ocr2_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type OffchainConfig struct {
RMax int `json:"rMax"`
S []int `json:"s"`
OffchainPublicKeys []string `json:"offchainPublicKeys"`
PeerIds []string `json:"peerIds"`
PeerIDs []string `json:"peerIds"`
ReportingPluginConfig ReportingPluginConfig `json:"reportingPluginConfig"`
MaxDurationQueryNanoseconds int64 `json:"maxDurationQueryNanoseconds"`
MaxDurationObservationNanoseconds int64 `json:"maxDurationObservationNanoseconds"`
Expand Down Expand Up @@ -145,7 +145,7 @@ func (o *OCR2Config) Default() {
DeltaCNanoseconds: 0,
}
offchainPublicKeys := make([]string, len(o.NodeKeys))
peerIds := make([]string, len(o.NodeKeys))
peerIDs := make([]string, len(o.NodeKeys))
configPublicKeys := make([]string, len(o.NodeKeys))
s := make([]int, len(o.NodeKeys))

Expand All @@ -155,7 +155,7 @@ func (o *OCR2Config) Default() {

for i, key := range o.NodeKeys {
offchainPublicKeys[i] = strings.Replace(key.OCR2Key.Data.Attributes.OffChainPublicKey, "ocr2off_solana_", "", 1)
peerIds[i] = key.PeerID
peerIDs[i] = key.PeerID
configPublicKeys[i] = strings.Replace(key.OCR2Key.Data.Attributes.ConfigPublicKey, "ocr2cfg_solana_", "", 1)
}
o.OffChainConfig = &OCROffChainConfig{
Expand All @@ -170,7 +170,7 @@ func (o *OCR2Config) Default() {
RMax: 3,
S: s,
OffchainPublicKeys: offchainPublicKeys,
PeerIds: peerIds,
PeerIDs: peerIDs,
ConfigPublicKeys: configPublicKeys,
ReportingPluginConfig: o.OffChainConfig.OffchainConfig.ReportingPluginConfig,
MaxDurationQueryNanoseconds: int64(0),
Expand Down
4 changes: 2 additions & 2 deletions pkg/monitoring/exporter/fees.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ func (f *feesExporter) Export(ctx context.Context, data interface{}) {

fee, err := mathutil.Avg(feeArr...)
if err != nil {
f.log.Errorf("fee average: %w", err)
f.log.Errorf("fee average: %v", err)
return
}
computeUnits, err := mathutil.Avg(computeUnitsArr...)
if err != nil {
f.log.Errorf("computeUnits average: %w", err)
f.log.Errorf("computeUnits average: %v", err)
return
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/solana/chainreader/chain_reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ func (r *wrappedTestChainReader) GetLatestValue(ctx context.Context, contractNam

fallthrough
default:
if r.testStructQueue == nil || len(r.testStructQueue) == 0 {
if len(r.testStructQueue) == 0 {
r.test.FailNow()
}

Expand Down
2 changes: 1 addition & 1 deletion shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pkgs.mkShell {
nativeBuildInputs = with pkgs; [
(rust-bin.stable.latest.default.override { extensions = ["rust-src"]; })
# lld_11
llvm_11
llvm_12
stdenv.cc.cc.lib
pkg-config
openssl
Expand Down

0 comments on commit cd3dcc5

Please sign in to comment.