Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Linters which are not language-specific:
| Markdown | [Prettier] | [Vale] |
| Protocol Buffer | [buf] | [buf lint] |
| Python | [ruff] | [flake8], [pylint], [ruff] |
| Ruby | | [RuboCop] |
| Ruby | | [RuboCop], [Standard] |
| Rust | [rustfmt] | |
| SQL | [prettier-plugin-sql] | |
| Scala | [scalafmt] | |
Expand Down Expand Up @@ -85,6 +85,7 @@ Linters which are not language-specific:
[jsonnetfmt]: https://github.com/google/go-jsonnet
[scalafmt]: https://scalameta.org/scalafmt
[rubocop]: https://docs.rubocop.org/
[standard]: https://github.com/standardrb/standard
[ruff]: https://docs.astral.sh/ruff/
[pylint]: https://pylint.readthedocs.io/en/stable/
[shellcheck]: https://www.shellcheck.net/
Expand Down
18 changes: 18 additions & 0 deletions example/.standard.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Standard Ruby configuration for rules_lint example
#
# Standard Ruby is a zero-configuration Ruby style guide, linter, and formatter
# based on RuboCop. See https://github.com/standardrb/standard
#
# This file allows minimal customization of Standard Ruby's opinionated defaults.

# Configure target Ruby version
ruby_version: 3.0

# Ignore certain paths (glob patterns)
ignore:
- 'vendor/**/*'
- 'tmp/**/*'

# You can configure specific cops if needed, though Standard discourages this
# fix: false # Uncomment to prevent auto-fixing
# parallel: true # Uncomment to enable parallel processing
1 change: 1 addition & 0 deletions example/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ exports_files(
"checkstyle-suppressions.xml",
".ruff.toml",
".rubocop.yml",
".standard.yml",
".shellcheckrc",
".scalafmt.conf",
".swcrc",
Expand Down
1 change: 1 addition & 0 deletions example/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
source 'https://rubygems.org'

gem 'rubocop', '~> 1.50'
gem 'standard', '~> 1.35'
21 changes: 19 additions & 2 deletions example/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,37 @@ GEM
racc (1.8.1-java)
rainbow (3.1.1)
regexp_parser (2.11.3)
rubocop (1.81.1)
rubocop (1.80.2)
json (~> 2.3)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.1.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 2.9.3, < 3.0)
rubocop-ast (>= 1.47.1, < 2.0)
rubocop-ast (>= 1.46.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.47.1)
parser (>= 3.3.7.2)
prism (~> 1.4)
rubocop-performance (1.25.0)
lint_roller (~> 1.1)
rubocop (>= 1.75.0, < 2.0)
rubocop-ast (>= 1.38.0, < 2.0)
ruby-progressbar (1.13.0)
standard (1.51.1)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.80.2)
standard-custom (~> 1.0.0)
standard-performance (~> 1.8)
standard-custom (1.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.50)
standard-performance (1.8.0)
lint_roller (~> 1.1)
rubocop-performance (~> 1.25.0)
unicode-display_width (3.2.0)
unicode-emoji (~> 4.1)
unicode-emoji (4.1.0)
Expand All @@ -42,6 +58,7 @@ PLATFORMS

DEPENDENCIES
rubocop (~> 1.50)
standard (~> 1.35)

BUNDLED WITH
2.6.9
6 changes: 5 additions & 1 deletion example/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,13 @@ ruby.bundle_fetch(
"racc-1.8.1-java": "54f2e6d1e1b91c154013277d986f52a90e5ececbe91465d29172e49342732b98",
"rainbow-3.1.1": "039491aa3a89f42efa1d6dec2fc4e62ede96eb6acd95e52f1ad581182b79bc6a",
"regexp_parser-2.11.3": "ca13f381a173b7a93450e53459075c9b76a10433caadcb2f1180f2c741fc55a4",
"rubocop-1.81.1": "352a9a6f314a4312f6c305f1f72bc466254d221c95445cd49e1b65d1f9411635",
"rubocop-1.80.2": "6485f30fefcf5c199db3b91e5e253b1ef43f7e564784e2315255809a3dd9abf4",
"rubocop-ast-1.47.1": "592682017855408b046a8190689490763aecea175238232b1b526826349d01ae",
"rubocop-performance-1.25.0": "6f7d03568a770054117a78d0a8e191cefeffb703b382871ca7743831b1a52ec1",
"ruby-progressbar-1.13.0": "80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33",
"standard-1.51.1": "6d0d98a1fac26d660393f37b3d9c864632bb934b17abfa23811996b20f87faf2",
"standard-custom-1.0.2": "424adc84179a074f1a2a309bb9cf7cd6bfdb2b6541f20c6bf9436c0ba22a652b",
"standard-performance-1.8.0": "ed17b7d0e061b2a19a91dd434bef629439e2f32310f22f26acb451addc92b788",
"unicode-display_width-3.2.0": "0cdd96b5681a5949cdbc2c55e7b420facae74c4aaf9a9815eee1087cb1853c42",
"unicode-emoji-4.1.0": "4997d2d5df1ed4252f4830a9b6e86f932e2013fbff2182a9ce9ccabda4f325a5",
},
Expand Down
6 changes: 5 additions & 1 deletion example/WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -362,9 +362,13 @@ rb_bundle_fetch(
"racc-1.8.1-java": "54f2e6d1e1b91c154013277d986f52a90e5ececbe91465d29172e49342732b98",
"rainbow-3.1.1": "039491aa3a89f42efa1d6dec2fc4e62ede96eb6acd95e52f1ad581182b79bc6a",
"regexp_parser-2.11.3": "ca13f381a173b7a93450e53459075c9b76a10433caadcb2f1180f2c741fc55a4",
"rubocop-1.81.1": "352a9a6f314a4312f6c305f1f72bc466254d221c95445cd49e1b65d1f9411635",
"rubocop-1.80.2": "6485f30fefcf5c199db3b91e5e253b1ef43f7e564784e2315255809a3dd9abf4",
"rubocop-ast-1.47.1": "592682017855408b046a8190689490763aecea175238232b1b526826349d01ae",
"rubocop-performance-1.25.0": "6f7d03568a770054117a78d0a8e191cefeffb703b382871ca7743831b1a52ec1",
"ruby-progressbar-1.13.0": "80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33",
"standard-1.51.1": "6d0d98a1fac26d660393f37b3d9c864632bb934b17abfa23811996b20f87faf2",
"standard-custom-1.0.2": "424adc84179a074f1a2a309bb9cf7cd6bfdb2b6541f20c6bf9436c0ba22a652b",
"standard-performance-1.8.0": "ed17b7d0e061b2a19a91dd434bef629439e2f32310f22f26acb451addc92b788",
"unicode-display_width-3.2.0": "0cdd96b5681a5949cdbc2c55e7b420facae74c4aaf9a9815eee1087cb1853c42",
"unicode-emoji-4.1.0": "4997d2d5df1ed4252f4830a9b6e86f932e2013fbff2182a9ce9ccabda4f325a5",
},
Expand Down
9 changes: 9 additions & 0 deletions example/test/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ load(
"rubocop_test",
"ruff_test",
"shellcheck_test",
"standardrb_test",
)

write_file(
Expand Down Expand Up @@ -194,3 +195,11 @@ rubocop_test(
# Normally you'd fix the file instead of tagging this test.
tags = ["manual"],
)

standardrb_test(
name = "standardrb",
srcs = ["//src:hello_ruby"],
# Expected to fail based on current content of the file.
# Normally you'd fix the file instead of tagging this test.
tags = ["manual"],
)
9 changes: 9 additions & 0 deletions example/test/lint_test.bats
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,15 @@ EOF
C: 1: 1: [Correctable] Style/FrozenStringLiteralComment: Missing frozen string literal comment.
W: 4: 1: [Correctable] Lint/UselessAssignment: Useless assignment to variable - unused_variable.
C: 6:101: Layout/LineLength: Line is too long. [115/100]
EOF

# Standard Ruby
echo <<"EOF" | assert_output --partial
== src/hello.rb ==
W: 4: 1: [Correctable] Lint/UselessAssignment: Useless assignment to variable - unused_variable.
C: 19: 3: [Correctable] Layout/IndentationWidth: Use 2 (not 4) spaces for indentation.
W: 29: 1: [Correctable] Lint/UselessAssignment: Useless assignment to variable - message.
W: 32: 1: [Correctable] Lint/UselessAssignment: Useless assignment to variable - numbers.
EOF

# stylelint
Expand Down
5 changes: 5 additions & 0 deletions example/tools/lint/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,8 @@ alias(
name = "rubocop",
actual = "@bundle//bin:rubocop",
)

alias(
name = "standardrb",
actual = "@bundle//bin:standardrb",
)
10 changes: 9 additions & 1 deletion example/tools/lint/linters.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ load("@aspect_rules_lint//lint:keep_sorted.bzl", "lint_keep_sorted_aspect")
load("@aspect_rules_lint//lint:ktlint.bzl", "lint_ktlint_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:pylint.bzl", "lint_pylint_aspect")
load("@aspect_rules_lint//lint:rubocop.bzl", "lint_rubocop_aspect")
load("@aspect_rules_lint//lint:ruff.bzl", "lint_ruff_aspect")
load("@aspect_rules_lint//lint:pylint.bzl", "lint_pylint_aspect")
load("@aspect_rules_lint//lint:shellcheck.bzl", "lint_shellcheck_aspect")
load("@aspect_rules_lint//lint:spotbugs.bzl", "lint_spotbugs_aspect")
load("@aspect_rules_lint//lint:standardrb.bzl", "lint_standardrb_aspect")
load("@aspect_rules_lint//lint:stylelint.bzl", "lint_stylelint_aspect")
load("@aspect_rules_lint//lint:vale.bzl", "lint_vale_aspect")
load("@aspect_rules_lint//lint:yamllint.bzl", "lint_yamllint_aspect")
Expand Down Expand Up @@ -150,3 +151,10 @@ rubocop = lint_rubocop_aspect(
)

rubocop_test = lint_test(aspect = rubocop)

standardrb = lint_standardrb_aspect(
binary = Label("//tools/lint:standardrb"),
configs = [Label("//:.standard.yml")],
)

standardrb_test = lint_test(aspect = standardrb)
6 changes: 6 additions & 0 deletions lint/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,12 @@ bzl_library(
deps = ["//lint/private:lint_aspect"],
)

bzl_library(
name = "standardrb",
srcs = ["standardrb.bzl"],
deps = ["//lint/private:lint_aspect"],
)

bzl_library(
name = "ruff",
srcs = ["ruff.bzl"],
Expand Down
Loading
Loading