insightsengineering / insightsengineering/teal
[Feature Request]: Move all methods from `TealAppDriver` to function calls
- Dominant language
- R
- Stars
- 263
- Forks
- 59
- Avg merge
- 5d 17h
- Merged PRs (30d)
- 5
Description
### Feature description
The Methods' body on the `TealAppDriver` class should be defined as internal function calls to trigger all checks in R CMD check.
This would avoid problems such as #1197 and follow the same pattern as `shinytest2::AppDriver` source code.
```r
TealAppDriver <- R6::R6Class( # nolint: object_name.
"TealAppDriver",
inherit = shinytest2::AppDriver,
# public methods ----
public = list(
initialize = function(a, b) {
private$a <- a
private$b <- b
},
foo = function(d, e) {
private$a + self$bar() + d + e
},
bar = function() {
private$b * 2
}
),
private = list(a = 0, b = 0)
)
```
To:
```r
TealAppDriver <- R6::R6Class( # nolint: object_name.
"TealAppDriver",
inherit = shinytest2::AppDriver,
# public methods ----
public = list(
initialize = function(a, b) app_driver_initialize(self, private, a, b),
foo = function(d, e) app_driver_foo(self, private, d ,e),
bar = function() app_driver_bar(self, private)
),
private = list(a = 0, b = 0)
)
# Functions below defined on a different file (either 1 file per function or grouping related functions in a file `TealAppDriver-methods.R`)
app_driver_initialize <- function(self, private, a, b) {
private$a <- a
private$b <- b
}
app_driver_foo <- function(self, private, d, e) {
private$a + self$bar() + d + e
}
app_driver_bar <- function(self, private) {
private$b * 2
}
```
### Code of Conduct
- [X] I agree to follow this project's Code of Conduct.
### Contribution Guidelines
- [X] I agree to follow this project's Contribution Guidelines.
### Security Policy
- [X] I agree to follow this project's Security Policy.
Contributor guide
Assessment
This issue has not been assessed yet.