Skip to content

Commit

Permalink
test: linting
Browse files Browse the repository at this point in the history
  • Loading branch information
JesseTatasciore committed Aug 29, 2024
1 parent 6bbfc46 commit fc82f53
Show file tree
Hide file tree
Showing 28 changed files with 460,434 additions and 8 deletions.
1 change: 1 addition & 0 deletions .aspect/cli/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ configure:
protobuf: true
lint:
aspects:
- //tools/lint:linters.bzl%vale
- //tools/lint:linters.bzl%shellcheck
2 changes: 2 additions & 0 deletions .aspect/workflows/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ workspaces:
- delivery:
without: true
tasks:
- checkout:
update_strategy: rebase
- test:
hooks:
- type: before_task
Expand Down
52 changes: 52 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -199,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 @@ -239,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 @@ -299,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 @@ -359,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 @@ -419,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 @@ -479,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 @@ -539,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 @@ -579,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 @@ -599,6 +631,7 @@ jobs:
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:
Expand All @@ -608,6 +641,9 @@ jobs:
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
Expand All @@ -619,10 +655,18 @@ 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 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:
Expand Down Expand Up @@ -697,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 @@ -737,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
2 changes: 2 additions & 0 deletions .shellcheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
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
16 changes: 16 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ load("//lib:tar.bzl", "mtree_spec")
load("//lib:testing.bzl", "assert_contains")
load("//lib:write_source_files.bzl", "write_source_files")
load("//lib:yq.bzl", "yq")
load("@aspect_bazel_lib//lib:copy_to_bin.bzl", "copy_to_bin")

exports_files([".shellcheckrc"])

Expand Down Expand Up @@ -165,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 = "foo",
srcs = ["foo.md"],
tags = ["markdown"],
)
11 changes: 11 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ module(
# Lower-bounds (minimum) versions for direct runtime dependencies
bazel_dep(name = "bazel_skylib", version = "1.5.0")
bazel_dep(name = "platforms", version = "0.0.10")
bazel_dep(name = "aspect_rules_js", version = "2.0.0")
bazel_dep(name = "rules_nodejs", version = "6.2.0")

# 0.5.4 is the first version with bzlmod support
bazel_dep(name = "stardoc", version = "0.6.2", repo_name = "io_bazel_stardoc")
Expand All @@ -26,6 +28,15 @@ bazel_lib_toolchains.expand_template()
bazel_lib_toolchains.bats()
use_repo(bazel_lib_toolchains, "bats_toolchains", "bsd_tar_toolchains", "copy_directory_toolchains", "copy_to_directory_toolchains", "coreutils_toolchains", "expand_template_toolchains", "jq", "jq_toolchains", "yq", "yq_toolchains", "zstd_toolchains")

node = use_extension("@rules_nodejs//nodejs:extensions.bzl", "node")
node.toolchain(node_version = "17.9.1")

# Needed since rosetta entry script calls `bazel fetch @nodejs_linux_${ARCH}//:bin/node`
# when vendoring rosetta.
# https://github.com/aspect-build/silo/blob/1851aa3897769f01c538ad3c3d101aab82b9ce30/workflows/rosetta/rosetta#L50
use_repo(node, "nodejs_linux_amd64")
use_repo(node, "nodejs_linux_arm64")

register_toolchains(
"@copy_directory_toolchains//:all",
"@copy_to_directory_toolchains//:all",
Expand Down
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 fc82f53

Please sign in to comment.