diff --git a/R/WorkbookClass.R b/R/WorkbookClass.R index 2d5d2ce1..851cc189 100644 --- a/R/WorkbookClass.R +++ b/R/WorkbookClass.R @@ -101,8 +101,8 @@ Workbook$methods( vdpi = openxlsx_getOp("vdpi", 300) ) { if (!missing(sheetName)) { - if (grepl(pattern = ":", x = sheetName)) { - stop("colon not allowed in sheet names in Excel") + if (grepl(pattern = "([/\\\\\\*'?\\[:\\]+])", perl = TRUE, x = sheetName) || nchar(sheetName) == 0) { + stop("Illegal character in sheet names. Don't use the following [ ] * / \\\ ? :") } } newSheetIndex <- length(worksheets) + 1L @@ -219,11 +219,7 @@ Workbook$methods( Workbook$methods( cloneWorksheet = function(sheetName, clonedSheet) { clonedSheet <- validateSheet(clonedSheet) - if (!missing(sheetName)) { - if (grepl(pattern = ":", x = sheetName)) { - stop("colon not allowed in sheet names in Excel") - } - } + newSheetIndex <- length(worksheets) + 1L if (newSheetIndex > 1) { sheetId <- @@ -1116,12 +1112,18 @@ Workbook$methods( Workbook$methods( validateSheet = function(sheetName) { + if (!missing(sheetName)) { + if (grepl(pattern = "([/\\*'?\\[:\\]+])",perl = T, x = sheetName)) { + stop("Illegal character in sheet names. Don't use the following [ ] * / \ ? :") + } + } + if (!is.numeric(sheetName)) { if (is.null(sheet_names)) { stop("Workbook does not contain any worksheets.", call. = FALSE) } } - + if (is.numeric(sheetName)) { if (sheetName > length(sheet_names)) { stop("This Workbook only has ", length(sheet_names), @@ -1918,12 +1920,15 @@ Workbook$methods( if (newSheetName %in% sheet_names) { stop(sprintf("Sheet %s already exists!", newSheetName)) } - + + if (grepl(pattern = "([/\\*'?\\[:\\]+])",perl = T, x = newSheetName)) { + stop("Illegal character in sheet names. Don't use the following [ ] * / \ ? :") + } + sheet <- validateSheet(sheet) oldName <- sheet_names[[sheet]] sheet_names[[sheet]] <<- newSheetName - ## Rename in workbook sheetId <- regmatches( diff --git a/revdep/README.md b/revdep/README.md index 65a1ba8e..6a375809 100644 --- a/revdep/README.md +++ b/revdep/README.md @@ -12,6 +12,7 @@ |tz |UTC | |date |2021-07-12 | + # Dependencies |package |old |new |Δ | @@ -23,12 +24,15 @@ # Revdeps + ## Failed to check (27) + |package |version |error |warning |note | |:--------------|:-------|:-----|:-------|:----| |appreci8R |? | | | | |artMS |? | | | | +|cbaf |? | | | | |CHRONOS |? | | | | |CNVPanelizer |? | | | | |DAPAR |? | | | | @@ -49,6 +53,7 @@ |RIPAT |? | | | | |sangeranalyseR |1.2.0 |1 |1 |2 | |SEtools |? | | | | +|sigFeature |? | | | | |stplanr |? | | | | |structToolbox |? | | | | |TPP |3.20.0 |1 | |3 | diff --git a/revdep/failures.md b/revdep/failures.md index bfc18c44..34bba50e 100644 --- a/revdep/failures.md +++ b/revdep/failures.md @@ -17,6 +17,67 @@ +Error in download.file(url, destfile, method, mode = "wb", ...) : + download from 'https://bioconductor.org/packages/3.13/data/annotation/src/contrib/MafDb.1Kgenomes.phase3.hs37d5_3.10.0.tar.gz' failed +In addition: Warning messages: +1: In download.file(url, destfile, method, mode = "wb", ...) : + downloaded length 1562737805 != reported length 1623464748 +2: In download.file(url, destfile, method, mode = "wb", ...) : + downloaded length 1562737805 != reported length 1623464748 +3: In download.file(url, destfile, method, mode = "wb", ...) : + URL 'https://bioconductor.org/packages/3.13/data/annotation/src/contrib/MafDb.1Kgenomes.phase3.hs37d5_3.10.0.tar.gz': Timeout of 60 seconds was reached +4: In download.file(url, destfile, method, mode = "wb", ...) : + URL 'https://bioconductor.org/packages/3.13/data/annotation/src/contrib/MafDb.1Kgenomes.phase3.hs37d5_3.10.0.tar.gz': Timeout of 60 seconds was reached +Warning in download.packages(pkgs, destdir = tmpd, available = available, : + download of package ‘MafDb.1Kgenomes.phase3.hs37d5’ failed +Warning in download.packages(pkgs, destdir = tmpd, available = available, : + download of package ‘MafDb.1Kgenomes.phase3.hs37d5’ failed + + +``` +### CRAN + +``` + + + +Error in download.file(url, destfile, method, mode = "wb", ...) : + download from 'https://bioconductor.org/packages/3.13/data/annotation/src/contrib/MafDb.1Kgenomes.phase3.hs37d5_3.10.0.tar.gz' failed +In addition: Warning messages: +1: In download.file(url, destfile, method, mode = "wb", ...) : + downloaded length 1562737805 != reported length 1623464748 +2: In download.file(url, destfile, method, mode = "wb", ...) : + downloaded length 1562737805 != reported length 1623464748 +3: In download.file(url, destfile, method, mode = "wb", ...) : + URL 'https://bioconductor.org/packages/3.13/data/annotation/src/contrib/MafDb.1Kgenomes.phase3.hs37d5_3.10.0.tar.gz': Timeout of 60 seconds was reached +4: In download.file(url, destfile, method, mode = "wb", ...) : + URL 'https://bioconductor.org/packages/3.13/data/annotation/src/contrib/MafDb.1Kgenomes.phase3.hs37d5_3.10.0.tar.gz': Timeout of 60 seconds was reached +Warning in download.packages(pkgs, destdir = tmpd, available = available, : + download of package ‘MafDb.1Kgenomes.phase3.hs37d5’ failed +Warning in download.packages(pkgs, destdir = tmpd, available = available, : + download of package ‘MafDb.1Kgenomes.phase3.hs37d5’ failed + + +``` +# artMS + +
+ +* Version: +* GitHub: https://github.com/ycphs/openxlsx +* Source code: NA +* Number of recursive dependencies: 0 + +
+ +## Error before installation + +### Devel + +``` + + + @@ -31,7 +92,7 @@ ``` -# artMS +# cbaf
@@ -654,6 +715,7 @@ ERROR: lazy loading failed for package ‘hypeR’ ``` # RIPAT +
* Version: @@ -689,94 +751,69 @@ ERROR: lazy loading failed for package ‘hypeR’
-* Version: 1.2.0 -* GitHub: NA -* Source code: https://github.com/cran/sangeranalyseR -* Date/Publication: 2021-05-19 -* Number of recursive dependencies: 142 - -Run `revdep_details(, "sangeranalyseR")` for more info +* Version: +* GitHub: https://github.com/ycphs/openxlsx +* Source code: NA +* Number of recursive dependencies: 0
-## In both +## Error before installation -* checking whether package ‘sangeranalyseR’ can be installed ... ERROR - ``` - Installation failed. - See ‘/home/runner/work/openxlsx/openxlsx/revdep/checks/sangeranalyseR/new/sangeranalyseR.Rcheck/00install.out’ for details. - ``` +### Devel -* checking for portable file names ... WARNING - ``` - Found the following file with a non-portable file name: - docs/wallpaperflare.com_wallpaper (1).jpg - These are not fully portable file names. - See section ‘Package structure’ in the ‘Writing R Extensions’ manual. - ``` +``` -* checking package dependencies ... NOTE - ``` - Depends: includes the non-default packages: - 'stringr', 'ape', 'Biostrings', 'DECIPHER', 'parallel', 'reshape2', - 'phangorn', 'sangerseqR', 'gridExtra', 'shiny', 'shinydashboard', - 'shinyjs', 'data.table', 'plotly', 'DT', 'zeallot', 'excelR', - 'shinycssloaders', 'ggdendro', 'shinyWidgets', 'openxlsx', 'tools', - 'rmarkdown', 'kableExtra', 'seqinr', 'BiocStyle', 'logger' - Adding so many packages to the search path is excessive and importing - selectively is preferable. - ``` -* checking for hidden files and directories ... NOTE - ``` - Found the following hidden files and directories: - .travis.yml - docs/build/html/.buildinfo - These were most likely included in error. See section ‘Package - structure’ in the ‘Writing R Extensions’ manual. - ``` -## Installation + + + +``` +### CRAN + +``` + + + + + + +``` +# SEtools + +
+ +* Version: +* GitHub: https://github.com/ycphs/openxlsx +* Source code: NA +* Number of recursive dependencies: 0 + +
+ +## Error before installation ### Devel ``` -* installing *source* package ‘sangeranalyseR’ ... -** using staged installation -** R -** data -** inst -** byte-compile and prepare package for lazy loading -Error: package or namespace load failed for ‘phangorn’ in dyn.load(file, DLLpath = DLLpath, ...): - unable to load shared object '/home/runner/work/openxlsx/openxlsx/revdep/library/sangeranalyseR/igraph/libs/igraph.so': - libglpk.so.40: cannot open shared object file: No such file or directory -Error: package ‘phangorn’ could not be loaded -Execution halted -ERROR: lazy loading failed for package ‘sangeranalyseR’ -* removing ‘/home/runner/work/openxlsx/openxlsx/revdep/checks/sangeranalyseR/new/sangeranalyseR.Rcheck/sangeranalyseR’ + + + + ``` ### CRAN ``` -* installing *source* package ‘sangeranalyseR’ ... -** using staged installation -** R -** data -** inst -** byte-compile and prepare package for lazy loading -Error: package or namespace load failed for ‘phangorn’ in dyn.load(file, DLLpath = DLLpath, ...): - unable to load shared object '/home/runner/work/openxlsx/openxlsx/revdep/library/sangeranalyseR/igraph/libs/igraph.so': - libglpk.so.40: cannot open shared object file: No such file or directory -Error: package ‘phangorn’ could not be loaded -Execution halted -ERROR: lazy loading failed for package ‘sangeranalyseR’ -* removing ‘/home/runner/work/openxlsx/openxlsx/revdep/checks/sangeranalyseR/old/sangeranalyseR.Rcheck/sangeranalyseR’ + + + + ``` -# SEtools +# sigFeature
diff --git a/tests/testthat/test-Worksheet_naming.R b/tests/testthat/test-Worksheet_naming.R index 41eeee35..a6908f1a 100644 --- a/tests/testthat/test-Worksheet_naming.R +++ b/tests/testthat/test-Worksheet_naming.R @@ -44,3 +44,29 @@ test_that("Worksheet names", { expect_equal(sheetname,names(wb)) expect_equal("test "A"",wb$sheet_names) }) + + +test_that("test for illegal characters", { + ### + + wb <- createWorkbook() + x <- data.frame(a = 1, b = 2) + + addWorksheet(wb, "Test") + for(i in c("[", "]", "*", "/", "?", ":")){ + sheetname <- paste0('test_',i) + y <- list(a = x, sheetname = x, c = x) + expect_error(addWorksheet(wb, sheetname)) + expect_error(cloneWorksheet(wb, "Test", sheetname)) + expect_error(renameWorksheet(wb, "Test", sheetname)) + expect_error(parse(names(wb)<- sheetname)) + expect_error(parse(buildWorkbook(y, asTable = TRUE))) + } + +}) + + + + + +