Skip to content

Commit e98adcc

Browse files
committed
chore: fix formatting with new Air
1 parent 1c389c1 commit e98adcc

4 files changed

Lines changed: 81 additions & 177 deletions

File tree

tests/testthat/test-condition_message.R

Lines changed: 7 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -36,44 +36,13 @@ patrick::with_parameters_test_that(
3636
condition_message_linter()
3737
),
3838
.cases = tibble::tribble(
39-
~.test_name,
40-
~condition,
41-
~fun,
42-
~parameter,
43-
~arg,
44-
"stop, paste0 and collapse = ''",
45-
"stop",
46-
"paste0",
47-
"collapse",
48-
"",
49-
"warning, paste0 and collapse = '\n'",
50-
"warning",
51-
"paste0",
52-
"collapse",
53-
"\n",
54-
"message, paste0 and collapse = '|'",
55-
"message",
56-
"paste0",
57-
"collapse",
58-
"|",
59-
# "stop, paste and collapse = ''", "stop", "paste", "collapse", "",
60-
# "warning, paste and collapse = '\n'", "warning", "paste", "collapse", "\n",
61-
# "message, paste and collapse = '|'", "message", "paste", "collapse", "|",
62-
"stop, paste0 and recycle0 = '-'",
63-
"stop",
64-
"paste0",
65-
"recycle0",
66-
"TRUE",
67-
"warning, paste0 and recycle0 = '\n'",
68-
"warning",
69-
"paste0",
70-
"recycle0",
71-
"TRUE",
72-
"message, paste0 and recycle0 = '|'",
73-
"message",
74-
"paste0",
75-
"recycle0",
76-
"TRUE"
39+
~.test_name , ~condition , ~fun , ~parameter , ~arg ,
40+
"stop, paste0 and collapse = ''" , "stop" , "paste0" , "collapse" , "" ,
41+
"warning, paste0 and collapse = '\n'" , "warning" , "paste0" , "collapse" , "\n" ,
42+
"message, paste0 and collapse = '|'" , "message" , "paste0" , "collapse" , "|" ,
43+
"stop, paste0 and recycle0 = '-'" , "stop" , "paste0" , "recycle0" , "TRUE" ,
44+
"warning, paste0 and recycle0 = '\n'" , "warning" , "paste0" , "recycle0" , "TRUE" ,
45+
"message, paste0 and recycle0 = '|'" , "message" , "paste0" , "recycle0" , "TRUE"
7746
)
7847
)
7948

tests/testthat/test-equals_na.R

Lines changed: 11 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -29,39 +29,17 @@ patrick::with_parameters_test_that(
2929
NULL
3030
),
3131
.cases = tibble::tribble(
32-
~.test_name,
33-
~operation,
34-
~type_na,
35-
"equality, logical NA",
36-
"==",
37-
"NA",
38-
"equality, integer NA",
39-
"==",
40-
"NA_integer_",
41-
"equality, real NA",
42-
"==",
43-
"NA_real_",
44-
"equality, complex NA",
45-
"==",
46-
"NA_complex_",
47-
"equality, character NA",
48-
"==",
49-
"NA_character_",
50-
"inequality, logical NA",
51-
"!=",
52-
"NA",
53-
"inequality, integer NA",
54-
"!=",
55-
"NA_integer_",
56-
"inequality, real NA",
57-
"!=",
58-
"NA_real_",
59-
"inequality, complex NA",
60-
"!=",
61-
"NA_complex_",
62-
"inequality, character NA",
63-
"!=",
64-
"NA_character_"
32+
~.test_name , ~operation , ~type_na ,
33+
"equality, logical NA" , "==" , NA ,
34+
"equality, integer NA" , "==" , "NA_integer_" ,
35+
"equality, real NA" , "==" , "NA_real_" ,
36+
"equality, complex NA" , "==" , "NA_complex_" ,
37+
"equality, character NA" , "==" , "NA_character_" ,
38+
"inequality, logical NA" , "!=" , NA ,
39+
"inequality, integer NA" , "!=" , "NA_integer_" ,
40+
"inequality, real NA" , "!=" , "NA_real_" ,
41+
"inequality, complex NA" , "!=" , "NA_complex_" ,
42+
"inequality, character NA" , "!=" , "NA_character_"
6543
)
6644
)
6745

tests/testthat/test-literal_coercion.R

Lines changed: 58 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -50,55 +50,22 @@ patrick::with_parameters_test_that(
5050
literal_coercion_linter()
5151
),
5252
.cases = tibble::tribble(
53-
~.test_name,
54-
~out_type,
55-
~input,
56-
~lint_msg,
57-
"lgl, from int",
58-
"logical",
59-
"1L",
60-
"Use TRUE instead of as.logical(1L)",
61-
"lgl, from num",
62-
"logical",
63-
"1",
64-
"Use TRUE instead of as.logical(1)",
65-
"lgl, from chr",
66-
"logical",
67-
'"true"',
68-
'Use TRUE instead of as.logical("true")',
69-
"int, from num",
70-
"integer",
71-
"1",
72-
"Use 1L instead of as.integer(1)",
73-
"num, from num",
74-
"numeric",
75-
"1",
76-
"Use 1 instead of as.numeric(1)",
77-
"dbl, from num",
78-
"double",
79-
"1",
80-
"Use 1 instead of as.double(1)",
81-
# "chr, from num", "character", "1", 'Use "1" instead of as.character(1)',
82-
# "chr, from chr", "character", '"e"', 'Use "e" instead of as.character("e")',
83-
# "chr, from chr", "character", '"E"', 'Use "E" instead of as.character("E")',
84-
# affirmatively lint as.<type>(NA) should be NA_<type>_
85-
"int, from NA",
86-
"integer",
87-
"NA",
88-
"Use NA_integer_ instead of as.integer(NA)",
89-
"num, from NA",
90-
"numeric",
91-
"NA",
92-
"Use NA_real_ instead of as.numeric(NA)",
93-
"dbl, from NA",
94-
"double",
95-
"NA",
96-
"Use NA_real_ instead of as.double(NA)",
97-
"chr, from NA",
98-
"character",
99-
"NA",
100-
"Use NA_character_ instead of as.character(NA)"
53+
~.test_name , ~out_type , ~input , ~lint_msg ,
54+
"lgl, from int" , "logical" , "1L" , "Use TRUE instead of as.logical(1L)" ,
55+
"lgl, from num" , "logical" , "1" , "Use TRUE instead of as.logical(1)" ,
56+
"lgl, from chr" , "logical" , "\"true\"" , "Use TRUE instead of as.logical(\"true\")" ,
57+
"int, from num" , "integer" , "1" , "Use 1L instead of as.integer(1)" ,
58+
"num, from num" , "numeric" , "1" , "Use 1 instead of as.numeric(1)" ,
59+
"dbl, from num" , "double" , "1" , "Use 1 instead of as.double(1)" ,
60+
"int, from NA" , "integer" , NA , "Use NA_integer_ instead of as.integer(NA)" ,
61+
"num, from NA" , "numeric" , NA , "Use NA_real_ instead of as.numeric(NA)" ,
62+
"dbl, from NA" , "double" , NA , "Use NA_real_ instead of as.double(NA)" ,
63+
"chr, from NA" , "character" , NA , "Use NA_character_ instead of as.character(NA)"
10164
)
65+
# "chr, from num", "character", "1", 'Use "1" instead of as.character(1)',
66+
# "chr, from chr", "character", '"e"', 'Use "e" instead of as.character("e")',
67+
# "chr, from chr", "character", '"E"', 'Use "E" instead of as.character("E")',
68+
# affirmatively lint as.<type>(NA) should be NA_<type>_
10269
)
10370

10471
# TODO
@@ -125,53 +92,53 @@ patrick::with_parameters_test_that(
12592
"literal_coercion_linter blocks simple disallowed usages",
12693
expect_snapshot(fix_text(sprintf("as.%s(%s)", out_type, input))),
12794
.cases = tibble::tribble(
128-
~.test_name,
129-
~out_type,
130-
~input,
131-
~lint_msg,
132-
"lgl, from int",
133-
"logical",
134-
"1L",
135-
"Use TRUE instead of as.logical(1L)",
136-
"lgl, from num",
137-
"logical",
138-
"1",
139-
"Use TRUE instead of as.logical(1)",
140-
"lgl, from chr",
141-
"logical",
142-
'"true"',
143-
'Use TRUE instead of as.logical("true")',
144-
"int, from num",
145-
"integer",
146-
"1",
147-
"Use 1L instead of as.integer(1)",
148-
"num, from num",
149-
"numeric",
150-
"1",
151-
"Use 1 instead of as.numeric(1)",
152-
"dbl, from num",
153-
"double",
154-
"1",
155-
"Use 1 instead of as.double(1)",
95+
~.test_name ,
96+
~out_type ,
97+
~input ,
98+
~lint_msg ,
99+
"lgl, from int" ,
100+
"logical" ,
101+
"1L" ,
102+
"Use TRUE instead of as.logical(1L)" ,
103+
"lgl, from num" ,
104+
"logical" ,
105+
"1" ,
106+
"Use TRUE instead of as.logical(1)" ,
107+
"lgl, from chr" ,
108+
"logical" ,
109+
'"true"' ,
110+
'Use TRUE instead of as.logical("true")' ,
111+
"int, from num" ,
112+
"integer" ,
113+
"1" ,
114+
"Use 1L instead of as.integer(1)" ,
115+
"num, from num" ,
116+
"numeric" ,
117+
"1" ,
118+
"Use 1 instead of as.numeric(1)" ,
119+
"dbl, from num" ,
120+
"double" ,
121+
"1" ,
122+
"Use 1 instead of as.double(1)" ,
156123
# "chr, from num", "character", "1", 'Use "1" instead of as.character(1)',
157124
# "chr, from chr", "character", '"e"', 'Use "e" instead of as.character("e")',
158125
# "chr, from chr", "character", '"E"', 'Use "E" instead of as.character("E")',
159126
# affirmatively lint as.<type>(NA) should be NA_<type>_
160-
"int, from NA",
161-
"integer",
162-
"NA",
163-
"Use NA_integer_ instead of as.integer(NA)",
164-
"num, from NA",
165-
"numeric",
166-
"NA",
167-
"Use NA_real_ instead of as.numeric(NA)",
168-
"dbl, from NA",
169-
"double",
170-
"NA",
171-
"Use NA_real_ instead of as.double(NA)",
172-
"chr, from NA",
173-
"character",
174-
"NA",
127+
"int, from NA" ,
128+
"integer" ,
129+
"NA" ,
130+
"Use NA_integer_ instead of as.integer(NA)" ,
131+
"num, from NA" ,
132+
"numeric" ,
133+
"NA" ,
134+
"Use NA_real_ instead of as.numeric(NA)" ,
135+
"dbl, from NA" ,
136+
"double" ,
137+
"NA" ,
138+
"Use NA_real_ instead of as.double(NA)" ,
139+
"chr, from NA" ,
140+
"character" ,
141+
"NA" ,
175142
"Use NA_character_ instead of as.character(NA)"
176143
)
177144
)

tests/testthat/test-redundant_equals.R

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,10 @@ patrick::with_parameters_test_that(
3838
expect_lint(code, lint_msg, redundant_equals_linter())
3939
},
4040
.cases = tibble::tribble(
41-
~.test_name,
42-
~op,
43-
~bool,
44-
"==, TRUE",
45-
"==",
46-
"TRUE",
47-
"==, FALSE",
48-
"==",
49-
"FALSE",
50-
"!=, TRUE",
51-
"!=",
52-
"TRUE",
53-
"!=, FALSE",
54-
"!=",
55-
"FALSE"
41+
~.test_name , ~op , ~bool ,
42+
"==, TRUE" , "==" , "TRUE" ,
43+
"==, FALSE" , "==" , "FALSE" ,
44+
"!=, TRUE" , "!=" , "TRUE" ,
45+
"!=, FALSE" , "!=" , "FALSE"
5646
)
5747
)

0 commit comments

Comments
 (0)