Skip to content

Commit 3bf0e7d

Browse files
committed
docs: add content following up to the suggestions of reviewers
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na ---
1 parent 87cbd67 commit 3bf0e7d

File tree

1 file changed

+167
-49
lines changed

1 file changed

+167
-49
lines changed

docs/dev_faqs.md

Lines changed: 167 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -20,58 +20,128 @@ limitations under the License.
2020

2121
# Contributing FAQs
2222

23-
> frequently asked questions by first time contributors of stdlib.
23+
> Frequently Asked Questions (FAQs) by First-Time Contributors to stdlib
24+
25+
- [Introduction](#intro)
26+
- [As a first-time contributor to stdlib, where should I start?](#first-time-contributor)
27+
- [How can I set up my development environment to contribute to stdlib?](#setup-dev-environment)
28+
- [How can I install cppcheck?](#install-cppcheck)
29+
- [I am seeing different return values in the JavaScript and C implementation for the same implementation.](#js-vs-c-return-values)
30+
- [What should I do if Markdown linting on my commits fails because my headings exceed the maximum permissible length?](#markdown-heading-length)
31+
- [I have opened a pull request, where can I seek feedback?](#pr-feedback)
32+
- [I need to generate fixtures for my tests. How can I do that, and what are the best references for inspiration?](#generate-fixtures)
33+
- [I am facing a `Shadowed declaration` linting error in my C files, how can I fix it?](#shadowed-declaration)
34+
- [I am facing a `Uninitialized variable` linting error in my C files, how can I fix it?](#uninitialized-variable)
35+
- [I have the required packages in the expected paths, but I am still encountering an error like this while compiling the native add-on.](#compilation-error)
36+
- [How should I name my pull request?](#pr-naming)
37+
- [How do I call the stdlib bot on my PR?](#stdlib-bot)
38+
- [Frequently used `make` commands](#freq-make-commands)
39+
- [Other Links](#other-links)
2440

2541
<!-- lint disable no-heading-punctuation -->
2642

43+
<a name="intro"></a>
44+
2745
## Introduction
2846

29-
We appreciate your interest in contributing to stdlib! Below, we’ve compiled answers to some frequently asked questions (FAQs) from first-time contributors. If you’re new to the project or encounter any challenges, this guide is a great place to begin.
47+
We appreciate your interest in contributing to stdlib! Below, we’ve compiled answers to some frequently asked questions (FAQs) from first-time contributors. If you’re new to the project or encounter any challenges, this guide is a great place to start.
48+
49+
<a name="first-time-contributor"></a>
50+
51+
## As a first-time contributor to stdlib, where should I start?
52+
53+
We recommend first familiarizing yourself with the stdlib codebase by reading the [contributing][contributing-guide] and [development][development-guide] guides. Once comfortable, you can start by working on a [good first issue][good-first-issues], fixing a bug, or resolving a TODO in the source code.
54+
55+
<a name="setup-dev-environment"></a>
56+
57+
## How can I set up my development environment to contribute to stdlib?
58+
59+
There are primarily two options for setting up your development environment to contribute to stdlib:
60+
61+
1. [Manually setting up the development environment][manual-setup]
62+
2. [Setting up the dev container][devcontainer-setup]
63+
64+
Note: The dev container does not yet support ARM64 architectures. For more information, or if you're interested in adding ARM64 support, you can visit this [issue][devcontainer-issue].
3065

31-
## How can I set up my dev environment to contribute to stdlib?
66+
TODO: Modify the dev container setup link to the exact file link once it is merged.
3267

33-
<!--- TODO add some documentation and links for the docs on devcontainer and manual setup --->
68+
<a name="install-cppcheck"></a>
3469

3570
## How can I install cppcheck?
3671

37-
We use `cppcheck` in our project to perform linting on C/C++ code, to install `cppcheck` as per our project conventions
72+
We use `cppcheck` in our project to perform linting on C/C++ code. To install `cppcheck` according to our project conventions, follow the specified installation step.
3873

3974
```bash
4075
$ make deps-install-cppcheck
4176
```
4277

78+
For more installation commands, visit this [link][install-link].
79+
80+
<a name="js-vs-c-return-values"></a>
81+
4382
## I am seeing different return values in the JavaScript and C implementation for the same implementation.
4483

45-
First, verify that your implementation is actually the same and doesn't contain a bug. Second, check whether your compiler is performing certain optimizations which may affect accuracy. A common optimization is rearranging terms. To check, compile the add-on and disable the optimization. E.g., `CFLAGS="-ffp-contract=on" make install-node-addons NODE_ADDONS_PATTERN="math/base/special/foo"` . Then run the tests. If they succeed, adjust the tolerance and add a note to the C tests indicating that the tolerance is higher relative to the JS implementation due to compiler optimizations. If they fail, raise an issue with maintainers to get feedback.
84+
First, verify that your implementation is truly the same and does not contain any bugs. Second, check whether your compiler is performing optimizations that may affect accuracy. A common optimization is rearranging terms. To check this, compile the add-on while disabling the optimization:
4685

47-
## What can I do if the Markdown linting on my commits is failing due to my headings exceeding the maximum permissible length?
86+
```sh
87+
CFLAGS="-ffp-contract=off" make install-node-addons NODE_ADDONS_PATTERN="math/base/special/foo"
88+
```
4889

49-
Consider whether we can make the heading shorter by renaming variables (e.g., `strideX` to `sx`). Second, disable the lint rule at the top-level. E.g., `<!-- lint disable maximum-heading-length -->`.
90+
Then, run the tests:
91+
92+
```sh
93+
make test TESTS_FILTER=".*/math/base/special/foo/.*"
94+
```
5095

51-
## I have opened a pull request to stdlib, where can I go to seek feedback on it?
96+
If they pass, adjust the tolerance and add a note to the C tests indicating that the tolerance is higher compared to the JavaScript implementation due to compiler optimizations. If they fail, raise an issue with the maintainers to get feedback.
5297

53-
Consider joining our [Gitter channel][stdlib-gitter]! We are very proud to say that we have a very active community where people ask each other for help and others answer each other's questions. One of the maintainers will soon review your pull request and provide feedback. You can also discuss things during our [weekly office hours meeting][stdlib-office-hours]!
98+
- [Reference Discussion][ref-discussion]
99+
- [Reference Comment][ref-comment]
54100

55-
## I need to generate fixtures for my tests. How can I do that, and what are the best references to take inspiration from?
101+
<a name="markdown-heading-length"></a>
102+
103+
## What should I do if Markdown linting on my commits fails because my headings exceed the maximum permissible length?
104+
105+
Consider whether the heading can be shortened by renaming variables (e.g., changing `strideX` to `sx`). If shortening is not possible, disable the lint rule at the top level using:
106+
107+
```markdown
108+
<!-- lint disable maximum-heading-length -->
109+
```
56110

57-
Tests are a very important part of any standard library package. We take our goal of achieving 100% test coverage very seriously, and we expect your work to be backed by tests. Often, you may need to generate fixtures to test your implementation against an existing implementation from a reliable source. You can use Julia, R, Python, etc., to generate fixtures. To get an idea of how we do it, see these reference scripts for generating fixtures: [Example python fixture script][python fixtures], [Example julia fixture script][julia fixtures].
111+
TODO: Can we add a reference PR link?
58112

59-
## I am facing a `Shadowed declaration` linting error in my C files, how to get rid of that?
113+
<a name="pr-feedback"></a>
114+
115+
## I have opened a pull request, where can I seek feedback?
116+
117+
Consider joining our [Gitter channel][stdlib-gitter]! We are proud to have a very active community where members help each other by asking and answering questions. A maintainer will review your pull request soon and provide feedback. You can also discuss it during our [weekly office hours meeting][stdlib-office-hours]!
118+
119+
<a name="generate-fixtures"></a>
120+
121+
## I need to generate fixtures for my tests. How can I do that, and what are the best references for inspiration?
122+
123+
Tests are a crucial part of any standard library package. We take our goal of achieving 100% test coverage very seriously and expect your work to be backed by tests. Often, you may need to generate fixtures to validate your implementation against an existing reliable source. You can use Julia, R, Python, or other languages to generate fixtures. To see how we do this, refer to these example scripts: [Python fixture script][python-fixtures], [Julia fixture script][julia-fixtures].
124+
125+
<a name="shadowed-declaration"></a>
126+
127+
## I am facing a `Shadowed declaration` linting error in my C files, how can I fix it?
60128

61129
```bash
62130
STDLIB_MATH_BASE_NAPI_MODULE_FF_F( stdlib_base_gcdf ) ^
63131
/home/runner/work/stdlib/stdlib/lib/node_modules/@stdlib/math/base/special/gcdf/include/stdlib/math/base/special/gcdf.h:32:7:
64132
note: Shadowed declaration float stdlib_base_gcdf( const float a, const float b );
65133
```
66134

67-
You can suppress that warning by adding a `// cppcheck-suppress shadowFunction` comment over the function, for eg.
135+
You can suppress that warning by adding a `// cppcheck-suppress shadowFunction` comment above the function. For example:
68136

69137
```c
70138
// cppcheck-suppress shadowFunction
71139
STDLIB_MATH_BASE_NAPI_MODULE_FF_F( stdlib_base_gcdf )
72140
```
73141
74-
## I am facing a `Uninitialized variable` linting error in my C files, how to get rid of that?
142+
<a name="uninitialized-variable"></a>
143+
144+
## I am facing a `Uninitialized variable` linting error in my C files, how can I fix it?
75145
76146
```bash
77147
lib/node_modules/@stdlib/stats/base/dmeanvarpn/benchmark/c/benchmark.length.c:112:38: warning: Uninitialized variable: x [uninitvar]
@@ -83,45 +153,25 @@ lib/node_modules/@stdlib/stats/base/dmeanvarpn/benchmark/c/benchmark.length.c:10
83153
lib/node_modules/@stdlib/stats/base/dmeanvarpn/benchmark/c/benchmark.length.c:112:38: note: Uninitialized variable: x
84154
stdlib_strided_dmeanvarpn( len, 1, x, 1, out, 1 );
85155
```
86-
You can suppress that warning by adding a `// cppcheck-suppress uninitvar` comment over the function, for eg.
156+
You can suppress that warning by adding a `// cppcheck-suppress uninitvar` comment above the function. For example:
87157

88158
```c
89159
// cppcheck-suppress uninitvar
90160
stdlib_strided_dmeanvarpn( len, 1, x, 1, out, 1 );
91161
```
92-
## I have the required packages in the expected paths but I'm still facing an error like this while compiling the native addon.
162+
163+
<a name="compilation-error"></a>
164+
165+
## I have the required packages in the expected paths, but I am still encountering an error like this while compiling the native add-on.
93166
94167
![image](https://github.com/user-attachments/assets/6cb40866-c33b-4878-ab20-126472a56b63)
95168
96-
In packages revolving around C implementations, you need to have a `manifest.json` file which tells [node-gyp][node-gyp] what dependencies to include for specific tasks. you need to include only the required dependencies for compiling, benchmarking and running examples for eg:
169+
In packages involving C implementations, you need a `manifest.json` file to inform [node-gyp][node-gyp] about the dependencies required for specific tasks. You should include only the necessary dependencies for compiling, benchmarking, and running examples. For example:
97170
98171
```json
99172
{
100-
"options": {
101-
"task": "build"
102-
},
103-
"fields": [
104-
{
105-
"field": "src",
106-
"resolve": true,
107-
"relative": true
108-
},
109-
{
110-
"field": "include",
111-
"resolve": true,
112-
"relative": true
113-
},
114-
{
115-
"field": "libraries",
116-
"resolve": false,
117-
"relative": false
118-
},
119-
{
120-
"field": "libpath",
121-
"resolve": true,
122-
"relative": false
123-
}
124-
],
173+
// Other sections above....
174+
125175
"confs": [
126176
{
127177
"task": "build",
@@ -173,11 +223,32 @@ In packages revolving around C implementations, you need to have a `manifest.jso
173223
}
174224
```
175225

176-
This config specifies that we need to include `@stdlib/math/base/napi/unary`, `@stdlib/math/base/assert/is-nanf`, `@stdlib/constants/float32/pinf` for compiling the native addon and `@stdlib/math/base/assert/is-nanf`, `@stdlib/constants/float32/pinf` for running benchmarks and examples
226+
This `config` specifies that we need to include `@stdlib/math/base/napi/unary`, `@stdlib/math/base/assert/is-nanf`, and `@stdlib/constants/float32/pinf` for compiling the native add-on, while `@stdlib/math/base/assert/is-nanf` and `@stdlib/constants/float32/pinf` are required for running benchmarks and examples.
227+
228+
<a name="pr-naming"></a>
229+
230+
## How should I name my pull request?
231+
232+
The best strategy is to go through other relevant PRs and follow their naming conventions. If not, use a concise and descriptive title that clearly conveys the purpose of your changes and follows the PR naming guidelines.
233+
234+
TODO: Can we add a link to the PR naming guidelines here?
235+
236+
<a name="stdlib-bot"></a>
237+
238+
## How do I call the stdlib bot on my PR?
239+
240+
Once you have created your PR, you can call the **stdlib-bot** to perform basic operations such as fixing lint errors, updating copyright years, or merging changes from the `develop` branch into your PR. Some commonly used commands:
241+
242+
- `/stdlib update-copyright-years` - Updates copyright header years.
243+
- `/stdlib lint-autofix` - Auto-fixes lint errors.
244+
245+
To see other available bot commands, comment `/stdlib help` on your PR.
246+
247+
<a name="freq-make-commands"></a>
177248

178249
## Frequently used `make` commands
179250

180-
We use [`GNU Make`][make] as our development utility and task runner for things like generating fixtures, compiling native addons, running tests, examples, benchmarks etc. Some of the most frequently used make commands which you will need in your workflow are:
251+
We use [`GNU Make`][make] as our development utility and task runner for tasks such as generating fixtures, compiling native add-ons, running tests, examples, and benchmarks. Some of the most frequently used `make` commands that you will need in your workflow are:
181252

182253
### 1. Install all dependencies
183254

@@ -197,12 +268,20 @@ $ make init
197268
$ make install-node-addons NODE_ADDONS_PATTERN="math/base/special/abs"
198269
```
199270

200-
### 4. Generate Julia Fixtures
271+
### 4. Generate Test Fixtures
201272

273+
- **Julia**
202274
```bash
203275
$ make test-fixtures-julia TESTS_FIXTURES_FILTER=".*/path/to/package/.*"
204276
```
205277

278+
- **Python**
279+
```bash
280+
$ make test-fixtures-python TESTS_FIXTURES_FILTER=".*/path/to/package/.*"
281+
```
282+
283+
For more `make` commands, refer to the test fixtures [documentation][test-fixtures].
284+
206285
### 5. Run the tests
207286

208287
```bash
@@ -215,12 +294,23 @@ $ make TESTS_FILTER=".*/math/base/special/abs/.*" test
215294
$ make EXAMPLES_FILTER=".*/math/base/special/abs/.*" examples
216295
```
217296

297+
For more `make` commands, refer to the [documentation][examples] on running examples.
298+
218299
### 7. Run benchmarks
219300

220301
```bash
221302
$ make BENCHMARKS_FILTER=".*/math/base/special/abs/.*" benchmark
222303
```
223304

305+
For more `make` commands, refer to the [documentation][benchmark] on running benchmarks.
306+
307+
<a name="other-links"></a>
308+
309+
## Other Links:
310+
311+
- [Style Guide][style-guide]
312+
- [Other make commands][make-commands]
313+
224314
<section class="links">
225315

226316
[git]: http://git-scm.com/
@@ -231,17 +321,45 @@ $ make BENCHMARKS_FILTER=".*/math/base/special/abs/.*" benchmark
231321

232322
[github-fork]: https://help.github.com/articles/fork-a-repo/
233323

234-
[python fixtures]: https://github.com/stdlib-js/stdlib/blob/develop/lib/node_modules/%40stdlib/math/base/special/hyp2f1/test/fixtures/python/runner.py
324+
[development-guide]: https://github.com/stdlib-js/stdlib/blob/develop/docs/contributing/development.md
325+
326+
[contributing-guide]: https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md
327+
328+
[good-first-issues]: https://github.com/stdlib-js/stdlib/issues?q=is%3Aissue%20state%3Aopen%20label%3A%22Good%20First%20Issue%22
329+
330+
[manual-setup]: https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md#step-0-github
331+
332+
[devcontainer-setup]: https://github.com/stdlib-js/stdlib/blob/87cbd67623892f90ddeea94e1d4e01eeada417b5/docs/devcontainer_setup.md
333+
334+
[devcontainer-issue]: https://github.com/stdlib-js/stdlib/issues/4934
335+
336+
[install-link]: https://github.com/stdlib-js/stdlib/tree/develop/tools/make/lib/install#install
235337

236-
[julia fixtures]: https://github.com/stdlib-js/stdlib/blob/develop/lib/node_modules/%40stdlib/math/base/special/acosdf/test/fixtures/julia/runner.jl
338+
[ref-discussion]: https://github.com/stdlib-js/stdlib/pull/2298#discussion_r1624765205
339+
340+
[ref-comment]: https://github.com/stdlib-js/stdlib/blob/1f9cb760e3345cc7e08320a11f6a051873ef3586/lib/node_modules/%40stdlib/math/base/special/spence/test/test.native.js#L90
341+
342+
[python-fixtures]: https://github.com/stdlib-js/stdlib/blob/develop/lib/node_modules/%40stdlib/math/base/special/hyp2f1/test/fixtures/python/runner.py
343+
344+
[julia-fixtures]: https://github.com/stdlib-js/stdlib/blob/develop/lib/node_modules/%40stdlib/math/base/special/acosdf/test/fixtures/julia/runner.jl
345+
346+
[test-fixtures]: https://github.com/stdlib-js/stdlib/tree/develop/tools/make/lib/test-fixtures
347+
348+
[examples]: https://github.com/stdlib-js/stdlib/tree/develop/tools/make/lib/examples
349+
350+
[benchmark]: https://github.com/stdlib-js/stdlib/tree/develop/tools/make/lib/benchmark
237351

238352
[make]: https://www.gnu.org/software/make/
239353

240354
[node-gyp]: https://github.com/nodejs/node-gyp
241355

242356
[stdlib-gitter]: https://app.gitter.im/#/room/#stdlib-js_stdlib:gitter.im
243357

244-
[stdlib-office-hours]: https://github.com/stdlib-js/meetings
358+
[stdlib-office-hours]: https://github.com/stdlib-js/meetings/issues
359+
360+
[style-guide]: https://github.com/stdlib-js/stdlib/tree/develop/docs/style-guides
361+
362+
[make-commands]: https://github.com/stdlib-js/stdlib/tree/develop/tools/make/lib
245363

246364
</section>
247365

0 commit comments

Comments
 (0)