Skip to content

Commit

Permalink
feat: remove golangci-lint (#207)
Browse files Browse the repository at this point in the history
In preparation for 1.0, we want all linters to work correctly.
In the discussion for #129 we decided that is a fatal bug, and no one is able to fix it in the short term.

We're happy to add Go linting back to rules_lint when someone has a correct implementation that handles transitive srcs.
The code will still be here in the git history when it's time to revive it.

Closes #129
  • Loading branch information
alexeagle authored Apr 11, 2024
1 parent 129a609 commit ee24ede
Show file tree
Hide file tree
Showing 13 changed files with 2 additions and 258 deletions.
3 changes: 0 additions & 3 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ bazel_dep(name = "rules_proto", version = "6.0.0-rc2")
bazel_dep(name = "rules_buf", version = "0.1.1")
bazel_dep(name = "toolchains_protoc", version = "0.2.1")

# Needed to get the 'go_context' symbol, to invoke golangci-lint
bazel_dep(name = "rules_go", version = "0.39.1", repo_name = "io_bazel_rules_go")

multitool = use_extension("@rules_multitool//multitool:extension.bzl", "multitool")
multitool.hub(lockfile = "//format:multitool.lock.json")
multitool.hub(lockfile = "//lint:multitool.lock.json")
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ New tools are being added frequently, so check this page again!
| ---------------------- | --------------------- | ---------------- |
| C / C++ | [clang-format] | ([#112]) |
| CSS | [Prettier] | |
| Go | [gofmt] or [gofumpt] | [golangci-lint] |
| Go | [gofmt] or [gofumpt] | |
| HCL (Hashicorp Config) | [terraform] fmt | |
| HTML | [Prettier] | |
| JSON | [Prettier] | |
Expand Down Expand Up @@ -63,7 +63,6 @@ New tools are being added frequently, so check this page again!
[ruff]: https://docs.astral.sh/ruff/
[shellcheck]: https://www.shellcheck.net/
[shfmt]: https://github.com/mvdan/sh
[golangci-lint]: https://github.com/golangci/golangci-lint
[clang-format]: https://clang.llvm.org/docs/ClangFormat.html
[#112]: https://github.com/aspect-build/rules_lint/issues/112
[vale]: https://vale.sh/
Expand Down
5 changes: 0 additions & 5 deletions docs/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@ stardoc_with_diff_test(
bzl_library_target = "//lint:ruff",
)

stardoc_with_diff_test(
name = "golangci-lint",
bzl_library_target = "//lint:golangci-lint",
)

stardoc_with_diff_test(
name = "shellcheck",
bzl_library_target = "//lint:shellcheck",
Expand Down
63 changes: 0 additions & 63 deletions docs/golangci-lint.md

This file was deleted.

1 change: 0 additions & 1 deletion example/.aspect/cli/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ lint:
- //tools/lint:linters.bzl%eslint
- //tools/lint:linters.bzl%buf
- //tools/lint:linters.bzl%flake8
- //tools/lint:linters.bzl%golangci_lint
- //tools/lint:linters.bzl%pmd
- //tools/lint:linters.bzl%ruff
- //tools/lint:linters.bzl%vale
21 changes: 0 additions & 21 deletions example/.golangci.yaml

This file was deleted.

1 change: 0 additions & 1 deletion example/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ exports_files(
".ruff.toml",
".shellcheckrc",
".scalafmt.conf",
".golangci.yaml",
".vale.ini",
],
visibility = ["//visibility:public"],
Expand Down
2 changes: 1 addition & 1 deletion example/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ filter='.namedSetOfFiles | values | .files[] | ((.pathPrefix | join("/")) + "/"

# NB: perhaps --remote_download_toplevel is needed as well with remote execution?
args=(
"--aspects=$(echo //tools/lint:linters.bzl%{buf,eslint,flake8,pmd,ruff,shellcheck,golangci_lint,vale} | tr ' ' ',')"
"--aspects=$(echo //tools/lint:linters.bzl%{buf,eslint,flake8,pmd,ruff,shellcheck,vale} | tr ' ' ',')"
"--build_event_json_file=$buildevents"
)
report_args=(
Expand Down
3 changes: 0 additions & 3 deletions example/test/lint_test.bats
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ EOF
# Buf
assert_output --partial 'src/file.proto:1:1:Import "src/unused.proto" is unused.'

# Golangci-lint
assert_output --partial 'src/hello.go:13:2: SA1006: printf-style function with dynamic format string and no further arguments should use print-style function instead (staticcheck)'

# Vale
assert_output --partial "src/README.md:3:47:Google.We:Try to avoid using first-person plural like 'We'."
}
Expand Down
8 changes: 0 additions & 8 deletions example/tools/lint/linters.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
load("@aspect_rules_lint//lint:buf.bzl", "lint_buf_aspect")
load("@aspect_rules_lint//lint:eslint.bzl", "lint_eslint_aspect")
load("@aspect_rules_lint//lint:flake8.bzl", "lint_flake8_aspect")
load("@aspect_rules_lint//lint:golangci-lint.bzl", "lint_golangci_aspect")
load("@aspect_rules_lint//lint:lint_test.bzl", "lint_test")
load("@aspect_rules_lint//lint:pmd.bzl", "lint_pmd_aspect")
load("@aspect_rules_lint//lint:ruff.bzl", "lint_ruff_aspect")
Expand Down Expand Up @@ -57,13 +56,6 @@ shellcheck = lint_shellcheck_aspect(

shellcheck_test = lint_test(aspect = shellcheck)

golangci_lint = lint_golangci_aspect(
binary = "@multitool//tools/golangci-lint",
config = "@@//:.golangci.yaml",
)

golangci_lint_test = lint_test(aspect = golangci_lint)

vale = lint_vale_aspect(
binary = "@@//tools/lint:vale",
config = "@@//:.vale.ini",
Expand Down
10 changes: 0 additions & 10 deletions lint/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -118,16 +118,6 @@ bzl_library(
],
)

bzl_library(
name = "golangci-lint",
srcs = ["golangci-lint.bzl"],
visibility = ["//visibility:public"],
deps = [
"//lint/private:lint_aspect",
"@io_bazel_rules_go//go:def",
],
)

bzl_library(
name = "shellcheck",
srcs = ["shellcheck.bzl"],
Expand Down
104 changes: 0 additions & 104 deletions lint/golangci-lint.bzl

This file was deleted.

36 changes: 0 additions & 36 deletions lint/multitool.lock.json
Original file line number Diff line number Diff line change
@@ -1,41 +1,5 @@
{
"$schema": "https://raw.githubusercontent.com/theoremlp/rules_multitool/main/lockfile.schema.json",
"golangci-lint": {
"binaries": [
{
"os": "linux",
"cpu": "x86_64",
"kind": "archive",
"url": "https://github.com/golangci/golangci-lint/releases/download/v1.55.2/golangci-lint-1.55.2-linux-amd64.tar.gz",
"sha256": "ca21c961a33be3bc15e4292dc40c98c8dcc5463a7b6768a3afc123761630c09c",
"file": "golangci-lint-1.55.2-linux-amd64/golangci-lint"
},
{
"os": "linux",
"cpu": "arm64",
"kind": "archive",
"url": "https://github.com/golangci/golangci-lint/releases/download/v1.55.2/golangci-lint-1.55.2-linux-arm64.tar.gz",
"sha256": "8eb0cee9b1dbf0eaa49871798c7f8a5b35f2960c52d776a5f31eb7d886b92746",
"file": "golangci-lint-1.55.2-linux-arm64/golangci-lint"
},
{
"os": "macos",
"cpu": "x86_64",
"kind": "archive",
"url": "https://github.com/golangci/golangci-lint/releases/download/v1.55.2/golangci-lint-1.55.2-darwin-amd64.tar.gz",
"sha256": "632e96e6d5294fbbe7b2c410a49c8fa01c60712a0af85a567de85bcc1623ea21",
"file": "golangci-lint-1.55.2-darwin-amd64/golangci-lint"
},
{
"os": "macos",
"cpu": "arm64",
"kind": "archive",
"url": "https://github.com/golangci/golangci-lint/releases/download/v1.55.2/golangci-lint-1.55.2-darwin-arm64.tar.gz",
"sha256": "234463f059249f82045824afdcdd5db5682d0593052f58f6a3039a0a1c3899f6",
"file": "golangci-lint-1.55.2-darwin-arm64/golangci-lint"
}
]
},
"shellcheck": {
"binaries": [
{
Expand Down

0 comments on commit ee24ede

Please sign in to comment.