Skip to content

Commit

Permalink
chore: configure rules_lint
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeagle authored and gregmagolan committed Sep 2, 2024
1 parent edaafd2 commit 253ba7b
Show file tree
Hide file tree
Showing 17 changed files with 363 additions and 11 deletions.
4 changes: 4 additions & 0 deletions .aspect/cli/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ configure:
go: false
kotlin: false
protobuf: true
lint:
aspects:
- //tools/lint:linters.bzl%vale
- //tools/lint:linters.bzl%shellcheck
14 changes: 14 additions & 0 deletions .aspect/workflows/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ workspaces:
queue: bazel-lib-small
- format:
without: true
- lint:
without: true
- gazelle:
without: true
- configure:
Expand All @@ -35,6 +37,8 @@ workspaces:
queue: bazel-lib-small
- format:
without: true
- lint:
without: true
- gazelle:
without: true
- configure:
Expand All @@ -50,6 +54,8 @@ workspaces:
queue: bazel-lib-small
- format:
without: true
- lint:
without: true
- gazelle:
without: true
- configure:
Expand All @@ -65,6 +71,8 @@ workspaces:
queue: bazel-lib-small
- format:
without: true
- lint:
without: true
- gazelle:
without: true
- configure:
Expand All @@ -80,6 +88,8 @@ workspaces:
queue: bazel-lib-small
- format:
without: true
- lint:
without: true
- gazelle:
without: true
- configure:
Expand All @@ -89,6 +99,8 @@ workspaces:
- delivery:
without: true
tasks:
- checkout:
update_strategy: rebase
- test:
hooks:
- type: before_task
Expand All @@ -99,6 +111,8 @@ tasks:
- vmstat.out
- format:
queue: bazel-lib-small
- lint:
queue: bazel-lib-small
- gazelle:
queue: bazel-lib-small
- configure:
Expand Down
10 changes: 5 additions & 5 deletions .aspect/workflows/deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", _http_archive = "http_archi
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")

# TODO: move this to a rule set so repositories on Aspect Workflows can avoid this boilerplate
rosetta_version = "5.10.12"
rosetta_version = "5.11.0-beta1.dev.30.g3f51b7a"
rosetta_integrity = {
"darwin_aarch64": "sha256-AmrO0e44haDvaVCosuNCPONPTLflSWyHMmSVv7V6iO8=",
"darwin_x86_64": "sha256-9g21wDZPBKqP0Z/KCmULJhwH4SqsKqOS1ceRVg3TWYs=",
"linux_aarch64": "sha256-KncnXJfAstOI5savV+pCF8/AuPlJs1DG8xTwXstPmuM=",
"linux_x86_64": "sha256-1oyhGKI0yzL1Y/5IjFmWShl27Bs4TqFZNipVL2xb9wU=",
"darwin_aarch64": "sha256-o3p3YBycqw8Lxc6oyO1keaB+kdGTn95dt0SpIr/8Y30=",
"darwin_x86_64": "sha256-gWz0FS7C6lKWdYpUR2AafszmdqKZrfy0Rpfcg1p93Ps=",
"linux_aarch64": "sha256-NQkpIlSB5AaD4VcYSLc3mnHIIVR4onO/HGPKJ4lIUdU=",
"linux_x86_64": "sha256-woRb0CZiv1J040yXQi4gBlez/eFrcyDqT/+IzNbJ7NM=",
}

# https://github.com/suzuki-shunsuke/circleci-config-merge/releases
Expand Down
4 changes: 2 additions & 2 deletions .bazeliskrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
BAZELISK_BASE_URL=https://github.com/aspect-build/aspect-cli/releases/download
USE_BAZEL_VERSION=aspect/5.9.25
BAZELISK_BASE_URL=https://static.aspect.build/aspect
USE_BAZEL_VERSION=aspect/2024.34.43
101 changes: 98 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ workflows:
- aw-gazelle:
context: []
workspace: .
- aw-lint:
context: []
workspace: .
- aw-root_workspace_configure:
context: []
workspace: .
Expand Down Expand Up @@ -137,8 +140,8 @@ jobs:
ASPECT_WORKFLOWS_CIRCLE_PIPELINE_PROJECT_TYPE: << pipeline.project.type >>
ASPECT_WORKFLOWS_CIRCLE_WORKFLOW_BASE_NAME: aspect-workflows
ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml
ASPECT_WORKFLOWS_DELIVERY_COMMIT: << pipeline.parameters.delivery_commit >>
ASPECT_WORKFLOWS_WORKSPACE: << parameters.workspace >>
DELIVERY_COMMIT: << pipeline.parameters.delivery_commit >>
XDG_CACHE_HOME: /mnt/ephemeral/caches
machine: true
parameters:
Expand Down Expand Up @@ -196,6 +199,10 @@ jobs:
command: /etc/aspect/workflows/bin/agent_health_check
name: Agent health check
no_output_timeout: 180m
- run:
command: rosetta run checkout
name: Checkout health
no_output_timeout: 180m
- run:
command: rosetta run buildifier --workspace << parameters.workspace >>
name: Buildifier
Expand Down Expand Up @@ -236,6 +243,10 @@ jobs:
command: /etc/aspect/workflows/bin/agent_health_check
name: Agent health check
no_output_timeout: 180m
- run:
command: rosetta run checkout
name: Checkout health
no_output_timeout: 180m
- run:
command: rosetta run test --workspace << parameters.workspace >>
name: Test
Expand Down Expand Up @@ -296,6 +307,10 @@ jobs:
command: /etc/aspect/workflows/bin/agent_health_check
name: Agent health check
no_output_timeout: 180m
- run:
command: rosetta run checkout
name: Checkout health
no_output_timeout: 180m
- run:
command: rosetta run test --workspace << parameters.workspace >>
name: Test
Expand Down Expand Up @@ -356,6 +371,10 @@ jobs:
command: /etc/aspect/workflows/bin/agent_health_check
name: Agent health check
no_output_timeout: 180m
- run:
command: rosetta run checkout
name: Checkout health
no_output_timeout: 180m
- run:
command: rosetta run test --workspace << parameters.workspace >>
name: Test
Expand Down Expand Up @@ -416,6 +435,10 @@ jobs:
command: /etc/aspect/workflows/bin/agent_health_check
name: Agent health check
no_output_timeout: 180m
- run:
command: rosetta run checkout
name: Checkout health
no_output_timeout: 180m
- run:
command: rosetta run test --workspace << parameters.workspace >>
name: Test
Expand Down Expand Up @@ -476,6 +499,10 @@ jobs:
command: /etc/aspect/workflows/bin/agent_health_check
name: Agent health check
no_output_timeout: 180m
- run:
command: rosetta run checkout
name: Checkout health
no_output_timeout: 180m
- run:
command: rosetta run test --workspace << parameters.workspace >>
name: Test
Expand Down Expand Up @@ -536,6 +563,10 @@ jobs:
command: /etc/aspect/workflows/bin/agent_health_check
name: Agent health check
no_output_timeout: 180m
- run:
command: rosetta run checkout
name: Checkout health
no_output_timeout: 180m
- run:
command: rosetta run format --workspace << parameters.workspace >>
name: Format
Expand Down Expand Up @@ -576,6 +607,10 @@ jobs:
command: /etc/aspect/workflows/bin/agent_health_check
name: Agent health check
no_output_timeout: 180m
- run:
command: rosetta run checkout
name: Checkout health
no_output_timeout: 180m
- run:
command: rosetta run gazelle --workspace << parameters.workspace >>
name: Gazelle
Expand All @@ -588,15 +623,67 @@ jobs:
no_output_timeout: 10m
when: always
working_directory: /mnt/ephemeral/workdir
aw-lint:
environment:
ASPECT_WORKFLOWS_CIRCLE_PIPELINE_NUMBER: << pipeline.number >>
ASPECT_WORKFLOWS_CIRCLE_PIPELINE_PROJECT_TYPE: << pipeline.project.type >>
ASPECT_WORKFLOWS_CIRCLE_WORKFLOW_BASE_NAME: aspect-workflows
ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml
ASPECT_WORKFLOWS_WORKSPACE: << parameters.workspace >>
XDG_CACHE_HOME: /mnt/ephemeral/caches
ASPECT_WORKFLOWS_TMP_OVERRIDE: /tmp/aspect
machine: true
parameters:
delivery_manifest:
default: true
type: boolean
workspace:
type: string
resource_class: aspect-build/bazel-lib-small
steps:
- run:
command: mkdir -p /tmp/aspect
name: create file
- run:
command: /etc/aspect/workflows/bin/configure_workflows_env
name: Workflows environment
- checkout
- run:
command: rm -rf /workflows/artifacts /workflows/testlogs
name: Prepare archive directories
- run:
command: /etc/aspect/workflows/bin/agent_health_check
name: Agent health check
no_output_timeout: 180m
- run:
command: rosetta run checkout
name: Checkout health
no_output_timeout: 180m
- run:
command: rosetta run lint --workspace << parameters.workspace >>
name: Lint
no_output_timeout: 180m
- run:
command: find /tmp/aspect -name *result_diagnostics.json -exec cat {} +
name: Lint ls
no_output_timeout: 180m
- store_artifacts:
path: /workflows/artifacts
- run:
command: rosetta run finalization
name: Finalization
no_output_timeout: 10m
when: always
working_directory: /mnt/ephemeral/workdir
aw-manual-deliver:
environment:
ASPECT_WORKFLOWS_CIRCLE_PIPELINE_NUMBER: << pipeline.number >>
ASPECT_WORKFLOWS_CIRCLE_PIPELINE_PROJECT_TYPE: << pipeline.project.type >>
ASPECT_WORKFLOWS_CIRCLE_WORKFLOW_BASE_NAME: aspect-workflows
ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml
ASPECT_WORKFLOWS_DELIVERY_COMMIT: << pipeline.parameters.delivery_commit >>
ASPECT_WORKFLOWS_DELIVERY_TARGETS: << pipeline.parameters.delivery_targets >>
ASPECT_WORKFLOWS_WORKSPACE: << parameters.workspace >>
DELIVERY_COMMIT: << pipeline.parameters.delivery_commit >>
DELIVERY_TARGETS: << pipeline.parameters.delivery_targets >>
XDG_CACHE_HOME: /mnt/ephemeral/caches
machine: true
parameters:
Expand Down Expand Up @@ -654,6 +741,10 @@ jobs:
command: /etc/aspect/workflows/bin/agent_health_check
name: Agent health check
no_output_timeout: 180m
- run:
command: rosetta run checkout
name: Checkout health
no_output_timeout: 180m
- run:
command: rosetta run configure --workspace << parameters.workspace >>
name: Configure
Expand Down Expand Up @@ -694,6 +785,10 @@ jobs:
command: /etc/aspect/workflows/bin/agent_health_check
name: Agent health check
no_output_timeout: 180m
- run:
command: rosetta run checkout
name: Checkout health
no_output_timeout: 180m
- run:
command: rosetta run test --workspace << parameters.workspace >>
name: Test
Expand Down
6 changes: 6 additions & 0 deletions .shellcheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Turn on warnings for unquoted variables with safe values
enable=quote-safe-variables
# Turn on warnings for unassigned uppercase variables
enable=check-unassigned-uppercase

#enable=require-variable-braces
19 changes: 19 additions & 0 deletions .vale.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Configuration for https://Vale.sh
# See https://vale.sh/docs/topics/config/

StylesPath = tools/lint/vale
IgnoredScopes = code

# Tell Vale to look in tools/lint/vale/config/vocabularies/engineering
Vocab = engineering

[*.md]
BlockIgnores = ```[a-z]*\n.*?\n```
BasedOnStyles = Vale, Google

# Reduce levels to make silo error-free.
# TODO(alex): consider promoting some to error
Google.Exclamation = warning
Google.Quotes = warning
Vale.Spelling = warning
Vale.Terms = warning
18 changes: 18 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
load("@aspect_bazel_lib//lib:copy_to_bin.bzl", "copy_to_bin")
load("@aspect_bazel_lib_host//:defs.bzl", "host")
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
load("@bazel_skylib//rules:copy_file.bzl", "copy_file")
Expand All @@ -10,6 +11,8 @@ load("//lib:testing.bzl", "assert_contains")
load("//lib:write_source_files.bzl", "write_source_files")
load("//lib:yq.bzl", "yq")

exports_files([".shellcheckrc"])

# gazelle:prefix github.com/aspect-build/bazel-lib

gazelle_binary(
Expand Down Expand Up @@ -163,3 +166,18 @@ diff_test(
file1 = "tar_test13_mtree",
file2 = "//lib/tests/tar:expected13.mtree",
)

# Place the .vale.ini file in bazel-bin so the relative path it contains
# StylesPath = tools/lint/vale
# will work when it's run as an action.
copy_to_bin(
name = ".vale_ini",
srcs = [".vale.ini"],
visibility = ["//visibility:public"],
)

filegroup(
name = "markdown_files",
srcs = glob(["*.md"]),
tags = ["markdown"],
)
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ use_repo(host, "aspect_bazel_lib_host")
host_platform = use_extension("@platforms//host:extension.bzl", "host_platform", dev_dependency = True)
use_repo(host_platform, "host_platform")

bazel_dep(name = "aspect_rules_lint", version = "1.0.0-rc8", dev_dependency = True)
bazel_dep(name = "aspect_rules_lint", version = "1.0.0-rc10", dev_dependency = True)
bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.5.0", dev_dependency = True)
bazel_dep(name = "buildifier_prebuilt", version = "6.4.0", dev_dependency = True)
bazel_dep(name = "bazel_features", version = "0.2.0", dev_dependency = True)
4 changes: 4 additions & 0 deletions WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@ go_dependencies()
load("//.aspect/workflows:deps.bzl", "fetch_workflows_deps")

fetch_workflows_deps()

load("@aspect_rules_lint//lint:vale.bzl", "fetch_vale")

fetch_vale()
Loading

0 comments on commit 253ba7b

Please sign in to comment.