tide/CONTRIBUTING.md

88 lines
2.7 KiB
Markdown
Raw Normal View History

2020-05-31 04:03:41 +03:00
# Contributing
🌊 Thank you for contributing to Tide! 🌊
2020-08-09 04:49:19 +03:00
Please note that this project is released with a [Code of Conduct][]. By contributing to this project you agree to abide by its terms.
2020-05-31 04:03:41 +03:00
2020-08-09 04:49:19 +03:00
If you have any questions that aren't addressed in this document, please don't hesitate to open an issue!
2020-05-31 04:03:41 +03:00
## Code Conventions
2020-05-31 04:03:41 +03:00
### Style Guide
2020-07-23 21:33:51 +03:00
- `test` > `[...]`
2020-07-23 20:57:40 +03:00
- `printf` > `echo`
2021-02-20 04:19:30 +03:00
- `&&`/`||` > `and`/`or`
- Conditionals
- For simple conditionals use `&&`/`||`
- Ex: `test -n "$foo" && echo "foo is not empty"`
2021-03-26 07:27:10 +03:00
- Ex: `foo || bar || baz`
2021-02-20 04:19:30 +03:00
- For anything more complex use `if`, `else`, and `else if`
2020-07-21 00:11:59 +03:00
- Long forms of flags > short forms
2020-07-23 20:57:40 +03:00
- Exceptions: `set`, `set_color`, `function foo -a`, "common knowledge" options for commands like `rm -r`
2020-08-12 20:44:44 +03:00
- Note that MacOS utils often do not support long flags, in which case one should use the short option
2020-07-23 21:33:51 +03:00
- Piping > command substitution (only when convenient, i.e no extra commands)
### Naming Conventions
2021-05-12 23:13:51 +03:00
Everything (variables, files, functions) should be named in `snake_case`, beginning with `tide_`.
Prepend an underscore if the user in not meant to interact directly with it.
- `set -g _tide_left_prompt_height`
- `set -U tide_right_prompt_items`
- `_tide_count_left_prompt_height.fish`
- `_tide_right_prompt`
#### Specific Naming Conventions
- Items begin with `_tide_item_`
- Subcommands begin with `_tide_sub_`
2020-06-16 05:52:37 +03:00
2020-08-09 04:49:19 +03:00
## Testing
### Dependencies
2021-01-27 20:40:33 +03:00
- [Littlecheck][] - Test driver for command line tools
- [Clownfish][] - Override the behavior of commands
2020-08-09 04:49:19 +03:00
Example:
```console
2021-01-27 20:40:33 +03:00
python littlecheck.py ~/tide/tests/**
2020-08-09 04:49:19 +03:00
```
## Linting
2020-08-09 04:49:19 +03:00
Code linting is done via [`fish --no-execute`][].
2021-03-26 07:27:10 +03:00
Markdown and Yaml linting is done via the [Mega-Linter][] action.
## Formatting
2020-08-09 04:49:19 +03:00
Code formatting is done via [`fish_indent`][].
Markdown and Yaml formatting is done via [Prettier][].
2020-08-09 04:49:19 +03:00
## Documentation Conventions
All links should be in the [reference style][], with references at the bottom of the document in alphabetical order.
2020-09-17 01:25:33 +03:00
## Release
2020-08-09 04:49:19 +03:00
2020-09-17 01:25:33 +03:00
Note that Tide does not use strict semantic versioning.
2020-08-09 04:49:19 +03:00
2020-09-17 01:25:33 +03:00
Todo on release:
2020-08-09 04:49:19 +03:00
- [ ] Update version number in install `tide.fish`
- [ ] Make a commit containing above edit, titled with the version number
2021-02-20 04:19:30 +03:00
- [ ] Create a new tag and push it to GitHub
2020-08-09 04:49:19 +03:00
[`fish --no-execute`]: https://fishshell.com/docs/current/cmds/fish.html
[`fish_indent`]: https://fishshell.com/docs/current/cmds/fish_indent.html
[clownfish]: https://github.com/IlanCosman/clownfish
2020-09-07 22:00:54 +03:00
[code of conduct]: CODE_OF_CONDUCT.md
2021-01-27 20:40:33 +03:00
[littlecheck]: https://github.com/ridiculousfish/littlecheck
2021-03-26 07:27:10 +03:00
[mega-linter]: https://github.com/nvuillam/mega-linter
[prettier]: https://github.com/prettier/prettier
2020-08-09 04:49:19 +03:00
[reference style]: https://www.markdownguide.org/basic-syntax/#reference-style-links