Skip to content

Commit

Permalink
Merge branch 'master' into linasn/query-handlers-refactoring
Browse files Browse the repository at this point in the history
* master: (28 commits)
  [dbnode] Add claims for index segments volume index (#2846)
  [dbnode] Remove namespaces from example config and integration tests (#2866)
  [dbnode] Resurrect flaky test skip (#2868)
  [aggregator] Fix checkCampaignStateLoop (#2867)
  [dbnode] implement deletion method in namespace kvadmin service (#2861)
  Replace closer with resource package (#2864)
  Add coding style guide (#2831)
  Add GOVERNANCE.md to describe governance (#2830)
  Add COMPATIBILITY.md to describe version compatibility (#2829)
  Refactor etcd config as discovery section with convenience types (#2843)
  Refactor x/lockfile into dbnode/server (#2862)
  [lint] Disable nlreturn linter (#2865)
  [m3cluster] Expose placement algorithm in placement service (#2858)
  [etcd] Set reasonable cluster connection/sync settings by default (#2860)
  [dbnode] Use bits.LeadingZeros64 to improve encoder performance (#2857)
  Cleanup m3nsch leftovers (#2856)
  Update ci-scripts to correct coverage tracking (#2854)
  [aggregator] Process campaign state without waiting for first campaign check interval (#2855)
  Bump go to 1.14 (#2853)
  [query] Remove single series error from M3
  ...
  • Loading branch information
soundvibe committed Nov 11, 2020
2 parents 69e69d5 + 251dc3d commit 1fe3aa1
Show file tree
Hide file tree
Showing 248 changed files with 3,576 additions and 3,494 deletions.
6 changes: 0 additions & 6 deletions .buildkite/hooks/pre-checkout

This file was deleted.

4 changes: 3 additions & 1 deletion .buildkite/hooks/pre-exit
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
set -eo pipefail

echo "--- :git: cleaning checkout"
chmod -R +w ./_tools || true
if [[ -d "./_tools" ]]; then
chmod -R +w ./_tools
fi
git clean -dffx
21 changes: 15 additions & 6 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ steps:
command: make clean install-vendor-m3 test-all-gen
env:
CGO_ENABLED: 0
GIMME_GO_VERSION: 1.13.x
GIMME_GO_VERSION: 1.14.x
plugins:
gopath-checkout#v1.0.1:
import: github.com/m3db/m3
Expand All @@ -35,8 +35,17 @@ steps:
run: app
workdir: /go/src/github.com/m3db/m3
<<: *common
- name: "Services, Tools, Metalint"
command: make clean install-vendor-m3 services tools metalint
- name: "Services, Tools"
command: make clean install-vendor-m3 services tools
plugins:
docker-compose#v2.5.1:
run: app
workdir: /go/src/github.com/m3db/m3
<<: *common
- name: "Lint"
command: make clean lint
env:
CGO_ENABLED: 0
plugins:
docker-compose#v2.5.1:
run: app
Expand All @@ -47,7 +56,7 @@ steps:
parallelism: 2
env:
CGO_ENABLED: 0
GIMME_GO_VERSION: 1.13.x
GIMME_GO_VERSION: 1.14.x
plugins:
gopath-checkout#v1.0.1:
import: github.com/m3db/m3
Expand All @@ -57,7 +66,7 @@ steps:
parallelism: 1
env:
CGO_ENABLED: 0
GIMME_GO_VERSION: 1.13.x
GIMME_GO_VERSION: 1.14.x
plugins:
gopath-checkout#v1.0.1:
import: github.com/m3db/m3
Expand Down Expand Up @@ -90,7 +99,7 @@ steps:
command: make clean install-vendor-m3 docs-test
env:
CGO_ENABLED: 0
GIMME_GO_VERSION: 1.13.x
GIMME_GO_VERSION: 1.14.x
plugins:
gopath-checkout#v1.0.1:
import: github.com/m3db/m3
Expand Down
2 changes: 1 addition & 1 deletion .ci
11 changes: 0 additions & 11 deletions .excludemetalint

This file was deleted.

290 changes: 290 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,290 @@
# options for analysis running
run:
# default concurrency is a available CPU number
# concurrency: 4

# timeout for analysis, e.g. 30s, 5m, default is 1m
deadline: 10m

# exit code when at least one issue was found, default is 1
issues-exit-code: 1

# include test files or not, default is true
tests: true

# list of build tags, all linters use it. Default is empty list.
build-tags: []

# which dirs to skip: they won't be analyzed;
# can use regexp here: generated.*, regexp is applied on full path;
# default value is empty list, but next dirs are always skipped independently
# from this option's value:
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
skip-dirs:
- generated/.*
# There is some very weird golangci-lint bug that causes analysis to fail on the
# eventlog_server_test.go file (perhaps caused by https://github.com/golangci/golangci-lint/issues/995).
# To avoid sporadic CI failures we exclude the file from analysis for the time being.
# In order to exclude the file from analysis, and not just any lints in it, we need
# to put the file in a separate directory since although golangci-lint skips issues
# from files in the skip-files list, it still runs analysis on them.
- eventlog/test$

# which files to skip: they will be analyzed, but issues from them
# won't be reported. Default value is empty list, but there is
# no need to include all autogenerated files, we confidently recognize
# autogenerated files. If it's not please let us know.
skip-files: []

# by default isn't set. If set we pass it to "go list -mod={option}". From "go help modules":
# If invoked with -mod=readonly, the go command is disallowed from the implicit
# automatic updating of go.mod described above. Instead, it fails when any changes
# to go.mod are needed. This setting is most useful to check that go.mod does
# not need updates, such as in a continuous integration and testing system.
# If invoked with -mod=vendor, the go command assumes that the vendor
# directory holds the correct copies of dependencies and ignores
# the dependency descriptions in go.mod.
# modules-download-mode: readonly|release|vendor
modules-download-mode: readonly


# output configuration options
output:
# colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number"
format: colored-line-number

# print lines of code with issue, default is true
print-issued-lines: true

# print linter name in the end of issue text, default is true
print-linter-name: true


# all available settings of specific linters
linters-settings:
govet:
# report about shadowed variables
check-shadowing: true
goimports:
# put imports beginning with prefix after 3rd-party packages;
# it's a comma-separated list of prefixes
local-prefixes: github.com/m3db/m3
gocyclo:
# minimal code complexity to report, 30 by default (but we recommend 10-20)
min-complexity: 10
maligned:
# print struct with more effective memory layout or not, false by default
suggest-new: true
dupl:
# tokens count to trigger issue, 150 by default
threshold: 100
goconst:
# minimal length of string constant, 3 by default
min-len: 3
# minimal occurrences count to trigger, 3 by default
min-occurrences: 3
depguard:
list-type: blacklist
include-go-root: false
packages:
- github.com/sirupsen/logrus
- github.com/golang/protobuf/jsonpb
- google.golang.org/protobuf/encoding/protojson
- github.com/golang/protobuf/proto
- google.golang.org/protobuf/proto
- github.com/tj/assert
packages-with-error-messages:
# specify an error message to output when a blacklisted package is used
github.com/sirupsen/logrus: "logging is allowed only by logutils.Log"
github.com/golang/protobuf/jsonpb: "replace with github.com/gogo/protobuf/jsonpb"
google.golang.org/protobuf/encoding/protojson: "replace with github.com/gogo/protobuf/jsonpb"
github.com/golang/protobuf/proto: "replace with github.com/gogo/protobuf/proto"
google.golang.org/protobuf/proto: "replace with github.com/gogo/protobuf/proto"
github.com/tj/assert: "use github.com/stretchr/testify/assert"
misspell:
# Correct spellings using locale preferences for US or UK.
# Default is to use a neutral variety of English.
# Setting locale to US will correct the British spelling of 'colour' to 'color'.
locale: US
ignore-words:
- someword
lll:
# max line length, lines longer will be reported. Default is 120.
# '\t' is counted as 1 character by default, and can be changed with the tab-width option
line-length: 100
# tab width in spaces. Default to 1.
tab-width: 1
unused:
# treat code as a program (not a library) and report unused exported identifiers; default is false.
# XXX: if you enable this setting, unused will report a lot of false-positives in text editors:
# if it's called for subdir of a project it can't find funcs usages. All text editor integrations
# with golangci-lint call it on a directory with the changed file.
check-exported: false
unparam:
# Inspect exported functions, default is false. Set to true if no external program/library imports your code.
# XXX: if you enable this setting, unparam will report a lot of false-positives in text editors:
# if it's called for subdir of a project it can't find external interfaces. All text editor integrations
# with golangci-lint call it on a directory with the changed file.
check-exported: false
nakedret:
# make an issue if func has more lines of code than this setting and it has naked returns; default is 30
max-func-lines: 30
prealloc:
# XXX: we don't recommend using this linter before doing performance profiling.
# For most programs usage of prealloc will be a premature optimization.

# Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them.
# True by default.
simple: true
range-loops: true # Report preallocation suggestions on range loops, true by default
for-loops: false # Report preallocation suggestions on for loops, false by default
gocritic:
# Which checks should be enabled; can't be combined with 'disabled-checks';
# See https://go-critic.github.io/overview#checks-overview
# To check which checks are enabled run `GL_DEBUG=gocritic golangci-lint run`
# By default list of stable checks is used.

# Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint` run to see all tags and checks.
# Empty list by default. See https://github.com/go-critic/go-critic#usage -> section "Tags".
enabled-tags:
- performance
enabled-checks:
- ruleguard
settings: # settings passed to gocritic
captLocal: # must be valid enabled check name
paramsOnly: true
rangeValCopy:
sizeThreshold: 32
ruleguard:
rules: "src/cmd/tools/linter/gorules/rules.go"
gci:
# gci control golang package import order and make it always deterministic
local-prefixes: github.com/m3db/m3

linters:
enable:
- deadcode
- dogsled
- dupl
- errcheck
- exhaustive
- gci
- goconst
- gocritic
- gocyclo
- godox
- goimports
- golint
- gosimple
- govet
- ineffassign
- lll
- maligned
- megacheck
- misspell
- prealloc
- staticcheck
- structcheck
- typecheck
- unconvert
- unparam
- varcheck
enable-all: false
disable:
- gomnd
- gochecknoinits
# Globals gonna global
- gochecknoglobals
# Overly harsh about long functions
- funlen
# Linter that checks that every comment ends in a period.
- godot
# Linter that makes you always use _test packages.
- testpackage
# Overly opinionated about how to construct errors
- goerr113
# Noisy warnings about whether "nolint" directives are necessary
- nolintlint
# Deprecated project due to being prone to bad suggestions.
- interfacer
# Valid use for not explicitly setting every field when they are optional nil/empty.
- exhaustivestruct
# We allow cuddling assignment following conditions because there are valid
# logical groupings for this use-case (e.g. when evaluating config values).
- wsl
# New line required before return would require a large fraction of the
# code base to need updating, it's not worth the perceived benefit.
- nlreturn
disable-all: false
presets:
# bodyclose, errcheck, gosec, govet, scopelint, staticcheck, typecheck
- bugs
# deadcode, ineffassign, structcheck, unparam, unused, varcheck
- unused
# gofmt, goimports
- format
# depguard, dupl, gochecknoglobals, gochecknoinits, goconst, gocritic,
# golint, gosimple, interfacer, lll, misspell, stylecheck, unconvert
- style
fast: false


issues:
# List of regexps of issue texts to exclude, empty list by default.
# But independently from this option we use default exclude patterns,
# it can be disabled by `exclude-use-default: false`. To list all
# excluded by default patterns execute `golangci-lint run --help`
exclude:
# Exclude table-driven tests from scopelint (https://github.com/golangci/golangci-lint/issues/281).
- "Using the variable on range scope `tt` in function literal"
- "Using the variable on range scope `test` in function literal"
# It's common to shadow `err` and rarely indicates a problems. See
# https://github.com/golang/go/issues/19490 for further details.
- 'shadow: declaration of "err" shadows declaration'
# We commonly expose profiling information on /debug/pprof so we need to disable the gosec
# lint for it.
- "Profiling endpoint is automatically exposed on /debug/pprof"
# We only use md5 for non-cryptographic purposes (e.g. generating ID's where we don't assume
# the ID's are cryptographicly secure).
- "Blacklisted import `crypto/md5`: weak cryptographic primitive"
# The logger is often our last option to communicate that an error occurred so if it returns
# an error we don't have an alternative to use. Since it's already unlikely that `Log` will
# return an error anyway we often skip checking the error for brevity.
- "Error return value of `\\(github.com\\/go-kit\\/kit\\/log.Logger\\).Log` is not checked"
# The caller is responsible for closing the Body of an `http.Response`. However, this step
# is usually performed in a defer function after the response has already been processed and
# so errors, which are already rare, can usually be safely ignored.
- "Error return value of `[a-zA-Z.]+.Body.Close` is not checked"
# The errcheck linter already checks for unhandled errors so we can disable the equivalent
# lint by gosec.
- "G104: Errors unhandled"

# Excluding configuration per-path, per-linter, per-text and per-source
exclude-rules:
# Exclude lll issues for long lines with go:generate
- linters:
- lll
source: "^//go:generate "
# Exclude some linters from running on tests files.
# - path: _test\.go
# linters:
# - gocyclo
# - errcheck
# - dupl
# - gosec


# Independently from option `exclude` we use default exclude patterns,
# it can be disabled by this option. To list all
# excluded by default patterns execute `golangci-lint run --help`.
# Default value for this option is true.
exclude-use-default: false

# Maximum issues count per one linter. Set to 0 to disable. Default is 50.
max-issues-per-linter: 0

# Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
max-same-issues: 0

# Show only new issues created after git revision `REV`
new-from-rev: 5a3a12bba59e058b7a4cee6ec472c3f5786f741b
Loading

0 comments on commit 1fe3aa1

Please sign in to comment.