Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tasks to perform linting including checking YAML files. #13

Merged
merged 1 commit into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,29 @@ To clean the build:
task clean
```

# Development
# Contributing
Follow the steps below to develop and contribute to the project.

## Set up
Before opening the project in an IDE, you'll first need to download and install [emscripten]:
```shell
task emscripten
```

## Linting
Before submitting a pull request, ensure you’ve run the linting commands below and either fixed any
violations or suppressed the warning.

To run all linting checks:
```shell
task lint:check
```

To run all linting checks AND automatically fix any fixable issues:
```shell
task lint:fix
```

[bug-report]: https://github.com/y-scope/clp-ffi-js/issues/new?labels=bug&template=bug-report.yml
[CLP]: https://github.com/y-scope/clp
[emscripten]: https://emscripten.org
Expand Down
1 change: 1 addition & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
version: "3"

includes:
lint: "lint-tasks.yml"
utils: "tools/yscope-dev-utils/taskfiles/utils.yml"

vars:
Expand Down
1 change: 1 addition & 0 deletions lint-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
yamllint>=1.35.1
56 changes: 56 additions & 0 deletions lint-tasks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
version: "3"

vars:
G_LINT_VENV_DIR: "{{.G_BUILD_DIR}}/lint-venv"

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 "{{.ROOT_DIR}}/tools/yscope-dev-utils/lint-configs/.yamllint.yml" \
--strict \
.github \
lint-tasks.yml \
Taskfile.yml

venv:
internal: true
vars:
CHECKSUM_FILE: "{{.G_BUILD_DIR}}/{{.TASK | replace \":\" \"#\"}}.md5"
OUTPUT_DIR: "{{.G_LINT_VENV_DIR}}"
sources:
- "{{.ROOT_DIR}}/Taskfile.yml"
- "{{.TASKFILE}}"
- "lint-requirements.txt"
generates: ["{{.CHECKSUM_FILE}}"]
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}}"