Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (15.0%) to scientific vocabulary
Last synced: 11 months ago
·
JSON representation
Repository
CBTF: A minimalistic fuzz-test runner for R
Basic Info
- Host: GitHub
- Owner: mcol
- License: gpl-3.0
- Language: R
- Default Branch: main
- Homepage: https://mcol.github.io/caught-by-the-fuzz/
- Size: 1.95 MB
Statistics
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 2
- Releases: 5
Created over 1 year ago
· Last pushed 11 months ago
Metadata Files
Readme
Changelog
License
README.Rmd
--- output: github_document --- # CBTF: Caught by the Fuzz! A minimalistic fuzz-test runner for R[](https://CRAN.R-project.org/package=CBTF) [](https://lifecycle.r-lib.org/articles/stages.html#experimental) The `CBTF` package implements a very simple mechanism for fuzz-testing functions in the public interface of an R package. Fuzz testing helps identify functions lacking sufficient argument validation, and uncovers sets of inputs that, while valid by function signature, may cause issues within the function body. The core functionality of the package is in the `fuzz()` function, which calls each provided function with a certain input and records the output produced. If an error or a warning is generated, this is captured and reported to the user, unless it matches a pattern of whitelisted messages, as specified in the `ignore_patterns` argument. The objects returned by `fuzz()` can be inspected with `summary()` and `print()`. Whitelisting can also be done after a fuzz run has been completed via the `whitelist()` function, so that only messages that need to be acted upon are actually shown. Using `whitelist()` has the advantage of not requiring the completion of a fuzz run of all functions over all inputs again. The helper function `get_exported_functions()` identifies the functions in the public interface of a given package, facilitating the generation of the list of functions to be fuzzed. The helper function `test_inputs()` is invoked by `fuzz()` if the user doesn't specify the set of inputs to be tested. By default it generates a large set of potentially problematic inputs, but these can be limited just to the desired classes of inputs. The helper function `namify()` can be used to generate automatically pretty names in the list of input object, which can improve the output, especially when structures such as data frames, matrices, and more complex objects are involved. These names are based on the deparsed representation of the unevaluated inputs. At the moment the functionality of the package is extremely limited: it operates only on the first argument and it doesn't introduce any randomness. However, it's convenient when there are a large number of functions to test. ## Usage ```{r, echo = FALSE} ## don't print the progess messages, as `\r` is badly supported here withr::local_envvar(c(R_CLI_DYNAMIC="FALSE")) ``` This is a simple example that displays how to use `CBTF` to fuzz an R package. We consider `mime` because it is small enough to run quickly and is likely installed on most systems. ```{r} library(CBTF) funs <- get_exported_functions("mime") (res <- fuzz(funs, what = list(TRUE))) ``` The first occurrence is a false positive, as the message returned indicates that the input was checked and the function returned cleanly. The second case instead reveals that the function didn't validate its input: indeed, it expected an environment, and used the `$` operation on it without checking. The false positive result can be easily removed by whitelisting an appropriate pattern: ```{r} whitelist(res, "a character vector argument expected") ``` ## Advanced uses ### Better-looking output When the inputs contains complex structures, it is better to provide a named list to the `what` argument of `fuzz()`: these names will be used instead of relying on deparsing of the input, which may be poor. A convenient way of generating names is by using the `namify()` helper function. For example, compare this: ```{r} fuzz(funs, what = list(letters, data.frame(a = 1, b = "a"))) ``` to this: ```{r} fuzz(funs, what = namify(letters, data.frame(a = 1, b = "a"))) ``` ### Controlling the inputs tested By default, `fuzz()` tests all the inputs produced by `test_inputs()`. However, this can be controlled by specifying the classes that should be tested: ```{r, results = "hide"} test_inputs(use = c("scalar", "numeric", "integer", "matrix")) ``` Alternatively, one can specify the classes to be excluded: ```{r, results = "hide"} test_inputs(skip = c("date", "raw")) ``` A vector of valid classes can be retrieved programmatically by setting this argument to "help": ```{r} test_inputs("help") ``` ### Fuzzing list inputs automatically It is trivial to augment a given set of inputs with list versions of the same. This effectively doubles the number of tests run with no additional coding effort. ```{r} fuzz(funs, what = namify(letters), listify_what = TRUE) ``` ### Fuzzing for arguments other than the first At the moment, the only way to fuzz an argument other than the first is by currying the function, ensuring that the preceding arguments before are filled in. For example, to fuzz the `nrow` argument of `matrix()`, we could do the following: ```{r} curried.matrix <- function(nrow) matrix(1:10, nrow = nrow) fuzz("curried.matrix", what = list(NA, NULL)) ``` ## Funding Development of `CBTF` is partially supported through the DFG programme "REPLAY: REProducible Luminescence Data AnalYses" [No 528704761](https://gepris.dfg.de/gepris/projekt/528704761?language=en) led by Dr Sebastian Kreutzer (PI at Heidelberg University, DE) and Dr Thomas Kolb (PI at Justus-Liebig-University Giessen, DE). Updates on the REPLAY project at large are available at the [REPLAY website](https://r-lum.github.io/REPLAY-website/).
Owner
- Name: Marco Colombo
- Login: mcol
- Kind: user
- Website: https://pm2.phs.ed.ac.uk/~mcolombo
- Repositories: 4
- Profile: https://github.com/mcol
100% made of awesome
GitHub Events
Total
- Create event: 8
- Release event: 3
- Issues event: 8
- Watch event: 2
- Delete event: 2
- Issue comment event: 9
- Push event: 62
- Fork event: 1
Last Year
- Create event: 8
- Release event: 3
- Issues event: 8
- Watch event: 2
- Delete event: 2
- Issue comment event: 9
- Push event: 62
- Fork event: 1
Committers
Last synced: over 1 year ago
Top Committers
| Name | Commits | |
|---|---|---|
| Marco Colombo | m****3@g****m | 21 |
Issues and Pull Requests
Last synced: 11 months ago
All Time
- Total issues: 0
- Total pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Total issue authors: 0
- Total pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- RLumSK (4)
- mcol (1)
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- cran 148 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 2
- Total maintainers: 1
cran.r-project.org: CBTF
Caught by the Fuzz! - A Minimalistic Fuzz-Test Runner
- Homepage: https://mcol.github.io/caught-by-the-fuzz/
- Documentation: http://cran.r-project.org/web/packages/CBTF/CBTF.pdf
- License: GPL-3
-
Latest release: 0.5.0
published 11 months ago
Rankings
Dependent packages count: 25.7%
Dependent repos count: 31.6%
Average: 47.6%
Downloads: 85.4%
Maintainers (1)
Last synced:
11 months ago
