A Starlark linter that wraps buildtools warnings with a modern CLI interface, auto-fix support, and multiple output formats.
go install github.com/albertocavalcante/sky/cmd/skylint@latest
# Lint all files recursively
# Preview fixes without applying
# Output as JSON (for CI integration)
skylint --format=github .
| Format | Description |
|---|
text | Human-readable output (default) |
compact | Single line per issue |
json | Machine-readable JSON |
github | GitHub Actions annotations |
skylint wraps all buildtools warnings. Use skylint --list-rules to see the exact categorization.
| Category | Description |
|---|
correctness | Logic errors and bugs |
style | Code style and formatting |
imports | Load statement issues |
unused | Unused code detection |
documentation | Docstring requirements |
deprecation | Deprecated API usage |
bazel-api | Bazel-specific API issues |
native-rules | Native rule migration |
compatibility | Python/Starlark compatibility |
control-flow | Control flow issues |
| Rule | Description |
|---|
attr-cfg | Checks for invalid cfg attribute |
attr-non-empty | Checks for non-empty attribute requirements |
attr-output-default | Checks for output attributes with defaults |
build-args-kwargs | Checks for **kwargs in build rules |
constant-glob | Checks for constant glob patterns |
duplicated-name | Checks for duplicate variable names |
keyword-position-args | Checks for positional args after keywords |
positional-args | Checks for too many positional args |
redefined-variable | Checks for variable redefinition |
return-value | Checks for return value issues |
rule-impl-return | Checks rule implementation return value |
uninitialized | Checks for uninitialized variables |
unnamed-macro | Checks for unnamed macro definitions |
| Rule | Description |
|---|
confusing-name | Checks for confusing variable names |
name-conventions | Checks naming conventions |
package-on-top | Checks that package() is at top |
print | Checks for print statements |
unsorted-dict-items | Checks for unsorted dictionary items |
| Rule | Description |
|---|
return-inside-loop | Checks for return statements inside loops |
| Rule | Description |
|---|
load | Checks for unused load statements |
load-on-top | Checks that loads are at top of file |
same-origin-load | Checks for same-origin load statements |
| Rule | Description |
|---|
no-effect | Checks for statements with no effect |
unreachable | Checks for unreachable code |
unused-variable | Checks for unused variables |
| Rule | Description |
|---|
function-docstring | Checks for missing function docstrings |
function-docstring-args | Checks function docstring documents args |
function-docstring-header | Checks function docstring header format |
function-docstring-return | Checks function docstring documents return |
module-docstring | Checks for missing module docstrings |
| Rule | Description |
|---|
attr-license | Checks for deprecated licenses attribute |
attr-single-file | Checks for single_file attribute usage |
bzl-visibility | Checks for deprecated bzl_visibility |
ctx-actions | Checks for deprecated ctx.action |
ctx-args | Checks for deprecated ctx.outputs and ctx.files |
deprecated-function | Checks for deprecated function usage |
depset-iteration | Checks for iteration over depset |
depset-union | Checks for deprecated depset union |
dict-concatenation | Checks for dict concatenation with + |
filetype | Checks for deprecated FileType usage |
git-repository | Checks for deprecated git_repository |
http-archive | Checks for deprecated http_archive |
output-group | Checks for deprecated OutputGroupInfo |
package-name | Checks for deprecated PACKAGE_NAME |
repository-name | Checks for deprecated REPOSITORY_NAME |
| Rule | Description |
|---|
overly-nested-depset | Checks for deeply nested depsets |
provider-params | Checks provider parameter usage |
| Rule | Description |
|---|
native-android | Checks for native android_* rules |
native-build | Checks for native.existing_rules usage |
native-cc | Checks for native cc_* rules |
native-java | Checks for native java_* rules |
native-package | Checks for native.package usage |
native-proto | Checks for native proto_* rules |
native-py | Checks for native py_* rules |
| Rule | Description |
|---|
integer-division | Checks for integer division compatibility |
string-iteration | Checks for string iteration compatibility |
Create a .skylint.json file in your project root:
"disable": ["print", "module-docstring"],
"warnings_as_errors": false
| Option | Description |
|---|
enable | Rules to enable (supports all and category names) |
disable | Rules to disable (supports glob patterns like native-*) |
warnings_as_errors | Treat warnings as errors |
Many rules support automatic fixing:
Get detailed information about a specific rule:
Output:
Checks for unused load statements
https://github.com/bazelbuild/buildtools/blob/master/WARNINGS.md#load
Suppress warnings with comments:
# Suppress on the current line (comment-only line)
# Suppress on the next line
# skylint: disable-next-line=unused-variable
# Inline suppression (same line as code)
print("Debug") # skylint: disable=print
Multiple rules can be suppressed with commas:
# skylint: disable=print,unused-variable
run: skylint --format=github ./...
files: \.(bzl|bazel|star)$
| Code | Meaning |
|---|
| 0 | Success (no issues) |
| 1 | Error (lint errors or tool failure) |
| 2 | Warning (warnings found, no errors) |
Use --warnings-as-errors to treat warnings as errors (exit code 1).