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

Style guide: improved spelling and wording #1495

Merged
merged 1 commit into from
Feb 22, 2024
Merged
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
50 changes: 26 additions & 24 deletions docs/docs/styleguide.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,28 @@ slug: /styleguide/
sidebar_position: 10
---

# Styleguide
# Style guide

This is the official Task styleguide for `Taskfile.yml` files. This guide
contains some basic instructions to keep your Taskfile clean and familiar to
other users.
This is the official style guide for `Taskfile.yml` files. It provides basic
instructions for keeping your Taskfiles clean and familiar to other users.

This contains general guidelines, but they don't necessarily need to be strictly
followed. Feel free to disagree and proceed differently at some point if you
need or want to. Also, feel free to open issues or pull requests with
improvements to this guide.
This guide contains general guidelines, but they do not necessarily need to be
followed strictly. Feel free to disagree and do things differently if you need
or want to. Any improvements to this guide are welcome! Please open an issue or
create a pull request to contribute.

## Use the correct order of keywords
## Use the suggested ordering of the main sections

- `version:`
- `includes:`
- Configuration ones, like `output:`, `silent:`, `method:` and `run:`
- `vars:`
- `env:`, `dotenv:`
- `tasks:`
```yaml
version:
includes:
# optional configurations (output, silent, method, run, etc.)
vars:
env: # followed or replaced by dotenv
tasks:
```

## Use 2 spaces for indentation
## Use two spaces for indentation

This is the most common convention for YAML files, and Task follows it.

Expand All @@ -42,7 +43,7 @@ tasks:
- echo 'foo'
```

## Separate with spaces the mains sections
## Separate the main sections with empty lines

```yaml
# bad
Expand Down Expand Up @@ -76,7 +77,7 @@ tasks:
# ...
```

## Add spaces between tasks
## Separate tasks with empty lines

```yaml
# bad
Expand Down Expand Up @@ -111,7 +112,7 @@ tasks:
- echo 'baz'
```

## Use upper-case variable names
## Use only uppercase letters for variable names

```yaml
# bad
Expand All @@ -138,7 +139,7 @@ tasks:
- go build -o {{.BINARY_NAME}} .
```

## Don't wrap vars in spaces when templating
## Avoid using whitespace when templating variables

```yaml
# bad
Expand All @@ -159,9 +160,10 @@ tasks:
- echo '{{.MESSAGE}}'
```

This convention is also used by most people for any Go templating.
This convention is also commonly used in templates for the Go programming
language.

## Separate task name words with a dash
## Use kebab case for task names

```yaml
# bad
Expand All @@ -182,7 +184,7 @@ tasks:
- echo 'Do something'
```

## Use colon for task namespacing
## Use a colon to separate the task namespace and name

```yaml
# good
Expand All @@ -200,7 +202,7 @@ tasks:

This is also done automatically when using included Taskfiles.

## Prefer external scripts over complex multi-line commands
## Prefer using external scripts instead of multi-line commands

```yaml
# bad
Expand Down
Loading