-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Add Taskfile tasks to lint YAML files.
- Loading branch information
1 parent
03fa657
commit 056256f
Showing
7 changed files
with
124 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,3 @@ | ||
# Build-related directories and files | ||
.task/ | ||
target/ |
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,3 @@ | ||
[submodule "tools/yscope-dev-utils"] | ||
path = tools/yscope-dev-utils | ||
url = https://github.com/y-scope/yscope-dev-utils.git |
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,39 @@ | ||
# log4j2-appenders | ||
This is a repository for a set of useful [Log4j 2][log4j2] appenders. | ||
|
||
## Contributing | ||
Follow the steps below to develop and contribute to the project. | ||
|
||
## Set up | ||
Initialize and update the submodules: | ||
```shell | ||
git submodule update --init --recursive | ||
``` | ||
|
||
## Linting | ||
Before submitting a pull request, ensure you’ve run the linting [commands](#running-the-linters) | ||
below and either fixed any violations or suppressed the warnings. | ||
|
||
### Requirements | ||
* Python 3.10 or higher | ||
* [Task] 3.38.0 or higher | ||
|
||
### Adding files | ||
Certain file types need to be added to our linting rules manually: | ||
|
||
* If adding a **YAML** file (regardless of its extension), add it as an argument to the `yamllint` | ||
command in [lint-tasks.yaml](lint-tasks.yaml). | ||
|
||
### Running the linters | ||
To run all linting checks: | ||
```shell | ||
task lint:check | ||
``` | ||
|
||
To run all linting checks AND automatically fix any fixable issues: | ||
```shell | ||
task lint:fix | ||
``` | ||
|
||
[log4j2]: https://logging.apache.org/log4j/2.x/index.html | ||
[Task]: https://taskfile.dev |
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 @@ | ||
yamllint>=1.35.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
version: "3" | ||
|
||
vars: | ||
G_LINT_VENV_DIR: "{{.G_BUILD_DIR}}/lint-venv" | ||
G_LINT_VENV_CHECKSUM_FILE: "{{.G_BUILD_DIR}}/lint#venv.md5" | ||
|
||
tasks: | ||
check: | ||
cmds: | ||
- task: "yml-check" | ||
|
||
fix: | ||
cmds: | ||
- task: "yml-fix" | ||
|
||
yml: | ||
aliases: | ||
- "yml-check" | ||
- "yml-fix" | ||
deps: ["venv"] | ||
cmds: | ||
- |- | ||
. "{{.G_LINT_VENV_DIR}}/bin/activate" | ||
yamllint \ | ||
--config-file "tools/yscope-dev-utils/lint-configs/.yamllint.yml" \ | ||
--strict \ | ||
.github/ \ | ||
lint-tasks.yaml \ | ||
taskfile.yaml | ||
|
||
venv: | ||
internal: true | ||
vars: | ||
CHECKSUM_FILE: "{{.G_LINT_VENV_CHECKSUM_FILE}}" | ||
OUTPUT_DIR: "{{.G_LINT_VENV_DIR}}" | ||
sources: | ||
- "{{.ROOT_DIR}}/taskfile.yaml" | ||
- "{{.TASKFILE}}" | ||
- "lint-requirements.txt" | ||
generates: ["{{.CHECKSUM_FILE}}"] | ||
run: "once" | ||
deps: | ||
- ":init" | ||
- task: ":utils:validate-checksum" | ||
vars: | ||
CHECKSUM_FILE: "{{.CHECKSUM_FILE}}" | ||
DATA_DIR: "{{.OUTPUT_DIR}}" | ||
cmds: | ||
- task: ":utils:create-venv" | ||
vars: | ||
LABEL: "lint" | ||
OUTPUT_DIR: "{{.OUTPUT_DIR}}" | ||
REQUIREMENTS_FILE: "lint-requirements.txt" | ||
# This command must be last | ||
- task: ":utils:compute-checksum" | ||
vars: | ||
DATA_DIR: "{{.OUTPUT_DIR}}" | ||
OUTPUT_FILE: "{{.CHECKSUM_FILE}}" |
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,19 @@ | ||
version: "3" | ||
|
||
includes: | ||
lint: "lint-tasks.yaml" | ||
utils: "tools/yscope-dev-utils/taskfiles/utils.yml" | ||
|
||
vars: | ||
G_BUILD_DIR: "{{.ROOT_DIR}}/target" | ||
|
||
tasks: | ||
clean: | ||
cmds: | ||
- "rm -rf '{{.G_BUILD_DIR}}'" | ||
|
||
init: | ||
internal: true | ||
silent: true | ||
run: "once" | ||
cmds: ["mkdir -p '{{.G_BUILD_DIR}}'"] |
Submodule yscope-dev-utils
added at
159768