Skip to content

Commit ad71db5

Browse files
Make cyclocomp_linter() optional
closes #2554
1 parent d86738f commit ad71db5

File tree

8 files changed

+13
-12
lines changed

8 files changed

+13
-12
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ Depends:
2525
Imports:
2626
backports (>= 1.1.7),
2727
codetools,
28-
cyclocomp,
2928
digest,
3029
glue,
3130
knitr,
@@ -37,6 +36,7 @@ Imports:
3736
Suggests:
3837
bookdown,
3938
cli,
39+
cyclocomp,
4040
jsonlite,
4141
patrick (>= 0.2.0),
4242
rlang,

R/cyclocomp_linter.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
#'
33
#' Check for overly complicated expressions. See [cyclocomp::cyclocomp()].
44
#'
5-
#' @param complexity_limit Maximum cyclomatic complexity, default 15. Expressions more complex
5+
#' @param complexity_limit Maximum cyclomatic complexity, default `15`. Expressions more complex
66
#' than this are linted. See [cyclocomp::cyclocomp()].
77
#'
8-
#' @examples
8+
#' @examplesIf requireNamespace("cyclocomp", quietly = TRUE)
99
#' # will produce lints
1010
#' lint(
1111
#' text = "if (TRUE) 1 else 2",

R/zzz.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ default_linters <- modify_defaults(
1717
brace_linter(),
1818
commas_linter(),
1919
commented_code_linter(),
20-
cyclocomp_linter(),
2120
equals_na_linter(),
2221
function_left_parentheses_linter(),
2322
indentation_linter(),

inst/lintr/linters.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ conjunct_test_linter,package_development best_practices readability configurable
1717
consecutive_assertion_linter,style readability consistency
1818
consecutive_mutate_linter,consistency readability configurable efficiency
1919
consecutive_stopifnot_linter,style readability consistency deprecated
20-
cyclocomp_linter,style readability best_practices default configurable
20+
cyclocomp_linter,style readability best_practices configurable
2121
duplicate_argument_linter,correctness common_mistakes configurable
2222
empty_assignment_linter,readability best_practices
2323
equals_na_linter,robustness correctness common_mistakes default

man/cyclocomp_linter.Rd

Lines changed: 4 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/default_linters.Rd

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/linters.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test-cyclocomp_linter.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
test_that("returns the correct linting", {
2+
skip_if_not_installed("cyclocomp")
3+
24
cc_linter_1 <- cyclocomp_linter(1L)
35
cc_linter_2 <- cyclocomp_linter(2L)
46
lint_msg <- rex::rex("Reduce the cyclomatic complexity of this function")

0 commit comments

Comments
 (0)