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
- Prefer expressive code over comments where possible
55
56
- Add comments to utility functions that cannot be made immediately obvious
56
57
- Focus comments on explaining the "why" and "how", the "what" should be clear from the code itself
57
-
- Use line breaks after each sentence in multi-sentence comments
58
+
- Use line breaks after each sentence
58
59
59
60
### R Code Conventions
60
61
61
-
- Follow the [tidyverse style guide](https://style.tidyverse.org)
62
+
- Follow the [tidyverse style guide](https://style.tidyverse.org) and the [tidyverse design guide](https://design.tidyverse.org)
62
63
- Use `snake_case` for new functions
63
64
- Use explicit package prefixes (e.g., `withr::local_db_connection()`) for clarity
64
65
- Maintain consistent indentation (2 spaces) and spacing patterns
65
66
- Use meaningful variable names that reflect context
66
67
- Run `air format .` before committing changes to ensure consistent formatting
68
+
- Never change deprecated functions
67
69
68
70
### Documentation
69
71
70
72
- Use roxygen2 with Markdown syntax for all function documentation
71
73
- Use math notation for formulas: `\eqn{...}` for inline, `\deqn{...}` for display equations
72
74
- Keep each sentence on its own line in roxygen2 comments for better readability
75
+
- Document all arguments and return values
73
76
- Document internal functions using devtag (work in progress)
74
77
- Link to C documentation using `@cdocs` tag: `#' @cdocs igraph_function_name`
75
78
- Always run `devtools::document()` after updating documentation
@@ -84,7 +87,7 @@ All new functions must include:
84
87
85
88
- Examples
86
89
- Tests
87
-
- Proper documentation
90
+
- Proper documentation, including arguments and return values
88
91
- A concept so that it exists in the pkgdown reference index
89
92
- An "experimental" badge via `r lifecycle::badge("experimental")`
90
93
@@ -118,4 +121,7 @@ These are build artifacts that are regenerated automatically (see `src/README.md
118
121
- Add test cases for all new functionality
119
122
- For newly created autogenerated functions, always add a test to `test-aaa-auto.R`
120
123
- Test file naming should mirror source file naming
124
+
- Implement both structured and snapshot tests. For the latter, ensure stability by setting a random seed and calling `local_igraph_options(print.id = FALSE)` if graph IDs are involved.
125
+
- When testing error behavior, prefer snapshot tests.
121
126
- Run tests frequently during development and at the end: `testthat::test_local(reporter = "check")`
127
+
- Run `devtools::check()` as a final step to ensure all checks pass.
0 commit comments