You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Refer `pyproject.toml` and `.flake8` config files for current configurations.
22
27
23
-
Run before each commit: `black .`
28
+
Please run these three tools before each commit. Although, you may choose to
29
+
do so manually, but it is much easier and preferable to automate these checks.
30
+
Refer your IDE docs to set them up in your IDE, or you can set up `pre-commit`
31
+
to add git hooks.
32
+
33
+
### Setting up pre-commit
34
+
35
+
A `.pre-commit-config.yaml` is included to run various check before you
36
+
commit your code. Here are the steps to setup `pre-commit` in your workflow:
37
+
38
+
- Install `pre-commit`: `pip install pre-commit`
39
+
- Install the git hook scripts: `pre-commit install`
40
+
41
+
That should be it!
24
42
25
43
### C/C++ File Headers
26
44
@@ -61,8 +79,9 @@ Few things to note about this format:
61
79
- The copyright year should be updated every calendar year.
62
80
- Each comment line should be a max of 80 chars.
63
81
- A Doxygen `\file` tag describing the contents of the file must be provided.
64
-
Also note that the `\file` tag is inside a Doxygen comment block (defined by `///`
65
-
comment marker instead of the `//` comment marker used in the rest of the header.
82
+
Also note that the `\file` tag is inside a Doxygen comment block (
83
+
defined by `///` comment marker instead of the `//` comment marker used in the
84
+
rest of the header.
66
85
67
86
### Python File Headers
68
87
@@ -91,7 +110,8 @@ The copyright year should be updated every calendar year.
91
110
92
111
### Bandit
93
112
94
-
We use [Bandit](https://github.com/PyCQA/bandit) to find common security issues in Python code.
113
+
We use [Bandit](https://github.com/PyCQA/bandit) to find common security issues
114
+
in Python code.
95
115
96
116
Install: `pip install bandit`
97
117
@@ -101,18 +121,21 @@ Run before each commit: `bandit -r dpctl -lll`
101
121
102
122
## Code Coverage
103
123
104
-
Implement python, cython and c++ file coverage using `coverage` and `llvm-cov` packages on Linux.
124
+
Implement python, cython and c++ file coverage using `coverage` and `llvm-cov`
125
+
packages on Linux.
105
126
106
127
### Using Code Coverage
107
128
108
-
You need to install additional packages and add an environment variable to cover:
129
+
You need to install additional packages and add an environment variable to
130
+
cover:
109
131
- conda install cmake
110
132
- conda install coverage
111
133
- conda install conda-forge::lcov
112
134
- conda install conda-forge::gtest
113
135
- export CODE_COVERAGE=ON
114
136
115
-
CODE_COVERAGE allows you to build a debug version of dpctl and enable string tracing, which allows you to analyze strings to create a coverage report.
137
+
CODE_COVERAGE allows you to build a debug version of dpctl and enable string
138
+
tracing, which allows you to analyze strings to create a coverage report.
116
139
It was added for the convenience of configuring the CI in the future.
117
140
118
141
Installing the dpctl package:
@@ -121,34 +144,41 @@ Installing the dpctl package:
121
144
It is important that there are no files of the old build in the folder.
122
145
Use `git clean -xdf` to clean up the working tree.
123
146
124
-
The coverage report will appear during the build in the console. This report contains information about c++ file coverage.
125
-
The `dpctl-c-api-coverage` folder will appear in the root folder after installation.
126
-
The folder contains a report on the coverage of c++ files in html format.
147
+
The coverage report will appear during the build in the console. This report
148
+
contains information about c++ file coverage.
149
+
The `dpctl-c-api-coverage` folder will appear in the root folder after
150
+
installation. The folder contains a report on the coverage of c++ files in html
151
+
format.
127
152
128
153
You need to run tests to cover the cython and python files:
129
154
- coverage run -m unittest dpctl.tests
130
155
131
-
The required flags for the command coverage run are contained in the file `.coveragerc`.
156
+
The required flags for the command coverage run are contained in the file
157
+
`.coveragerc`.
132
158
133
159
The simplest reporting is a textual summary produced with report:
134
160
- coverage report
135
161
136
-
For each module executed, the report shows the count of executable statements, the number of those statements missed, and the resulting coverage, expressed as a percentage.
162
+
For each module executed, the report shows the count of executable statements,
163
+
the number of those statements missed, and the resulting coverage, expressed as
164
+
a percentage.
137
165
138
166
The `-m` flag also shows the line numbers of missing statements:
139
167
- coverage report -m
140
168
141
169
To create an annotated HTML listings with coverage results:
142
170
- coverage html
143
171
144
-
The `htmlcov` folder will appear in the root folder of the project. It contains reports on the coverage of python and cython files in html format.
172
+
The `htmlcov` folder will appear in the root folder of the project. It contains
173
+
reports on the coverage of python and cython files in html format.
145
174
146
175
Erase previously collected coverage data:
147
176
- coverage erase
148
177
149
178
### Error in the build process
150
179
151
-
An error occurs during the dcptl build with the CODE_COVERAGE environment variable:
180
+
An error occurs during the dcptl build with the CODE_COVERAGE environment
181
+
variable:
152
182
```
153
183
error: '../compat/unistd.h' file not found, did you mean 'compat/unistd.h'?
0 commit comments