Skip to content

Commit

Permalink
Add fmt and lint commands
Browse files Browse the repository at this point in the history
  • Loading branch information
pcj committed Apr 19, 2019
1 parent c941338 commit 5d6bd7d
Show file tree
Hide file tree
Showing 6 changed files with 671 additions and 4 deletions.
1 change: 1 addition & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ go_library(
visibility = ["//visibility:private"],
deps = [
"//bazelutil:go_default_library",
"//command/fmt:go_default_library",
"//command/install:go_default_library",
"//command/release:go_default_library",
"//command/targets:go_default_library",
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,3 +154,11 @@ $ bazel release \
--platform=windows_amd64 \
//:bzl
```

### `$ bazel lint`

Print linting issues in build files (buildifier).

### `$ bazel lint`

Fix formatting issues in build files (buildifier).
4 changes: 1 addition & 3 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
workspace(name = "io_bzl_bzl")

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file")

local_repository(
name = "build_stack_rules_proto",
path = "/home/pcj/go/src/github.com/stackb/rules_proto",
Expand Down Expand Up @@ -114,7 +112,7 @@ go_repository(

go_repository(
name = "com_google_bazelbuild_buildtools",
commit = "a861d1c9f86278f04ae7719ef48d22016781d766",
commit = "8135d8f1de24e6cb453be56ce061c922bf279f2c",
importpath = "github.com/bazelbuild/buildtools",
)

Expand Down
5 changes: 4 additions & 1 deletion app.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/urfave/cli"

"github.com/bzl-io/bzl/bazelutil"
fmtcmd "github.com/bzl-io/bzl/command/fmt"
"github.com/bzl-io/bzl/command/install"
"github.com/bzl-io/bzl/command/release"
"github.com/bzl-io/bzl/command/targets"
Expand Down Expand Up @@ -54,9 +55,11 @@ func NewApp() *App {
// Add commands
app.Commands = []cli.Command{
*install.Command,
*targets.Command,
*release.Command,
*use.Command,
*targets.Command,
*fmtcmd.FmtCommand,
*fmtcmd.LintCommand,
}

instance := &App{
Expand Down
15 changes: 15 additions & 0 deletions command/fmt/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")

go_library(
name = "go_default_library",
srcs = ["fmt.go"],
importpath = "github.com/bzl-io/bzl/command/fmt",
visibility = ["//visibility:public"],
deps = [
"@com_github_urfave_cli//:go_default_library",
"@com_google_bazelbuild_buildtools//build:go_default_library",
"@com_google_bazelbuild_buildtools//differ:go_default_library",
"@com_google_bazelbuild_buildtools//tables:go_default_library",
"@com_google_bazelbuild_buildtools//warn:go_default_library",
],
)
Loading

0 comments on commit 5d6bd7d

Please sign in to comment.