Skip to content

Commit

Permalink
Fixed some misspells, added couple of useful linters. (#1446)
Browse files Browse the repository at this point in the history
Signed-off-by: Bartek Plotka <bwplotka@gmail.com>
  • Loading branch information
bwplotka authored Aug 22, 2019
1 parent c35d47b commit d047ea7
Show file tree
Hide file tree
Showing 11 changed files with 784 additions and 582 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ Note that this is required to have SRV resolution working on [Golang 1.11+ with
* [ENHANCEMENT] When closing the db any running compaction will be cancelled so it doesn't block.
* [CHANGE] *breaking* Renamed flag `--sync-delay` to `--consistency-delay` [#1053](https://github.com/thanos-io/thanos/pull/1053)

For ruler essentially whole TSDB CHANGELOG applies beween v0.4.0-v0.6.1: https://github.com/prometheus/tsdb/blob/master/CHANGELOG.md
For ruler essentially whole TSDB CHANGELOG applies between v0.4.0-v0.6.1: https://github.com/prometheus/tsdb/blob/master/CHANGELOG.md

Note that this was added on TSDB and Prometheus: [FEATURE] Time-ovelapping blocks are now allowed. #370
Whoever due to nature of Thanos compaction (distributed systems), for safety reason this is disabled for Thanos compactor for now.
Expand Down
26 changes: 18 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ HUGO ?= $(GOBIN)/hugo-$(HUGO_VERSION)
GOBINDATA_VERSION ?= a9c83481b38ebb1c4eb8f0168fd4b10ca1d3c523
GOBINDATA ?= $(GOBIN)/go-bindata-$(GOBINDATA_VERSION)
GIT ?= $(shell which git)
# golangci-lint which includes errcheck, goimports
# and more. v1.16.0
GOLANGCILINT_VERSION ?= 97ea1cbb21bbf5e4d0e8bcc0f9243385e9262dcc
GOLANGCILINT ?= $(GOBIN)/golangci-lint-$(GOLANGCILINT_VERSION)

GOLANGCILINT_VERSION ?= d2b1eea2c6171a1a1141a448a745335ce2e928a1
GOLANGCILINT ?= $(GOBIN)/golangci-lint-$(GOLANGCILINT_VERSION)
MISSPELL_VERSION ?= c0b55c8239520f6b5aa15a0207ca8b28027ba49e
MISSPELL ?= $(GOBIN)/misspell-$(MISSPELL_VERSION)

WEB_DIR ?= website
WEBSITE_BASE_URL ?= https://thanos.io
Expand Down Expand Up @@ -229,11 +230,17 @@ web: web-pre-process $(HUGO)
@cd $(WEB_DIR) && HUGO_ENV=production $(HUGO) --config hugo.yaml --minify -v -b $(WEBSITE_BASE_URL)

.PHONY: lint
lint: check-git $(GOLANGCILINT)
@echo ">> checking formatting"
@$(GOLANGCILINT) run -v --disable-all -E goimports ./...
# PROTIP:
# Add
# --cpu-profile-path string Path to CPU profile output file
# --mem-profile-path string Path to memory profile output file
#
# to debug big allocations during linting.
lint: check-git $(GOLANGCILINT) $(MISSPELL)
@echo ">> linting all of the Go files"
@$(GOLANGCILINT) run -v ./...
@$(GOLANGCILINT) run -v --enable goimports --enable goconst --skip-dirs vendor
@echo ">> detecting misspells"
@find . -type f | grep -v vendor/ | grep -vE '\./\..*' | xargs $(MISSPELL) -error

.PHONY: web-serve
web-serve: web-pre-process $(HUGO)
Expand Down Expand Up @@ -264,6 +271,9 @@ $(GOBINDATA):
$(GOLANGCILINT):
$(call fetch_go_bin_version,github.com/golangci/golangci-lint/cmd/golangci-lint,$(GOLANGCILINT_VERSION))

$(MISSPELL):
$(call fetch_go_bin_version,github.com/client9/misspell/cmd/misspell,$(MISSPELL_VERSION))

$(PROTOC):
@mkdir -p $(TMP_GOPATH)
@echo ">> fetching protoc@${PROTOC_VERSION}"
Expand Down
2 changes: 1 addition & 1 deletion docs/components/query.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ It is possible to expose thanos-query UI and optionally API on a sub-path.
The sub-path can be defined either statically or dynamically via an HTTP header.
Static path prefix definition follows the pattern used in Prometheus,
where `web.route-prefix` option defines HTTP request path prefix (endpoints prefix)
and `web.external-prefix` prefixes the URLs in HTML code and the HTTP redirect responces.
and `web.external-prefix` prefixes the URLs in HTML code and the HTTP redirect responses.

Additionally, Thanos supports dynamic prefix configuration, which
[is not yet implemented by Prometheus](https://github.com/prometheus/prometheus/issues/3156).
Expand Down
2 changes: 1 addition & 1 deletion docs/contributing/how-to-contribute-to-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ in GitHub as markdown just fine:
title: <titke>
type: ...
weight: <weight>
menu: <where to link files in> # This also is refered in permalinks.
menu: <where to link files in> # This also is referred in permalinks.
---
```

Expand Down
2 changes: 1 addition & 1 deletion pkg/promclient/promclient_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func TestSnapshot_e2e(t *testing.T) {
func TestRule_UnmarshalScalarResponse(t *testing.T) {
var (
scalarJSONResult = []byte(`[1541196373.677,"1"]`)
invalidLengthScalarJSONResult = []byte(`[1541196373.677,"1", "nonsence"]`)
invalidLengthScalarJSONResult = []byte(`[1541196373.677,"1", "nonsense"]`)
invalidDataScalarJSONResult = []byte(`["foo","bar"]`)

vectorResult model.Vector
Expand Down
2 changes: 1 addition & 1 deletion pkg/receive/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ func (h *Handler) receive(w http.ResponseWriter, r *http.Request) {

var rep replica
replicaRaw := r.Header.Get(h.options.ReplicaHeader)
// If the header is emtpy, we assume the request is not yet replicated.
// If the header is empty, we assume the request is not yet replicated.
if replicaRaw != "" {
if rep.n, err = strconv.ParseUint(replicaRaw, 10, 64); err != nil {
http.Error(w, "could not parse replica header", http.StatusBadRequest)
Expand Down
Loading

0 comments on commit d047ea7

Please sign in to comment.