@@ -72,6 +72,40 @@ Here's a quick checklist to follow when coding to ensure a good pull request
72
72
issues before submitting your pull request.
73
73
- Keep commit messages clean and descriptive.
74
74
75
+ ### Use git pre-commit hook
76
+
77
+ Setting up a git pre-commit hook can be helpful to ensure your code changes follow
78
+ the project style conventions before pushing and creating a pull request.
79
+
80
+ To configure the pre-commit hook, navigate to your local clone/fork of the
81
+ ` server-client-python ` project and change into the ` .git/hooks ` directory.
82
+ Create a file ` pre-commit ` with the contents below and mark it as executable
83
+ (` chmod +x pre-commit ` ).
84
+
85
+ To test that the hook is working correctly, make a style-inconsistent change (for
86
+ example, changing some indentation to not be a multiple of 4), then try to commit
87
+ locally. You should get a failure with an explanation from pycodestyle with the
88
+ issue.
89
+
90
+ ``` shell
91
+ #! /bin/sh
92
+
93
+ # only check if on a code branch (i.e. skip if on a docs branch)
94
+ if [ -e tableauserverclient/__init__.py ];
95
+ then
96
+ # check for style conventions in all code dirs
97
+ echo Running pycodestyle
98
+ pycodestyle tableauserverclient test samples
99
+ fi
100
+ ```
101
+
102
+ Windows users: The first line of the sample script above will need to be adjusted
103
+ depending on how and where git is installed on your system, for example:
104
+
105
+ ``` shell
106
+ #! C:/Program\ Files/Git/usr/bin/sh.exe
107
+ ```
108
+
75
109
### Adding features
76
110
77
111
1 . Create an endpoint class for the new feature, following the structure of the
0 commit comments