Skip to content

use_tidy_style() #374

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 4, 2021
Merged

use_tidy_style() #374

merged 5 commits into from
May 4, 2021

Conversation

njtierney
Copy link
Collaborator

closes #372

@goldingn
Copy link
Member

(requested changes and approval were me just dealing with misclicking the review button instead of comment, please ignore)

@njtierney
Copy link
Collaborator Author

This doesn't create any additional errors or anything, but I do get the following tests, can you replicate, @goldingn ?

> devtools::test()
Loading greta
Testing greta|  OK F W S | Context
x |  51 1     | as_data [1.1 s]                                                    
───────────────────────────────────────────────────────────────────────────────────
Failure (test_as_data.R:160:3): as_data errors informatively
`as_data(cha_df2)` threw an error with unexpected message.
Expected match: "cannot coerce a dataframe to a greta_array unless all columns are numeric, integer or logical. This dataframe had columns of type: factor"
Actual message: "cannot coerce a dataframe to a greta_array unless all columns are numeric, integer or logical. This dataframe had columns of type: character"
Backtrace:
 1. testthat::expect_error(...) test_as_data.R:160:2
 7. greta::as_data.default(cha_df2) /Users/njtierney/github/njtierney/greta-dev/greta/R/as_data.R:39:2
 9. greta::as.greta_array.data.frame(x) /Users/njtierney/github/njtierney/greta-dev/greta/R/greta_array_class.R:8:2
───────────────────────────────────────────────────────────────────────────────────
✓ |  80       | calculate [28.9 s]                                                 
✓ | 208       | distributions [119.9 s]                                            
x | 235 1     | extract/replace/combine [40.8 s]                                   
───────────────────────────────────────────────────────────────────────────────────
Error (test_extract_replace_combine.R:554:3): head and tail work
Error: non-conformable arrays
Backtrace:
 1. global::check_op(head, c) test_extract_replace_combine.R:554:2
 2. global::compare_op(r_out, greta_out, tolerance) helpers.R:193:4
 3. base::as.vector(abs(r_out - greta_out)) helpers.R:198:2
───────────────────────────────────────────────────────────────────────────────────
x | 448 6 1   | functions [56.2 s]                                                 
───────────────────────────────────────────────────────────────────────────────────
Failure (test_functions.R:51:3): primitive functions work as expected
all(difference < tolerance) is not TRUE

`actual`:   FALSE
`expected`: TRUE 
Backtrace:
 1. global::check_op(log10, pos) test_functions.R:51:2
 2. global::compare_op(r_out, greta_out, tolerance) helpers.R:193:4
 3. testthat::expect_true(all(difference < tolerance)) helpers.R:199:2

Failure (test_functions.R:51:3): primitive functions work as expected
all(difference < tolerance) is not TRUE

`actual`:   FALSE
`expected`: TRUE 
Backtrace:
 1. global::check_op(log10, pos) test_functions.R:51:2
 2. global::compare_op(r_out, greta_out, tolerance) helpers.R:193:4
 3. testthat::expect_true(all(difference < tolerance)) helpers.R:199:2

Failure (test_functions.R:51:3): primitive functions work as expected
all(difference < tolerance) is not TRUE

`actual`:   FALSE
`expected`: TRUE 
Backtrace:
 1. global::check_op(log10, pos) test_functions.R:51:2
 2. global::compare_op(r_out, greta_out, tolerance) helpers.R:193:4
 3. testthat::expect_true(all(difference < tolerance)) helpers.R:199:2

Failure (test_functions.R:52:3): primitive functions work as expected
all(difference < tolerance) is not TRUE

`actual`:   FALSE
`expected`: TRUE 
Backtrace:
 1. global::check_op(log2, pos) test_functions.R:52:2
 2. global::compare_op(r_out, greta_out, tolerance) helpers.R:193:4
 3. testthat::expect_true(all(difference < tolerance)) helpers.R:199:2

Failure (test_functions.R:52:3): primitive functions work as expected
all(difference < tolerance) is not TRUE

`actual`:   FALSE
`expected`: TRUE 
Backtrace:
 1. global::check_op(log2, pos) test_functions.R:52:2
 2. global::compare_op(r_out, greta_out, tolerance) helpers.R:193:4
 3. testthat::expect_true(all(difference < tolerance)) helpers.R:199:2

Failure (test_functions.R:52:3): primitive functions work as expected
all(difference < tolerance) is not TRUE

`actual`:   FALSE
`expected`: TRUE 
Backtrace:
 1. global::check_op(log2, pos) test_functions.R:52:2
 2. global::compare_op(r_out, greta_out, tolerance) helpers.R:193:4
 3. testthat::expect_true(all(difference < tolerance)) helpers.R:199:2

Warning (test_functions.R:108:3): matrix functions work as expected
the LINPACK argument has been defunct since R 3.1.0
Backtrace:
 1. global::check_op(chol2inv, c) test_functions.R:108:2
 2. global::run_r_op(op, a, b, other_args) helpers.R:188:2
 5. greta::chol2inv.default(...) /Users/njtierney/github/njtierney/greta-dev/greta/R/functions.R:441:2
 6. base::chol2inv(x = x, size = size, LINPACK = LINPACK) /Users/njtierney/github/njtierney/greta-dev/greta/R/functions.R:446:2
───────────────────────────────────────────────────────────────────────────────────
✖ |   3 2     | greta_array class [0.1 s]                                          
───────────────────────────────────────────────────────────────────────────────────
Failure (test_greta_array_class.R:42:3): print and summary work
result$output not identical to `expected_output`.
1/1 mismatches
x[1]: "greta array (variable following a normal distribution)\n\n     [,1]\n[1,]  ?
x[1]:   \nattr(,\"class\")\n[1] matrix array "
y[1]: "greta array (variable following a normal distribution)\n\n     [,1]\n[1,]  ?
y[1]:   "

Failure (test_greta_array_class.R:61:3): print and summary work
result$output not identical to `expected_output`.
1/1 mismatches
x[1]: "greta array (operation)\n\n     [,1] [,2] [,3]\n[1,]  ?    ?    ?  \n[2,]  ?
x[1]:     ?    ?  \n[3,]  ?    ?    ?  \nattr(,\"class\")\n[1] matrix array "
y[1]: "greta array (operation)\n\n     [,1] [,2] [,3]\n[1,]  ?    ?    ?  \n[2,]  ?
y[1]:     ?    ?  \n[3,]  ?    ?    ?  "
───────────────────────────────────────────────────────────────────────────────────
Maximum number of failures exceeded; quitting early.
You can increase this number by setting `options(testthat.progress.max_fails)` 

══ Results ════════════════════════════════════════════════════════════════════════
Duration: 247.2 s

[ FAIL 10 | WARN 1 | SKIP 0 | PASS 1025 ]
══ Terminated early ═══════════════════════════════════════════════════════════════

PS

once we implement GH actions there should be a nice PR notification about GH's test results.

@goldingn
Copy link
Member

Won't have time to try today - but it looks like some of the text outputs have been affected, so some of those very specific tests on the formatting of messages etc. are failing. It's possible that isn't related to styler but is a different change (e.g. R version), because it looks like attribute information is now being printed in the last test.

@njtierney
Copy link
Collaborator Author

njtierney commented Apr 22, 2021

OK I'll fix those up before I merge!

@njtierney njtierney mentioned this pull request Apr 22, 2021
@njtierney
Copy link
Collaborator Author

errors have been cross referenced to master and no further errors were introduced

@njtierney njtierney merged commit 8b39558 into greta-dev:master May 4, 2021
@njtierney njtierney deleted the use-styler branch May 4, 2021 03:13
@lorenzwalthert
Copy link
Contributor

Cool guys. {styler} also modified roxygen code examples, so I think to complete the styling, we need to re-generate docs with roxygen2::roxygenize(). I filed #405 for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use styler to use tidyverse style. Ensure that if, else, and for loops use {}
3 participants