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
Copy file name to clipboardExpand all lines: GEMINI.md
+12-11Lines changed: 12 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,18 +12,14 @@ This document outlines the common coding conventions observed in the `easystats`
12
12
13
13
* If pull requests include user-visible changes, the "developer" version number should be increased (e.g. from 0.10.1.5 to 0.10.1.6). This ensures that `easystats::install_latest()` will download the latest versions.
14
14
15
+
* For the NEWS file, the current development version should not be indicated by a version number, but rather with `(devel)`.
16
+
15
17
## Code Style & Formatting
16
18
17
19
***Assignment:** Use the `<-` operator for assignment, not `=`.
18
20
***Spacing:**
19
21
* Use spaces around all infix operators (`<-`, `==`, `+`, etc.).
20
22
* Place a space after a comma, but not before.
21
-
***Curly Braces:**
22
-
* For function definitions, the opening `{` should be on the same line
23
-
as the closing `)` of that function definition. That can be on the
24
-
same line as the function definition itself, but might be on a new
25
-
line if the argument list is too long for one line.
26
-
* For `if`/`else` statements, the opening `{` can be on the same line.
27
23
***Line Length:** Keep lines to a reasonable length (e.g., under 80-100 characters) to improve readability.
28
24
29
25
## Function Naming
@@ -70,8 +66,9 @@ All exported functions must be documented using `roxygen2`-style comments (`#'`)
70
66
71
67
* Use base-R wherever possible (to reduce hard dependencies)
72
68
* Make sure R-version requirements are not too strict
73
-
***Package Functions:** Always use the `::` operator to call functions from other packages (e.g., `stats::shapiro.test`, `insight::model_info`). Do not use `library()` or `require()` at the top of a file (no full import, only selective import of functions).
69
+
***Package Functions:** Always use the `::` operator to call functions from other packages (e.g., `stats::shapiro.test`, `insight::model_info`). Do not use `library()` or `require()` at the top of a file (no full import, only selective import of functions). However, in test files, package vignettes (.rmd), or in the package documentation, `::` is not required for core R packages like `stats` or `tools`.
74
70
***Conditional Checks:** Use `insight::check_if_installed("pkg_name")` to check if a package is available before using it, especially for optional ("Suggests") dependencies.
71
+
***Argument validation:** Use `insight::validate_argument()` instead of `match.arg()` to validate correct input of arguments, unless you need `several.ok`. In this case, rely on `match.arg()`.
75
72
76
73
## S3 Object System
77
74
@@ -83,7 +80,11 @@ All exported functions must be documented using `roxygen2`-style comments (`#'`)
83
80
84
81
* Use `tryCatch` for operations that might fail. The internal `.safe()` helper is a good example.
85
82
* Use the `insight` package's functions for user-facing messages:
86
-
*`insight::format_error()`
87
-
*`insight::format_warning()`
88
-
*`insight::format_alert()`
89
-
*`insight::print_color()`
83
+
* For errors: `insight::format_error()`
84
+
* For warnings: `insight::format_warning()`
85
+
* For messages: `insight::format_alert()`
86
+
* To highlight messages: `insight::print_color()`
87
+
Note that character vectors are not pasted together, unlike in `message()`,
88
+
thus you usually want to use something like `paste()` to concatenate the
89
+
string. Character vectors will add a new paragraph for each string element,
0 commit comments