1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43# Code formatter.
Set-StrictMode -Version 'Latest'
$ErrorActionPreference = 'Stop'
function section($message) {
Write-Host "- $message" -ForegroundColor Green
}
$WORKSPACE_ROOT = (bazel info workspace)
$GOOGLE_JAVA_FORMAT = (bazel run --run_under=echo //scripts:google-java-format)
section "Buildifier"
Write-Host " buildifier" -ForegroundColor Green
bazel run //:buildifier
section "Java"
Write-Host " google-java-format" -ForegroundColor Green
Get-ChildItem -Path "$PWD/java" -Include "*.java" -Recurse | ForEach-Object {
&"$GOOGLE_JAVA_FORMAT" --replace $_.FullName
}
section "Javascript"
Write-Host " javascript/selenium-webdriver - prettier" -ForegroundColor Green
$NODE_WEBDRIVER = "$WORKSPACE_ROOT/javascript/selenium-webdriver"
bazel run //javascript:prettier -- "$NODE_WEBDRIVER" --write "$NODE_WEBDRIVER/.prettierrc" --log-level=warn
section "Ruby"
Write-Host " rubocop" -ForegroundColor Green
bazel run //rb:lint
section "Rust"
Write-Host " rustfmt" -ForegroundColor Green
bazel run @rules_rust//:rustfmt
section "Python"
Write-Host " python - ruff" -ForegroundColor Green
bazel run @multitool//tools/ruff:cwd -- check --fix --show-fixes
bazel run @multitool//tools/ruff:cwd -- format
section "Copyright"
bazel run //scripts:update_copyright