generated from bazel-contrib/rules-template
-
-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: overhaul of format.sh (#105)
* refactor: overhaul of format.sh Use GitHub Linguist to define the file extensions for each language, getting much more accurate. Extract a helper function for listing files we want to format to reduce duplication. * Update mirror_linguist_languages.sh
- Loading branch information
Showing
7 changed files
with
199 additions
and
142 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 @@ | ||
{} |
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
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,37 @@ | ||
# Filter languages we understand | ||
with_entries(select(.key | IN( | ||
"C++", | ||
"CSS", | ||
"Markdown", | ||
"Go", | ||
"HCL", | ||
"HTML", | ||
"Java", | ||
"JavaScript", | ||
"Jsonnet", | ||
"JSON", | ||
"Kotlin", | ||
"Protocol Buffer", | ||
"Python", | ||
"Scala", | ||
"Shell", | ||
"SQL", | ||
"Starlark", | ||
"Swift", | ||
"TSX", | ||
"TypeScript" | ||
))) | ||
|
||
# Convert values to filenames and extensions with star prefix | ||
| with_entries(.value = ( | ||
.value.filenames + (.value.extensions | map("*" + .)) | ||
)) | ||
|
||
# Render each language as a line in a Bash case statement, e.g. | ||
# 'Jsonnet') patterns=('*.jsonnet' '*.libsonnet') ;; | ||
| to_entries | map( | ||
"'" + .key + "') patterns=(" + (.value | map("'" + . + "'") | join(" ")) + ") ;;" | ||
) | ||
|
||
# Suitable for --raw-output | ||
|.[] |
Oops, something went wrong.