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
We use [pre-commit](https://pre-commit.com) hooks to ensure code quality. Specifically, we use:
94
+
*[air](https://github.com/posit-dev/air) to format R code,
95
+
*[jarl](https://github.com/etiennebacher/jarl) to lint R code, and
96
+
*[clang-format](https://clang.llvm.org/docs/ClangFormat.html) to format C/C++ code.
97
+
98
+
To install the hooks, run:
99
+
100
+
```
101
+
pre-commit install
102
+
```
103
+
104
+
### tskit
105
+
89
106
If you plan to update `tskit`, follow instructions in `extern/README.md`.
90
107
91
-
Then open `RcppTskit` package directory in your favourite R IDE (Positron, RStudio, text-editor-of-your-choice, etc.), implement your changes and run (in R):
108
+
### RcppTskit
109
+
110
+
Then open `RcppTskit` package directory in your favourite R IDE (Positron, RStudio, text-editor-of-your-choice, etc.) and implement your changes.
111
+
112
+
You should routinely check the status of the package (in R):
92
113
93
114
```
94
115
# Note that the RcppTskit R package is in the RcppTskit sub-directory
95
116
setwd("path/to/RcppTskit/RcppTskit")
96
117
97
-
# Run checks of your changes, documentation, etc.
118
+
# Run checks of your changes, documentation, tests, etc.
98
119
devtools::check()
99
120
100
121
# Install the package
101
122
devtools::install()
123
+
124
+
# Run just tests
125
+
devtools::test()
126
+
127
+
# Check code test coverage
128
+
cov <- covr::package_coverage(clean = TRUE)
129
+
covr::report(cov)
102
130
```
103
131
104
-
Alternatively you can check and install from command line:
132
+
Alternatively you can check from the command line:
105
133
106
134
```
107
135
# Note that the RcppTskit package is in the RcppTskit sub-directory
108
-
cd path/to/RcppTskit
136
+
cd path/to/RcppTskit/RcppTskit
109
137
110
-
# Run checks of your changes, documentation, etc.
138
+
# Run checks of your changes, documentation, tests, etc.
111
139
R CMD build RcppTskit
112
140
R CMD check RcppTskit_*.tar.gz
113
141
@@ -116,3 +144,19 @@ R CMD INSTALL RcppTskit_*.tar.gz
116
144
```
117
145
118
146
On Windows, replace `tar.gz` with `zip`.
147
+
148
+
### Pre-commit run
149
+
150
+
Before committing your changes, run the pre-commit hooks to ensure code quality:
151
+
152
+
```
153
+
# pre-commit autoupdate # to update the hooks
154
+
pre-commit run --all-files
155
+
# pre-commit run <hook_id>
156
+
```
157
+
158
+
### Continuous integration
159
+
160
+
We use Github Actions to run continuous integration (CI) checks on each push and pull request. Specifically, we run:
161
+
*[R CMD check](.github/workflows/R-CMD-check.yaml) on Linux, macOS, and Windows and
162
+
*[covr test coverage](.github/workflows/covr.yaml).
0 commit comments