https://github.com/danielvartan/prettycheck
✔️✨ Pretty Assertive Programming
https://github.com/danielvartan/prettycheck
argument-checks assertions assertive-programming checks defensive-programming error-messages r r-package tests testthat validation
Last synced: about 1 month ago
JSON representation
✔️✨ Pretty Assertive Programming
- Host: GitHub
- URL: https://github.com/danielvartan/prettycheck
- Owner: danielvartan
- License: other
- Created: 2024-09-05T00:29:59.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2025-03-17T06:28:11.000Z (about 2 months ago)
- Last Synced: 2025-03-28T05:43:02.267Z (about 2 months ago)
- Topics: argument-checks, assertions, assertive-programming, checks, defensive-programming, error-messages, r, r-package, tests, testthat, validation
- Language: R
- Homepage: https://danielvartan.github.io/prettycheck/
- Size: 1.57 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: NEWS.md
- Contributing: .github/CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Citation: CITATION.cff
- Codemeta: codemeta.json
Awesome Lists containing this project
README
# prettycheck
[](https://www.repostatus.org/#active)
[](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[](https://github.com/danielvartan/prettycheck/actions/workflows/check-standard.yaml)
[](https://app.codecov.io/gh/danielvartan/prettycheck?branch=main)
[](https://choosealicense.com/licenses/mit/)
[](CODE_OF_CONDUCT.md)## Overview
Assertive programming doesn’t have to be ugly. If ultra-fast checks
aren’t your top priority, `prettycheck` is for you. This R package
provides a set of functions that produce pretty and informative error
messages, primarily using the [`cli`](https://cli.r-lib.org/) package
from [r-lib](https://github.com/r-lib).`prettycheck` adheres to [tidyverse
principles](https://tidyverse.tidyverse.org/articles/manifesto.html) and
seamlessly integrates with the [tidyverse
ecosystem](https://www.tidyverse.org/).Need faster assertive programming? Try
[`checkmate`](https://mllg.github.io/checkmate/). Since `prettycheck`
uses the same structural approach to checks, transitioning between
packages is straightforward. You can also use both packages together
without conflicts.## Installation
You can install `prettycheck` using the
[`remotes`](https://github.com/r-lib/remotes) package:``` r
remotes::install_github("danielvartan/prettycheck")
```## Usage
Like [`checkmate`](https://mllg.github.io/checkmate/), `prettycheck`
includes four family of functions: `test_*()`, `check_*()`,
`assert_*()`, and `expect_*()`.The `test_*()` functions return a logical flag; the `check_*()`
functions throw a warning message as a string if the condition is not
met; and the `assert_*()` and `expect_*()` functions throw an error if
the condition is not met. If the condition is met, `check_*()` returns a
logical flag; `assert_*()` and `expect_*()` functions return the input
object invisibly.Here are some of the functions available:
- [`assert_color()`](https://danielvartan.github.io/prettycheck/reference/assert_color.html):
Assert if an argument is a valid color
- [`check_duration()`](https://danielvartan.github.io/prettycheck/reference/check_duration.html)
`test_duration()` `assert_duration()`: Check if an argument is a
[`Duration`](https://lubridate.tidyverse.org/reference/duration.html)
object
- [`check_hms()`](https://danielvartan.github.io/prettycheck/reference/check_hms.html)
`test_hms()` `assert_hms()`: Check if an argument is a
[`hms`](https://hms.tidyverse.org/reference/hms.html) object
- [`check_identical()`](https://danielvartan.github.io/prettycheck/reference/check_identical.html)
`test_identical()` `assert_identical()`: Check if multiple objects are
identical
- [`check_interval()`](https://danielvartan.github.io/prettycheck/reference/check_interval.html)
`test_interval()` `assert_interval()`: Check if an argument is an
[`Interval`](https://lubridate.tidyverse.org/reference/interval.html)
object
- [`check_length()`](https://danielvartan.github.io/prettycheck/reference/check_length.html)
`test_length()` `assert_length()`: Check if an argument has a specific
length
- [`check_period()`](https://danielvartan.github.io/prettycheck/reference/check_period.html)
`test_period()` `assert_period()`: Check if an argument is a
[`Period`](https://lubridate.tidyverse.org/reference/period.html)
object
- [`check_pick()`](https://danielvartan.github.io/prettycheck/reference/check_pick.html)
`test_pick()` `assert_pick()`: Check how many arguments were picked
- [`check_posixt()`](https://danielvartan.github.io/prettycheck/reference/check_posixt.html)
`test_period()` `assert_period()`: Check if an argument is a `POSIXt`
object
- [`check_temporal`](https://danielvartan.github.io/prettycheck/reference/check_temporal.html)
`test_temporal()` `assert_temporal()`: Check if an argument is a
temporal objectClick [here](https://danielvartan.github.io/prettycheck/) to see the
full list of functions.## License
[](https://opensource.org/license/mit/)`prettycheck` code is released under the [MIT
license](https://opensource.org/license/mit/).## Contributing
Contributions are welcome, including bug reports. Take a moment to
review the [Guidelines for
Contributing](https://danielvartan.github.io/prettycheck/CONTRIBUTING.html).
Become an `prettycheck` supporter!
Click [here](https://github.com/sponsors/danielvartan) to make a
donation. Please indicate the `prettycheck` package in your donation
message.