-
Notifications
You must be signed in to change notification settings - Fork 11
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
396 R6 impl #471
base: main
Are you sure you want to change the base?
396 R6 impl #471
Conversation
@JanMarvin , this is current a draft because I'm seeing a few test failures that I'm not quite sure about. I managed to avoid others with a few changes to default parameters (which I'll doc in I don't know why these are failing right now. ──────────────────────────────────────────────────────────────────────
Failure (test-wb_functions.R:219): handle 29Feb1900
`got` (`actual`) not equal to `as_date` (`expected`).
`class(actual)`: "POSIXct" "POSIXt"
`class(expected)`: "Date"
`attr(actual, 'tzone')` is a character vector ('')
`attr(expected, 'tzone')` is absent
`unclass(actual)`: -2203959600 -2203873200
`unclass(expected)`: -25509 -25508
──────────────────────────────────────────────────────────────────────
✖ | 1 53 | wb_styles [3.1s]
──────────────────────────────────────────────────────────────────────
Failure (test-wb_styles.R:416): applyCellStyle works
`got` (`actual`) not equal to `exp` (`expected`).
`actual`: "4" "2" "1" "3"
`expected`: "3" "2" "1" "3"
──────────────────────────────────────────────────────────────────────
✔ | 14 | Workbook_properties [0.1s]
✔ | 24 | Worksheet_naming [0.2s]
✖ | 1 25 | write [1.2s]
──────────────────────────────────────────────────────────────────────
Failure (test-write.R:120): update_cells
`got` (`actual`) not equal to `exp` (`expected`).
`actual`: "inlineStr" "" "b"
`expected`: "inlineStr" "" "b" "e" |
@jmbarbone , I have seen this and the amount of code that is moved. We should be very careful applying this and should probably only do so after a previous new dot release (I opened an issue for a #472 release). But in any case, we should review this PR very thoroughly. I can't stress this enough. I really don't want to be faced with interesting surprises like those below 😄
posix_fmts <- c(
# "yy", "yyyy",
# "m", "mm", "mmm", "mmmm", "mmmmm",
# "d", "dd", "ddd", "dddd",
"h", "hh", ":m", ":mm", ":s", ":ss", # not sure if hour minutes seconds can be written only as h:m:s or if h/m/s is possible
"AM", "PM", "A", "P"
)
wb$add_data(dims = "E5", x = Sys.Date(), removeCellStyle = TRUE)
wb$add_data(dims = "A1", x = Sys.Date()
|
@JanMarvin , yeah this is going to be a big one. But it's nearly all just organization. Trying to not make any changes to the actual functions, so errors like these are a little interesting. Unless I didn't move something correctly (I'll have to go through again to check that) there could be something else with how we're handing assignments. For na_string <- function() {
structure("na_string", class = "openxlsx2_waiver")
}
is_na_string <- function(x) {
is_waiver(x) && isTRUE(x == "na_string")
} If that sounds good we can try to implement that prior to this hulk. |
I know you don't like My current plan is to stick it out until the end of the year, but after that I won't be working on My fear is that so many under-the-hood changes, especially those hard-to-see changes, will lead to bigger impacts. We have the three cases that we have already discovered in our very many tests. But there are still so many things that are not yet covered in the tests that are only visible in Excel, and I don't really feel like spending another couple of months looking for bugs that are introduced by cleaning up the biggest piece of code in the package ... Therefore - if possible - I really like not to introduce behavior changes at all. In no case should we rush to implement the changes, but rather do so in a well-considered manner and with the certainty that we have examined them well and weighed up the advantages and disadvantages. |
Bringing the conversion over here...
I agree. The scope of this was too large and I've kept it as a draft PR knowing it would take a while. It's probably better to close this and work in smaller chunks, if needed, or decide that some release version would only be dedicated to internal changes. Since it's just about internal code management, there isn't a big necessity to include these changes. |
At some hopefully distant time in the future, further restructuring of the code will be required (such as moving code from the workbook to the worksheet, or aligning the worksheet and chart sheet #404). I think something like this PR will be very useful then. As for the next version: I plan to release 0.5.1 at the end of the month. After that I will work on #38. After writing some |
resolves #396
Also contains some default parameters to use more
getOption()
and some reformatting of tests. Biggest change in those regards is the use ofna.strings = getOption("openxlsx2.na.strings")
.This was done to avoid complications with
missing()
and usingsubstitute()
to fake missingness when passing parameters down to other functions.