Skip to content

Commit cab30a3

Browse files
MaxymVlasovHaruhiist
authored andcommitted
Add documentation about availble hooks settings and fix misspellings
Issue: #13
1 parent 6f663d7 commit cab30a3

File tree

2 files changed

+41
-8
lines changed

2 files changed

+41
-8
lines changed

README.md

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ cd tests
4242
git clone [email protected]:pdffiller/styleguide-hooks.git
4343
```
4444

45-
#### 2. Setup it as your [template directory](https://git-scm.com/docs/git-init#_template_directory)
45+
#### 2. Set it up as your [template directory](https://git-scm.com/docs/git-init#_template_directory)
4646

4747
```bash
4848
git config --global init.templatedir $(pwd)/styleguide-hooks
@@ -56,16 +56,49 @@ You may ignore the remainder **nevertheless it's better to follow the next steps
5656
git config --global core.hooksPath $(pwd)/styleguide-hooks/hooks
5757
```
5858

59-
Via post-checkout hook you create/recreate the symlink to your hooks directory after every `git clone` of `git checkout`. [Documentation](https://git-scm.com/docs/githooks#_post_checkout).
59+
After every `git clone` and `git checkout` the post-checkout hook will create or recreate symlink to your hooks directory. [Documentation](https://git-scm.com/docs/githooks#_post_checkout).
6060

61-
#### 4. If need - change default configuration
61+
#### 4. Change default configuration if needed
6262

63-
1. Looks on `hooks/_default_settings.sh`<br>
64-
If you'd like change something:
63+
1. Look into `hooks/_default_settings.sh`<br>
64+
If you'd like to change something:
6565
2. Create `hooks/_user_defined_settings.sh`
6666
3. Copy settings for change from `default` to `user_defined`
6767
4. Change settings in `hooks/_user_defined_settings.sh`
6868

69+
##### Availble settings
70+
71+
| Constant | What it changes | Default | Affects |
72+
| ---------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------| ------------------------------------- |
73+
| `COLOR_INFO` | Change default output color for Information messages.<br>[Available colors](https://github.com/pdffiller/styleguide-hooks/blob/stable/hooks/color_echo.sh). | `"Light_Blue"` | `pre-commit` |
74+
| `COLOR_WARNING` | Change default output color for Warning/<br>Interaction needed messages. [Available colors](https://github.com/pdffiller/styleguide-hooks/blob/stable/hooks/color_echo.sh). | `"Yellow"` | `pre-commit` |
75+
| `IGNORE_TRAILING_`<br>`SPACE_EXTENTIONS` | Ignore trailing whitespaces for specified file extentions. Format `ext1\|ext2\|ext3`. | `"md\|rst"` | `pre-commit` |
76+
| `INTERACTIVE_MODE` | Pseudo-interactive mode for:<br>1. Replacing trailing whitespaces<br>2. Removing multilines at EOF<br>3. Adding new line at EOF if it doesn't exist<br>Can be `disabled` or `enabled`. | `"disabled"` | `pre-commit` |
77+
| `FOOTER` | Styleguide message that is added to every error message. | [[1]](#long-defaults) | `pre-commit` |
78+
| `GITHUB_REGEX` | Regex for matching Github issue inside branch name. A link to issue is created if a match was found. | `'^[0-9]+$'` | `pre-commit`,<br>`prepare-commit-msg` |
79+
| `JIRA_ISSUE_LINK` | Link to Jira task endpoint. | [[2]](#long-defaults) | `prepare-commit-msg` |
80+
| `JIRA_REGEX` | Regex for matching Jira issue inside branch name. A link to issue is created if a match was found.<br>[Default Jira regex](https://tinyurl.com/yd48c5op). | `'^[A-Z]{2,}-[0-9]+'` | `pre-commit`,<br>`prepare-commit-msg` |
81+
| `STYLE_GUIDE_LINK` | Commit message styleguide format link. | [[3]](#long-defaults) | `prepare-commit-msg` |
82+
83+
###### Long defaults
84+
85+
```bash
86+
FOOTER="\n
87+
Our style guide can be found at:
88+
https://github.com/pdffiller/styleguide-hooks#branch-naming-format
89+
90+
A quick way to rename your branch:
91+
git branch -m NEW_BRANCH_NAME
92+
"
93+
94+
declare -A JIRA_ISSUE_LINK=(
95+
["org_name_in_github"]="https://org_name_in_jira.atlassian.net/browse"
96+
["org_name2_in_github"]="https://org_name2_in_jira.atlassian.net/browse"
97+
)
98+
99+
STYLE_GUIDE_LINK="https://github.com/pdffiller/styleguide-hooks#commit-message-format"
100+
```
101+
69102
#### 5. Make it always up-to-date
70103

71104
TODO: You can [add to cron and setup post-update hook](https://habr.com/post/329804/).
@@ -220,7 +253,7 @@ Go to repo Settings.
220253

221254
### Options - Data services
222255

223-
If private repo - enable Vulnerability alerts. In public it enable by default.
256+
Enable Vulnerability alerts if the repo is private. In public repos it is enabled by default.
224257

225258
![Enabled Data Services](images/github_data_services.png)
226259

@@ -234,7 +267,7 @@ Allow only Rebase
234267

235268
WIP check can be found [here](https://github.com/marketplace/wip).
236269

237-
Also, you can enable WIP check protection (or any other) only after create first pull request.
270+
Also, you can enable WIP check protection (or any other) only after creating your first pull request.
238271

239272
![Protection rules](images/github_branch_protection.png)
240273

hooks/_default_settings.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ FOOTER="\n
1212
Our style guide can be found at:
1313
https://github.com/pdffiller/styleguide-hooks#branch-naming-format
1414
15-
Quickly rename branch:
15+
A quick way to rename your branch:
1616
git branch -m NEW_BRANCH_NAME
1717
"
1818

0 commit comments

Comments
 (0)