This file is not included in the source package because of the .nopurl
suffix in its
filename.
The chunks below have to be manually executed in order to regenerate the package data.
Although the datasets below are saved as "internal data" in R/sysdata.rda
, they can still be exported and
documented (by documenting the dataset's quoted name in the main .Rmd
source file -- which only works when the dataset is also @export
ed), something
not explicitly mentioned in the book R
Packages. To do so, you first need to manually add the export()
directive in the NAMESPACE file since
roxygen2 won't add it automatically.
default_linters
NOTES:
Non-default linters that we tested but dismissed due to annoyance or disagreement include:
nested_pipe_linter
(nesting pipes doesn't necessarily have to make the code less-readable, on the contrary!)nonportable_path_linter
(requires paths to always be constructed using file.path()
, but file.path()
emits forward-slashes on all platforms incl.
Windows, so the benefit seems questionable; besides, fs::path()
is clearly superior to file.path()
anyways)strings_as_factors_linter
(unnecessary when the code requires R >= 4.0)default_linters <- lintr::linters_with_defaults( absolute_path_linter = lintr::absolute_path_linter(), any_duplicated_linter = lintr::any_duplicated_linter(), any_is_na_linter = lintr::any_is_na_linter(), assignment_linter = lintr::assignment_linter(operator = c("<-", "<<-", "%<>%")), boolean_arithmetic_linter = lintr::boolean_arithmetic_linter(), # TODO: set `function_braces = "not_inline"` once lintr 3.2.1+ is released brace_linter = lintr::brace_linter(allow_single_line = TRUE), class_equals_linter = lintr::class_equals_linter(), comparison_negation_linter = lintr::comparison_negation_linter(), condition_call_linter = lintr::condition_call_linter(), condition_message_linter = lintr::condition_message_linter(), conjunct_test_linter = lintr::conjunct_test_linter(allow_filter = "always"), consecutive_assertion_linter = lintr::consecutive_assertion_linter(), consecutive_mutate_linter = lintr::consecutive_mutate_linter(), cyclocomp_linter = lintr::cyclocomp_linter(), empty_assignment_linter = lintr::empty_assignment_linter(), expect_comparison_linter = lintr::expect_comparison_linter(), expect_identical_linter = lintr::expect_identical_linter(), expect_length_linter = lintr::expect_length_linter(), expect_named_linter = lintr::expect_named_linter(), expect_not_linter = lintr::expect_not_linter(), expect_null_linter = lintr::expect_null_linter(), expect_s3_class_linter = lintr::expect_s3_class_linter(), expect_s4_class_linter = lintr::expect_s4_class_linter(), expect_true_false_linter = lintr::expect_true_false_linter(), expect_type_linter = lintr::expect_type_linter(), fixed_regex_linter = lintr::fixed_regex_linter(), for_loop_index_linter = lintr::for_loop_index_linter(), function_argument_linter = lintr::function_argument_linter(), function_return_linter = lintr::function_return_linter(), if_not_else_linter = lintr::if_not_else_linter(exceptions = NULL), if_switch_linter = lintr::if_switch_linter(), ifelse_censor_linter = lintr::ifelse_censor_linter(), implicit_assignment_linter = lintr::implicit_assignment_linter(), implicit_integer_linter = lintr::implicit_integer_linter(allow_colon = TRUE), # DISABLED due to too many false-positives / deviations from RStudio's auto-indent # cf. https://github.com/r-lib/lintr/issues?q=is%3Aissue+is%3Aopen+indentation_linter # indentation_linter = lintr::indentation_linter(hanging_indent_style = "always"), indentation_linter = NULL, inner_combine_linter = lintr::inner_combine_linter(), is_numeric_linter = lintr::is_numeric_linter(), keyword_quote_linter = lintr::keyword_quote_linter(), length_levels_linter = lintr::length_levels_linter(), length_test_linter = lintr::length_test_linter(), lengths_linter = lintr::lengths_linter(), line_length_linter = lintr::line_length_linter(length = 160L), list_comparison_linter = lintr::list_comparison_linter(), literal_coercion_linter = lintr::literal_coercion_linter(), # NOTE: non-base-R fns aren't up for inclusion in default `except` arg, thus we have to customize ourselves # cf. https://github.com/r-lib/lintr/issues/2109#issuecomment-1842245434 missing_argument_linter = lintr::missing_argument_linter(except = c("alist", "quote", "switch", "extract")), nested_ifelse_linter = lintr::nested_ifelse_linter(), nrow_subset_linter = lintr::nrow_subset_linter(), numeric_leading_zero_linter = lintr::numeric_leading_zero_linter(), nzchar_linter = lintr::nzchar_linter(), object_length_linter = lintr::object_length_linter(length = 40L), object_overwrite_linter = lintr::object_overwrite_linter(packages = "base"), # TODO: try re-enabling once https://github.com/r-lib/lintr/issues/2252 is fixed object_usage_linter = NULL, one_call_pipe_linter = lintr::one_call_pipe_linter(), outer_negation_linter = lintr::outer_negation_linter(), paste_linter = lintr::paste_linter(), pipe_call_linter = lintr::pipe_call_linter(), pipe_return_linter = lintr::pipe_return_linter(), print_linter = lintr::print_linter(), # disabled because being able to use both types of quotes allows to avoid having to escape the respective other quote type quotes_linter = NULL, redundant_equals_linter = lintr::redundant_equals_linter(), redundant_ifelse_linter = lintr::redundant_ifelse_linter(), regex_subset_linter = lintr::regex_subset_linter(), rep_len_linter = lintr::rep_len_linter(), repeat_linter = lintr::repeat_linter(), routine_registration_linter = lintr::routine_registration_linter(), sample_int_linter = lintr::sample_int_linter(), scalar_in_linter = lintr::scalar_in_linter(), sort_linter = lintr::sort_linter(), sprintf_linter = lintr::sprintf_linter(), stopifnot_all_linter = lintr::stopifnot_all_linter(), string_boundary_linter = lintr::string_boundary_linter(), system_file_linter = lintr::system_file_linter(), terminal_close_linter = lintr::terminal_close_linter(), todo_comment_linter = lintr::todo_comment_linter(), # disabled since RStudio's built-in `StripTrailingWhitespace` proj opt ignores .Rmd code chunks trailing_whitespace_linter = NULL, undesirable_function_linter = lintr::undesirable_function_linter(symbol_is_undesirable = FALSE), undesirable_operator_linter = lintr::undesirable_operator_linter(op = c(lintr::default_undesirable_operators, "->" = "Makes it harder to see in code where an object is defined.")), unnecessary_concatenation_linter = lintr::unnecessary_concatenation_linter(), unnecessary_lambda_linter = lintr::unnecessary_lambda_linter(), # TODO: re-enable once lintr 3.2.1+ is released # unnecessary_nesting_linter = lintr::unnecessary_nesting_linter(), unnecessary_placeholder_linter = lintr::unnecessary_placeholder_linter(), unreachable_code_linter = lintr::unreachable_code_linter(), which_grepl_linter = lintr::which_grepl_linter(), yoda_test_linter = lintr::yoda_test_linter() )
funky_config
funky_config <- funky::ptype_config |> tibble::add_row(key = "add_copyright_notice", default_value = list(TRUE), description = paste0("Whether or not to add a **copyright notice** at the beginning of the generated `.R` files as recommended by e.g. the ", "[GNU licenses](https://www.gnu.org/licenses/gpl-howto.html). The notice consists of the name and description of the ", "program and the word `Copyright (C)` followed by the release years and the name(s) of the copyright holder(s), or if ", "not specified, the author(s). The year is always the current year. All the other information is extracted from the ", "package's `DESCRIPTION` file.")) |> tibble::add_row(key = "add_license_notice", default_value = list(TRUE), description = paste0("Whether or not to add a **license notice** at the beginning of the generated `.R` files as recommended by e.g. the ", "[GNU licenses](https://www.gnu.org/licenses/gpl-howto.html). The license is determined from the package's ", "`DESCRIPTION` file and currently only the [`AGPL-3.0-or-later` ", "license](https://spdx.org/licenses/AGPL-3.0-or-later.html) is supported.")) |> tibble::add_row(key = "gen_pkgdown_ref", default_value = list(TRUE), description = paste0("Whether or not to overwrite [pkgdown](https://pkgdown.r-lib.org/)'s [reference ", "index](https://pkgdown.r-lib.org/reference/build_reference.html#reference-index) in the configuration file ", "`_pkgdown.yml` with an auto-generated one based on the main input file as described in [pkgpurl::gen_pkgdown_ref()]."))
Save all the small data objects as a single internal file R/sysdata.rda
. Note that when documenting them, they must be explicitly @export
ed to be available
to package users.
usethis::use_data(default_linters, funky_config, internal = TRUE, overwrite = TRUE, compress = "xz", version = 3L)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.