Title: | A Way to Perform Code Review or QA on Other Packages |
---|---|
Description: | Reviews other packages during code review by looking at their dependencies, code style, code complexity, and how internally defined functions interact with one another. |
Authors: | Maarten van Kessel [aut, cre] |
Maintainer: | Maarten van Kessel <[email protected]> |
License: | Apache License (>= 2) |
Version: | 0.1.15 |
Built: | 2024-12-03 08:34:41 UTC |
Source: | https://github.com/darwin-eu-dev/pare |
Writes an Rmd-file to ./vignettes/articles/PaReReport.Rmd
. The relative
path is dictated by the specified path in the Repository object.
addPareArticle(repo)
addPareArticle(repo)
repo |
(Repository) Repository object. |
NULL
Writes Rmd-file to ./vignettes/articles/PaReReport.Rmd
fetchedRepo <- tryCatch( { # Set dir to clone repository to. tempDir <- tempdir() pathToRepo <- file.path(tempDir, "glue") # Clone repo git2r::clone( url = "https://github.com/darwin-eu/IncidencePrevalence.git", local_path = pathToRepo ) # Create instance of Repository object. repo <- PaRe::Repository$new(path = pathToRepo) # Set fetchedRepo to TRUE if all goes well. TRUE }, error = function(e) { # Set fetchedRepo to FALSE if an error is encountered. FALSE }, warning = function(w) { # Set fetchedRepo to FALSE if a warning is encountered. FALSE } ) if (fetchedRepo) { # Run makeReport on the Repository object. addPaReArticle(repo) }
fetchedRepo <- tryCatch( { # Set dir to clone repository to. tempDir <- tempdir() pathToRepo <- file.path(tempDir, "glue") # Clone repo git2r::clone( url = "https://github.com/darwin-eu/IncidencePrevalence.git", local_path = pathToRepo ) # Create instance of Repository object. repo <- PaRe::Repository$new(path = pathToRepo) # Set fetchedRepo to TRUE if all goes well. TRUE }, error = function(e) { # Set fetchedRepo to FALSE if an error is encountered. FALSE }, warning = function(w) { # Set fetchedRepo to FALSE if a warning is encountered. FALSE } ) if (fetchedRepo) { # Run makeReport on the Repository object. addPaReArticle(repo) }
Check package dependencies
checkDependencies(repo, dependencyType = c("Imports", "Depends"), nThreads = 1)
checkDependencies(repo, dependencyType = c("Imports", "Depends"), nThreads = 1)
repo |
( |
dependencyType |
( |
nThreads |
( |
(data.frame()
)
Data frame with all the packages that are now permitted.
column | data type |
package | character() |
version | character() |
# Set cahce, usually not required. withr::local_envvar( R_USER_CACHE_DIR = tempfile() ) fetchedRepo <- tryCatch( { # Set dir to clone repository to. tempDir <- tempdir() pathToRepo <- file.path(tempDir, "glue") # Clone repo git2r::clone( url = "https://github.com/tidyverse/glue.git", local_path = pathToRepo ) # Create instance of Repository object. repo <- PaRe::Repository$new(path = pathToRepo) # Set fetchedRepo to TRUE if all goes well. TRUE }, error = function(e) { # Set fetchedRepo to FALSE if an error is encountered. FALSE }, warning = function(w) { # Set fetchedRepo to FALSE if a warning is encountered. FALSE } ) if (fetchedRepo) { # Use checkDependencies on the Repository object. checkDependencies(repo) checkDependencies(repo, dependencyType = c("Imports", "Suggests")) }
# Set cahce, usually not required. withr::local_envvar( R_USER_CACHE_DIR = tempfile() ) fetchedRepo <- tryCatch( { # Set dir to clone repository to. tempDir <- tempdir() pathToRepo <- file.path(tempDir, "glue") # Clone repo git2r::clone( url = "https://github.com/tidyverse/glue.git", local_path = pathToRepo ) # Create instance of Repository object. repo <- PaRe::Repository$new(path = pathToRepo) # Set fetchedRepo to TRUE if all goes well. TRUE }, error = function(e) { # Set fetchedRepo to FALSE if an error is encountered. FALSE }, warning = function(w) { # Set fetchedRepo to FALSE if a warning is encountered. FALSE } ) if (fetchedRepo) { # Use checkDependencies on the Repository object. checkDependencies(repo) checkDependencies(repo, dependencyType = c("Imports", "Suggests")) }
Checks if suggested packages are installed.
checkInstalled()
checkInstalled()
logical
Logical depending if suggested packages are installed.
Class representing a piece of code.
new()
Initializer method
Code$new(name, lines)
name
(character(1)
)
Name of Code object.
lines
(character(n)
)
Vector of lines Code object.
invisible(self)
print()
Overload generic print, to print Code object.
Code$print(...)
...
further arguments passed to or from other methods. See print.
(character(n)
)
getLines()
Get method for lines.
Code$getLines()
(character(n)
) Vector of lines in the Code object.
getNLines()
Get method for number of lines.
Code$getNLines()
(numeric(1)
) Number of lines in the Code object.
getName()
Get method for Name.
Code$getName()
(character(1)
) Name of the Code object.
clone()
The objects of this class are cloneable with this method.
Code$clone(deep = FALSE)
deep
Whether to make a deep clone.
Other Representations:
File
,
Function
,
Repository
Counts the package lines of a Repository object.
countPackageLines(repo)
countPackageLines(repo)
repo |
(Repository) |
(tibble
)
Tibble containing the amount of lines per file in the Repository object.
fetchedRepo <- tryCatch( { # Set dir to clone repository to. tempDir <- tempdir() pathToRepo <- file.path(tempDir, "glue") # Clone repo git2r::clone( url = "https://github.com/tidyverse/glue.git", local_path = pathToRepo ) # Create instance of Repository object. repo <- PaRe::Repository$new(path = pathToRepo) # Set fetchedRepo to TRUE if all goes well. TRUE }, error = function(e) { # Set fetchedRepo to FALSE if an error is encountered. FALSE }, warning = function(w) { # Set fetchedRepo to FALSE if a warning is encountered. FALSE } ) if (fetchedRepo) { # Run countPackageLines on the Repository object. countPackageLines(repo = repo) }
fetchedRepo <- tryCatch( { # Set dir to clone repository to. tempDir <- tempdir() pathToRepo <- file.path(tempDir, "glue") # Clone repo git2r::clone( url = "https://github.com/tidyverse/glue.git", local_path = pathToRepo ) # Create instance of Repository object. repo <- PaRe::Repository$new(path = pathToRepo) # Set fetchedRepo to TRUE if all goes well. TRUE }, error = function(e) { # Set fetchedRepo to FALSE if an error is encountered. FALSE }, warning = function(w) { # Set fetchedRepo to FALSE if a warning is encountered. FALSE } ) if (fetchedRepo) { # Run countPackageLines on the Repository object. countPackageLines(repo = repo) }
Exports the diagram from pkgDiagram
to a PDF-file.
exportDiagram(diagram, fileName)
exportDiagram(diagram, fileName)
diagram |
(grViz) |
fileName |
(character) |
(NULL
)
fetchedRepo <- tryCatch( { # Set dir to clone repository to. tempDir <- tempdir() pathToRepo <- file.path(tempDir, "glue") # Clone repo git2r::clone( url = "https://github.com/tidyverse/glue.git", local_path = pathToRepo ) # Create instance of Repository object. repo <- PaRe::Repository$new(path = pathToRepo) # Set fetchedRepo to TRUE if all goes well. TRUE }, error = function(e) { # Set fetchedRepo to FALSE if an error is encountered. FALSE }, warning = function(w) { # Set fetchedRepo to FALSE if a warning is encountered. FALSE } ) if (fetchedRepo) { # Run pkgDiagram on the Repository object. pkgDiagram(repo = repo) %>% # Export the diagram to a temp file. exportDiagram(fileName = tempfile()) }
fetchedRepo <- tryCatch( { # Set dir to clone repository to. tempDir <- tempdir() pathToRepo <- file.path(tempDir, "glue") # Clone repo git2r::clone( url = "https://github.com/tidyverse/glue.git", local_path = pathToRepo ) # Create instance of Repository object. repo <- PaRe::Repository$new(path = pathToRepo) # Set fetchedRepo to TRUE if all goes well. TRUE }, error = function(e) { # Set fetchedRepo to FALSE if an error is encountered. FALSE }, warning = function(w) { # Set fetchedRepo to FALSE if a warning is encountered. FALSE } ) if (fetchedRepo) { # Run pkgDiagram on the Repository object. pkgDiagram(repo = repo) %>% # Export the diagram to a temp file. exportDiagram(fileName = tempfile()) }
Class representing a file containing code.
PaRe::Code
-> File
new()
Initializer method
File$new(repoPath, filePath)
invisible(self)
getFunctions()
Get method to get a list of Function objects
File$getFunctions()
(list)
List of Function objects.
getFunctionTable()
Get method to retrieve the function table.
File$getFunctionTable()
column | data type |
name | character |
lineStart | integer |
lineEnd | numeric |
nArgs | integer |
cycloComp | integer |
getType()
Gets type of file
File$getType()
getFilePath()
Gets relative file path
File$getFilePath()
getBlameTable()
Gets table of git blame
File$getBlameTable()
(tibble)
clone()
The objects of this class are cloneable with this method.
File$clone(deep = FALSE)
deep
Whether to make a deep clone.
Other Representations:
Code
,
Function
,
Repository
fetchedRepo <- tryCatch( { # Set dir to clone repository to. tempDir <- tempdir() pathToRepo <- file.path(tempDir, "glue") # Clone repo git2r::clone( url = "https://github.com/tidyverse/glue.git", local_path = pathToRepo ) # Create instance of Repository object. repo <- PaRe::Repository$new(path = pathToRepo) # Set fetchedRepo to TRUE if all goes well. TRUE }, error = function(e) { # Set fetchedRepo to FALSE if an error is encountered. FALSE }, warning = function(w) { # Set fetchedRepo to FALSE if a warning is encountered. FALSE } ) if (fetchedRepo) { files <- repo$getRFiles() files[[1]] }
fetchedRepo <- tryCatch( { # Set dir to clone repository to. tempDir <- tempdir() pathToRepo <- file.path(tempDir, "glue") # Clone repo git2r::clone( url = "https://github.com/tidyverse/glue.git", local_path = pathToRepo ) # Create instance of Repository object. repo <- PaRe::Repository$new(path = pathToRepo) # Set fetchedRepo to TRUE if all goes well. TRUE }, error = function(e) { # Set fetchedRepo to FALSE if an error is encountered. FALSE }, warning = function(w) { # Set fetchedRepo to FALSE if a warning is encountered. FALSE } ) if (fetchedRepo) { files <- repo$getRFiles() files[[1]] }
Class representing a function.
PaRe::Code
-> Function
new()
Initializer for Function object.
Function$new(name, lineStart, lineEnd, lines)
invisible(self)
getFunction()
Get method to get defined functions in a File object.
Function$getFunction()
column | data type |
name | (character) |
lineStart | (integer) |
lineEnd | (numeric) |
nArgs | (integer) |
cycloComp | (integer) |
clone()
The objects of this class are cloneable with this method.
Function$clone(deep = FALSE)
deep
Whether to make a deep clone.
Other Representations:
Code
,
File
,
Repository
fetchedRepo <- tryCatch( { # Set dir to clone repository to. tempDir <- tempdir() pathToRepo <- file.path(tempDir, "glue") # Clone repo git2r::clone( url = "https://github.com/tidyverse/glue.git", local_path = pathToRepo ) # Create instance of Repository object. repo <- PaRe::Repository$new(path = pathToRepo) # Set fetchedRepo to TRUE if all goes well. TRUE }, error = function(e) { # Set fetchedRepo to FALSE if an error is encountered. FALSE }, warning = function(w) { # Set fetchedRepo to FALSE if a warning is encountered. FALSE } ) if (fetchedRepo) { files <- repo$getRFiles() file <- files[[1]] funs <- file$getFunctions() funs[[1]] }
fetchedRepo <- tryCatch( { # Set dir to clone repository to. tempDir <- tempdir() pathToRepo <- file.path(tempDir, "glue") # Clone repo git2r::clone( url = "https://github.com/tidyverse/glue.git", local_path = pathToRepo ) # Create instance of Repository object. repo <- PaRe::Repository$new(path = pathToRepo) # Set fetchedRepo to TRUE if all goes well. TRUE }, error = function(e) { # Set fetchedRepo to FALSE if an error is encountered. FALSE }, warning = function(w) { # Set fetchedRepo to FALSE if a warning is encountered. FALSE } ) if (fetchedRepo) { files <- repo$getRFiles() file <- files[[1]] funs <- file$getFunctions() funs[[1]] }
functionUseGraph
functionUseGraph(repo)
functionUseGraph(repo)
repo |
(graph)
Support function
funsUsedInFile(files, verbose = FALSE)
funsUsedInFile(files, verbose = FALSE)
files |
|
verbose |
(logical) |
(list)
getApplyCall
getApplyCall(fun, defFuns)
getApplyCall(fun, defFuns)
fun |
(Function) |
defFuns |
getApplyFromLines
getApplyFromLines(lines)
getApplyFromLines(lines)
lines |
(c) |
Gets permitted packages. An internet connection is required.
getDefaultPermittedPackages(nThreads = 1)
getDefaultPermittedPackages(nThreads = 1)
nThreads |
( |
(tibble)
column | data type |
package | character |
version | character |
# Set cache withr::local_envvar( R_USER_CACHE_DIR = tempfile() ) if (interactive()) { getDefaultPermittedPackages() }
# Set cache withr::local_envvar( R_USER_CACHE_DIR = tempfile() ) if (interactive()) { getDefaultPermittedPackages() }
Gets all the defined functions from a Repository object.
getDefinedFunctions(repo)
getDefinedFunctions(repo)
repo |
(Repository) |
column | data type |
name | character |
lineStart | integer |
lineEnd | numeric |
nArgs | integer |
cycloComp | integer |
fileName | character |
fetchedRepo <- tryCatch( { # Set dir to clone repository to. tempDir <- tempdir() pathToRepo <- file.path(tempDir, "glue") # Clone repo git2r::clone( url = "https://github.com/tidyverse/glue.git", local_path = pathToRepo ) # Create instance of Repository object. repo <- PaRe::Repository$new(path = pathToRepo) # Set fetchedRepo to TRUE if all goes well. TRUE }, error = function(e) { # Set fetchedRepo to FALSE if an error is encountered. FALSE }, warning = function(w) { # Set fetchedRepo to FALSE if a warning is encountered. FALSE } ) if (fetchedRepo) { repo <- PaRe::Repository$new(pathToRepo) getDefinedFunctions(repo) }
fetchedRepo <- tryCatch( { # Set dir to clone repository to. tempDir <- tempdir() pathToRepo <- file.path(tempDir, "glue") # Clone repo git2r::clone( url = "https://github.com/tidyverse/glue.git", local_path = pathToRepo ) # Create instance of Repository object. repo <- PaRe::Repository$new(path = pathToRepo) # Set fetchedRepo to TRUE if all goes well. TRUE }, error = function(e) { # Set fetchedRepo to FALSE if an error is encountered. FALSE }, warning = function(w) { # Set fetchedRepo to FALSE if a warning is encountered. FALSE } ) if (fetchedRepo) { repo <- PaRe::Repository$new(pathToRepo) getDefinedFunctions(repo) }
getDlplyCall
getDlplyCall(fun, defFuns)
getDlplyCall(fun, defFuns)
fun |
(Function) |
defFuns |
getDlplyCallFromLines
getDlplyCallFromLines(lines)
getDlplyCallFromLines(lines)
lines |
getDoCallFromLines
getDoCallFromLines(lines)
getDoCallFromLines(lines)
lines |
(c) |
Gets all the exported functions of a package, from NAMESPACE.
getExportedFunctions(path)
getExportedFunctions(path)
path |
(character) |
(c) Vector of character exported functions.
getFunCall
getFunCall(fun, defFuns)
getFunCall(fun, defFuns)
fun |
(Function) |
defFuns |
(data.frame) |
Create a subset of the package diagram containing all in comming and out going paths from a specified function.
getFunctionDiagram(repo, functionName)
getFunctionDiagram(repo, functionName)
repo |
(Repository) Repository object. |
functionName |
(character) Name of the function to get all paths from. |
(htmlwidgets
)
Subsetted diagram. See grViz
fetchedRepo <- tryCatch( { # Set dir to clone repository to. tempDir <- tempdir() pathToRepo <- file.path(tempDir, "glue") # Clone repo git2r::clone( url = "https://github.com/tidyverse/glue.git", local_path = pathToRepo ) # Create instance of Repository object. repo <- PaRe::Repository$new(path = pathToRepo) # Set fetchedRepo to TRUE if all goes well. TRUE }, error = function(e) { # Set fetchedRepo to FALSE if an error is encountered. FALSE }, warning = function(w) { # Set fetchedRepo to FALSE if a warning is encountered. FALSE } ) if (fetchedRepo) { # Run getFunctionDiagram on the Repository object. getFunctionDiagram(repo = repo, functionName = "glue") }
fetchedRepo <- tryCatch( { # Set dir to clone repository to. tempDir <- tempdir() pathToRepo <- file.path(tempDir, "glue") # Clone repo git2r::clone( url = "https://github.com/tidyverse/glue.git", local_path = pathToRepo ) # Create instance of Repository object. repo <- PaRe::Repository$new(path = pathToRepo) # Set fetchedRepo to TRUE if all goes well. TRUE }, error = function(e) { # Set fetchedRepo to FALSE if an error is encountered. FALSE }, warning = function(w) { # Set fetchedRepo to FALSE if a warning is encountered. FALSE } ) if (fetchedRepo) { # Run getFunctionDiagram on the Repository object. getFunctionDiagram(repo = repo, functionName = "glue") }
Summarise functions used in R package.
getFunctionUse(repo, verbose = FALSE)
getFunctionUse(repo, verbose = FALSE)
repo |
(Repository) |
verbose |
(logical: FALSE) |
(tibble)
column | data type |
file | character |
line | numeric |
pkg | character |
fun | character |
fetchedRepo <- tryCatch( { # Set dir to clone repository to. tempDir <- tempdir() pathToRepo <- file.path(tempDir, "glue") # Clone repo git2r::clone( url = "https://github.com/tidyverse/glue.git", local_path = pathToRepo ) # Create instance of Repository object. repo <- PaRe::Repository$new(path = pathToRepo) # Set fetchedRepo to TRUE if all goes well. TRUE }, error = function(e) { # Set fetchedRepo to FALSE if an error is encountered. FALSE }, warning = function(w) { # Set fetchedRepo to FALSE if a warning is encountered. FALSE } ) if (fetchedRepo) { # Run getFunctionUse on the Repository object. getFunctionUse(repo = repo, verbose = TRUE) }
fetchedRepo <- tryCatch( { # Set dir to clone repository to. tempDir <- tempdir() pathToRepo <- file.path(tempDir, "glue") # Clone repo git2r::clone( url = "https://github.com/tidyverse/glue.git", local_path = pathToRepo ) # Create instance of Repository object. repo <- PaRe::Repository$new(path = pathToRepo) # Set fetchedRepo to TRUE if all goes well. TRUE }, error = function(e) { # Set fetchedRepo to FALSE if an error is encountered. FALSE }, warning = function(w) { # Set fetchedRepo to FALSE if a warning is encountered. FALSE } ) if (fetchedRepo) { # Run getFunctionUse on the Repository object. getFunctionUse(repo = repo, verbose = TRUE) }
getFunsPerDefFun
getFunsPerDefFun(files, defFuns)
getFunsPerDefFun(files, defFuns)
files |
|
defFuns |
(data.frame) |
column | data type |
from | character |
to | character |
Get the dependency interactions as a graph representation.
getGraphData(repo, packageTypes = c("Imports"), nThreads = 1)
getGraphData(repo, packageTypes = c("Imports"), nThreads = 1)
repo |
(Repository) |
packageTypes |
(c:
|
nThreads |
( |
fetchedRepo <- tryCatch( { # Set dir to clone repository to. tempDir <- tempdir() pathToRepo <- file.path(tempDir, "glue") # Clone repo git2r::clone( url = "https://github.com/tidyverse/glue.git", local_path = pathToRepo ) # Create instance of Repository object. repo <- PaRe::Repository$new(path = pathToRepo) # Set fetchedRepo to TRUE if all goes well. TRUE }, error = function(e) { # Set fetchedRepo to FALSE if an error is encountered. FALSE }, warning = function(w) { # Set fetchedRepo to FALSE if a warning is encountered. FALSE } ) if (fetchedRepo) { # Run getGraphData on the Repository object. if (interactive()) { getGraphData(repo = repo, packageTypes = c("Imports")) } }
fetchedRepo <- tryCatch( { # Set dir to clone repository to. tempDir <- tempdir() pathToRepo <- file.path(tempDir, "glue") # Clone repo git2r::clone( url = "https://github.com/tidyverse/glue.git", local_path = pathToRepo ) # Create instance of Repository object. repo <- PaRe::Repository$new(path = pathToRepo) # Set fetchedRepo to TRUE if all goes well. TRUE }, error = function(e) { # Set fetchedRepo to FALSE if an error is encountered. FALSE }, warning = function(w) { # Set fetchedRepo to FALSE if a warning is encountered. FALSE } ) if (fetchedRepo) { # Run getGraphData on the Repository object. if (interactive()) { getGraphData(repo = repo, packageTypes = c("Imports")) } }
getMultiLineFun
getMultiLineFun(line, lines)
getMultiLineFun(line, lines)
line |
(numeric) |
lines |
graphToDot
graphToDot(graph)
graphToDot(graph)
graph |
(graph) |
htmlwidgets
See grViz.
Get all the lintr messages of the Repository object.
lintRepo(repo)
lintRepo(repo)
repo |
column | data type | description |
filename | character | Name of the file |
line_number | double | Line in which the message was found |
column_number | double | Column in which the message was found |
type | character | Type of message |
message | character | Style, warning, or error message |
line | character | Line of code in which the message was found |
linter | character | Linter used |
fetchedRepo <- tryCatch( { # Set dir to clone repository to. tempDir <- tempdir() pathToRepo <- file.path(tempDir, "glue") # Clone repo git2r::clone( url = "https://github.com/tidyverse/glue.git", local_path = pathToRepo ) # Create instance of Repository object. repo <- PaRe::Repository$new(path = pathToRepo) # Set fetchedRepo to TRUE if all goes well. TRUE }, error = function(e) { # Set fetchedRepo to FALSE if an error is encountered. FALSE }, warning = function(w) { # Set fetchedRepo to FALSE if a warning is encountered. FALSE } ) if (fetchedRepo) { # Run lintRepo on the Repository object. messages <- lintRepo(repo = repo) }
fetchedRepo <- tryCatch( { # Set dir to clone repository to. tempDir <- tempdir() pathToRepo <- file.path(tempDir, "glue") # Clone repo git2r::clone( url = "https://github.com/tidyverse/glue.git", local_path = pathToRepo ) # Create instance of Repository object. repo <- PaRe::Repository$new(path = pathToRepo) # Set fetchedRepo to TRUE if all goes well. TRUE }, error = function(e) { # Set fetchedRepo to FALSE if an error is encountered. FALSE }, warning = function(w) { # Set fetchedRepo to FALSE if a warning is encountered. FALSE } ) if (fetchedRepo) { # Run lintRepo on the Repository object. messages <- lintRepo(repo = repo) }
Function that scores the lintr output as a percentage per message type (style, warning, error). Lintr messages / lines assessed * 100
lintScore(repo, messages)
lintScore(repo, messages)
repo |
(Repository) |
messages |
(data.frame) |
(tibble)
fetchedRepo <- tryCatch( { # Set dir to clone repository to. tempDir <- tempdir() pathToRepo <- file.path(tempDir, "glue") # Clone repo git2r::clone( url = "https://github.com/tidyverse/glue.git", local_path = pathToRepo ) # Create instance of Repository object. repo <- PaRe::Repository$new(path = pathToRepo) # Set fetchedRepo to TRUE if all goes well. TRUE }, error = function(e) { # Set fetchedRepo to FALSE if an error is encountered. FALSE }, warning = function(w) { # Set fetchedRepo to FALSE if a warning is encountered. FALSE } ) if (fetchedRepo) { messages <- lintRepo(repo = repo) # Run lintScore on the Repository object. lintScore(repo = repo, messages = messages) }
fetchedRepo <- tryCatch( { # Set dir to clone repository to. tempDir <- tempdir() pathToRepo <- file.path(tempDir, "glue") # Clone repo git2r::clone( url = "https://github.com/tidyverse/glue.git", local_path = pathToRepo ) # Create instance of Repository object. repo <- PaRe::Repository$new(path = pathToRepo) # Set fetchedRepo to TRUE if all goes well. TRUE }, error = function(e) { # Set fetchedRepo to FALSE if an error is encountered. FALSE }, warning = function(w) { # Set fetchedRepo to FALSE if a warning is encountered. FALSE } ) if (fetchedRepo) { messages <- lintRepo(repo = repo) # Run lintScore on the Repository object. lintScore(repo = repo, messages = messages) }
Makes the graph
makeGraph(funsPerDefFun, pkgName, expFuns, ...)
makeGraph(funsPerDefFun, pkgName, expFuns, ...)
funsPerDefFun |
(data.frame) |
pkgName |
(character) |
expFuns |
(data.frame) |
... |
Optional other parameters for grViz. |
(htmlwidget
)
Diagram of the package. See grViz.
Uses rmarkdown's render function to render a html-report of the given package.
makeReport(repo, outputFile, showCode = FALSE, nThreads = 1)
makeReport(repo, outputFile, showCode = FALSE, nThreads = 1)
repo |
(Repository) |
outputFile |
(character) |
showCode |
(logical: FALSE) |
nThreads |
( |
(NULL
)
fetchedRepo <- tryCatch( { # Set dir to clone repository to. tempDir <- tempdir() pathToRepo <- file.path(tempDir, "glue") # Clone repo git2r::clone( url = "https://github.com/darwin-eu/IncidencePrevalence.git", local_path = pathToRepo ) # Create instance of Repository object. repo <- PaRe::Repository$new(path = pathToRepo) # Set fetchedRepo to TRUE if all goes well. TRUE }, error = function(e) { # Set fetchedRepo to FALSE if an error is encountered. FALSE }, warning = function(w) { # Set fetchedRepo to FALSE if a warning is encountered. FALSE } ) if (fetchedRepo) { # Run makeReport on the Repository object. makeReport(repo = repo, outputFile = tempfile()) }
fetchedRepo <- tryCatch( { # Set dir to clone repository to. tempDir <- tempdir() pathToRepo <- file.path(tempDir, "glue") # Clone repo git2r::clone( url = "https://github.com/darwin-eu/IncidencePrevalence.git", local_path = pathToRepo ) # Create instance of Repository object. repo <- PaRe::Repository$new(path = pathToRepo) # Set fetchedRepo to TRUE if all goes well. TRUE }, error = function(e) { # Set fetchedRepo to FALSE if an error is encountered. FALSE }, warning = function(w) { # Set fetchedRepo to FALSE if a warning is encountered. FALSE } ) if (fetchedRepo) { # Run makeReport on the Repository object. makeReport(repo = repo, outputFile = tempfile()) }
Creates a diagram of all defined functions in a package.
pkgDiagram(repo, verbose = FALSE, ...)
pkgDiagram(repo, verbose = FALSE, ...)
repo |
(Repository) |
verbose |
(logical) |
... |
Optional other parameters for grViz. |
(htmlwidget
)
Diagram htmlwidget
object. See createWidget
fetchedRepo <- tryCatch( { # Set dir to clone repository to. tempDir <- tempdir() pathToRepo <- file.path(tempDir, "glue") # Clone repo git2r::clone( url = "https://github.com/tidyverse/glue.git", local_path = pathToRepo ) # Create instance of Repository object. repo <- PaRe::Repository$new(path = pathToRepo) # Set fetchedRepo to TRUE if all goes well. TRUE }, error = function(e) { # Set fetchedRepo to FALSE if an error is encountered. FALSE }, warning = function(w) { # Set fetchedRepo to FALSE if a warning is encountered. FALSE } ) if (fetchedRepo) { # Run pkgDiagram on the Repository object. pkgDiagram(repo = repo) }
fetchedRepo <- tryCatch( { # Set dir to clone repository to. tempDir <- tempdir() pathToRepo <- file.path(tempDir, "glue") # Clone repo git2r::clone( url = "https://github.com/tidyverse/glue.git", local_path = pathToRepo ) # Create instance of Repository object. repo <- PaRe::Repository$new(path = pathToRepo) # Set fetchedRepo to TRUE if all goes well. TRUE }, error = function(e) { # Set fetchedRepo to FALSE if an error is encountered. FALSE }, warning = function(w) { # Set fetchedRepo to FALSE if a warning is encountered. FALSE } ) if (fetchedRepo) { # Run pkgDiagram on the Repository object. pkgDiagram(repo = repo) }
Class representing the Repository
new()
Initializer for Repository class
Repository$new(path)
path
(character)
Path to R package project
invisible(self)
getName()
Get method for name.
Repository$getName()
(character)
Repository name
getPath()
Get method fro path
Repository$getPath()
(character)
Path to Repository folder
getFiles()
Get method to get a list of File objects.
Repository$getFiles()
getRFiles()
Get method to get only R-files.
Repository$getRFiles()
getDescription()
Get method to get the description of the package. See: description.
Repository$getDescription()
(description)
Description object.
getFunctionUse()
Get method for functionUse, will check if functionUse has already been fetched or not.
Repository$getFunctionUse()
(data.frame)
See getFunctionUse.
gitCheckout()
Method to run 'git checkout <branch/commit hash>'
Repository$gitCheckout(branch, ...)
invisible(self)
gitPull()
Method to run 'git pull'
Repository$gitPull(...)
...
Further parameters for pull.
invisible(self)
gitBlame()
Method to fetch data generated by 'git blame'.
Repository$gitBlame()
(tibble)
column | data type |
repository | character |
author | character |
file | character |
date | character |
lines | integer |
clone()
The objects of this class are cloneable with this method.
Repository$clone(deep = FALSE)
deep
Whether to make a deep clone.
Other Representations:
Code
,
File
,
Function
fetchedRepo <- tryCatch( { # Set dir to clone repository to. tempDir <- tempdir() pathToRepo <- file.path(tempDir, "glue") # Clone repo git2r::clone( url = "https://github.com/tidyverse/glue.git", local_path = pathToRepo ) # Create instance of Repository object. repo <- PaRe::Repository$new(path = pathToRepo) # Set fetchedRepo to TRUE if all goes well. TRUE }, error = function(e) { # Set fetchedRepo to FALSE if an error is encountered. FALSE }, warning = function(w) { # Set fetchedRepo to FALSE if a warning is encountered. FALSE } ) if (fetchedRepo) { repo }
fetchedRepo <- tryCatch( { # Set dir to clone repository to. tempDir <- tempdir() pathToRepo <- file.path(tempDir, "glue") # Clone repo git2r::clone( url = "https://github.com/tidyverse/glue.git", local_path = pathToRepo ) # Create instance of Repository object. repo <- PaRe::Repository$new(path = pathToRepo) # Set fetchedRepo to TRUE if all goes well. TRUE }, error = function(e) { # Set fetchedRepo to FALSE if an error is encountered. FALSE }, warning = function(w) { # Set fetchedRepo to FALSE if a warning is encountered. FALSE } ) if (fetchedRepo) { repo }
data.frame containing links to csv-files which should be used to fetch white-listed dependencies.
whiteList
whiteList
An object of class tbl_df
(inherits from tbl
, data.frame
) with 3 rows and 4 columns.
By default three csv's are listed:
darwin
hades
tidyverse
The data.frame is locally fetched under:
system.file(package = "PaRe", "whiteList.csv")
Manual insertions into this data.frame can be made, or the data.frame can be overwritten entirely.
The data.frame itself has the following structure:
column | data type | description |
source | character | name of the source |
link | character | link or path to the csv-file |
package | character | columnname of the package name column in the csv-file being linked to |
version | character | columnname of the version column in the csv-file being linked to |
The csv-files that are being pointed to should have the following structure:
if (interactive()) { # Dropping tidyverse whiteList <- whiteList %>% dplyr::filter(source != "tidyverse") # getDefaultPermittedPackages will now only use darwin and hades getDefaultPermittedPackages() }
if (interactive()) { # Dropping tidyverse whiteList <- whiteList %>% dplyr::filter(source != "tidyverse") # getDefaultPermittedPackages will now only use darwin and hades getDefaultPermittedPackages() }