Inspired by LunarVim contributing guideline.
- Formatter: shfmt.
- Linter: shellcheck.
Install pre-commit which will run all linters and formatters for you as a pre-commit-hook.
All shell code is formatted according to Google Shell Style Guide. Use two spaces instead of tabs.
shfmt -i 2 -ci -bn -l -d .- Use a rebase-workflow.
Name your branches meaningfully.
Real world example:
(feature|bugfix|hotfix)/(issue-number)-what-my-pr-does
- Commit header is limited to 50 characters - source.
- Commit header should answer the "what" question - source.
- Commit body and footer is limited to 72 characters per line - source.
- Commit body should answer the "why" question - source.
Commit header format:
<type>(<scope>?): <summary>
│ │ │
│ │ └─> Present tense. 'add something...'(O) vs 'added something...'(X)
│ │ Imperative mood. 'move cursor to...'(O) vs 'moves cursor to...'(X)
│ │ Not capitalized.
│ │ No period at the end.
│ │
│ └─> Commit Scope is optional, but strongly recommended.
│ Use lower case.
│ 'plugin', 'file', or 'directory' name is suggested, but not limited.
│
└─> Commit Type: build|ci|docs|feat|fix|perf|refactor|test- build: changes that affect the build system or external dependencies (example scopes: npm, pip, rg)
- ci: changes to CI configuration files and scripts (example scopes: format, lint, issue_templates)
- docs: changes to the documentation only
- feat: new feature for the user
- fix: bug fix
- perf: performance improvement
- config: changes to configuration files
- refactor: code change that neither fixes a bug nor adds a feature
- test: adding missing tests or correcting existing tests
- chore: all the rest, including version bump for plugins
Real world examples:
feat(quickfix): add 'q' binding to quit quickfix window when focused
fix(installer): add missing "HOME" variable
Inside a feature branch, the commits must be small and atomic (self-containing and non-broken). Feature working flow should be the following:
- Create WIP commits in possibly arbitrary order, but try to keep them scoped.
- When the feature is finished, reorder commits in a meaningful order starting from the main functionality and adding the supplementary things in separate atomic commits. The first commit must be the one with the main feature + a good description as git providers extract it to prefill {P|M}R information. If necessary, utilize fixup/squash during the interactive rebase.
- Utilize manual
git commit --fixup(git fixupin this dotfiles) or git absorb with interactive rebase + --autosquash to be able to embed requested review changes into the semantically similar commits.