-
-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Setup Trunk as a meta-linter for the repo
Configures buildifier to run with a config obtained from removing docstring and 'sorted items in dict' warnings from the example config. ``` .trunk/tools/buildifier -config=example ```
- Loading branch information
Siddhartha Bagaria
committed
Sep 12, 2023
1 parent
0f21054
commit 07541b9
Showing
8 changed files
with
189 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
{ | ||
"type": "auto", | ||
"mode": "fix", | ||
"lint": "fix", | ||
"warningsList": [ | ||
"attr-applicable_licenses", | ||
"attr-cfg", | ||
"attr-license", | ||
"attr-licenses", | ||
"attr-non-empty", | ||
"attr-output-default", | ||
"attr-single-file", | ||
"build-args-kwargs", | ||
"bzl-visibility", | ||
"confusing-name", | ||
"constant-glob", | ||
"ctx-actions", | ||
"ctx-args", | ||
"deprecated-function", | ||
"depset-items", | ||
"depset-iteration", | ||
"depset-union", | ||
"dict-concatenation", | ||
"dict-method-named-arg", | ||
"duplicated-name", | ||
"filetype", | ||
"git-repository", | ||
"http-archive", | ||
"integer-division", | ||
"keyword-positional-params", | ||
"list-append", | ||
"load", | ||
"load-on-top", | ||
"name-conventions", | ||
"native-android", | ||
"native-build", | ||
"native-cc", | ||
"native-java", | ||
"native-package", | ||
"native-proto", | ||
"native-py", | ||
"no-effect", | ||
"out-of-order-load", | ||
"output-group", | ||
"overly-nested-depset", | ||
"package-name", | ||
"package-on-top", | ||
"positional-args", | ||
"print", | ||
"provider-params", | ||
"redefined-variable", | ||
"repository-name", | ||
"return-value", | ||
"rule-impl-return", | ||
"same-origin-load", | ||
"skylark-comment", | ||
"skylark-docstring", | ||
"string-iteration", | ||
"uninitialized", | ||
"unnamed-macro", | ||
"unreachable", | ||
"unused-variable" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Pull Request | ||
on: [pull_request] | ||
concurrency: | ||
group: ${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
|
||
# NOTE: This current setup does not post annotations to PRs. | ||
# https://github.com/marketplace/actions/trunk-check#getting-inline-annotations-for-fork-prs | ||
|
||
permissions: read-all | ||
|
||
jobs: | ||
trunk_check: | ||
name: Trunk Check Runner | ||
runs-on: ubuntu-latest | ||
permissions: | ||
checks: write # For trunk to post annotations | ||
contents: read # For repo checkout | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Trunk Check | ||
uses: trunk-io/trunk-action@v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
*out | ||
*logs | ||
*actions | ||
*notifications | ||
*tools | ||
plugins | ||
user_trunk.yaml | ||
user.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Autoformatter friendly markdownlint config (all formatting rules disabled) | ||
default: true | ||
blank_lines: false | ||
bullet: false | ||
html: false | ||
indentation: false | ||
line_length: false | ||
spaces: false | ||
url: false | ||
whitespace: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
enable=all | ||
source-path=SCRIPTDIR | ||
disable=SC2154 | ||
|
||
# If you're having issues with shellcheck following source, disable the errors via: | ||
# disable=SC1090 | ||
# disable=SC1091 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
rules: | ||
quoted-strings: | ||
required: only-when-needed | ||
extra-allowed: ["{|}"] | ||
empty-values: | ||
forbid-in-block-mappings: true | ||
forbid-in-flow-mappings: true | ||
key-duplicates: {} | ||
octal-values: | ||
forbid-implicit-octal: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
version: 0.1 | ||
cli: | ||
version: 1.15.0 | ||
plugins: | ||
sources: | ||
- id: trunk | ||
ref: v1.2.3 | ||
uri: https://github.com/trunk-io/plugins | ||
runtimes: | ||
enabled: | ||
- [email protected] | ||
- [email protected] | ||
- [email protected] | ||
lint: | ||
definitions: | ||
- name: buildifier | ||
files: [starlark, bazel-build, bazel-workspace] | ||
tools: [buildifier] | ||
commands: | ||
- name: fix | ||
run: buildifier --lint=fix "${target}" | ||
output: rewrite | ||
cache_results: true | ||
formatter: true | ||
in_place: true | ||
batch: true | ||
success_codes: [0] | ||
- name: warn | ||
run: buildifier --lint=warn --format=json --mode=check "${target}" | ||
# Custom parser type defined in the trunk cli to handle buildifier's JSON output. | ||
output: buildifier | ||
cache_results: true | ||
batch: true | ||
success_codes: [0] | ||
suggest_if: files_present | ||
direct_configs: | ||
- .buildifier.json | ||
# Not a native buildifier construct, but useful for 'addTables', see test file | ||
- .buildifier-tables.json | ||
environment: | ||
- name: PATH | ||
list: ["${linter}"] | ||
known_good_version: 6.1.0 | ||
version_command: | ||
parse_regex: ${semver} | ||
run: buildifier --version | ||
enabled: | ||
- [email protected] | ||
- [email protected] | ||
- [email protected] | ||
- git-diff-check | ||
- [email protected] | ||
- [email protected] | ||
- [email protected] | ||
- [email protected] | ||
- [email protected] | ||
- [email protected] | ||
- [email protected] | ||
actions: | ||
enabled: | ||
- trunk-announce | ||
- trunk-check-pre-push | ||
- trunk-fmt-pre-commit | ||
- trunk-upgrade-available |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../.buildifier.json |