Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ build.xml
.project
.*\.tar\.gz
.gitignore
.travis.yml
.*\.tar
wiki
^\.github$
1 change: 1 addition & 0 deletions .github/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.html
44 changes: 44 additions & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Workflow derived from https://github.com/r-lib/actions/tree/master/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on: [push, pull_request]

name: R-CMD-check

jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})

strategy:
fail-fast: false
matrix:
config:
- { os: macOS-latest, r: "release" }
- { os: windows-latest, r: "release" }
- { os: ubuntu-latest, r: "devel", http-user-agent: "release" }
- { os: ubuntu-latest, r: "release" }
- { os: ubuntu-latest, r: "oldrel-1" }

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v2

- uses: r-lib/actions/setup-pandoc@v1

- uses: r-lib/actions/setup-r@v1
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v1
with:
extra-packages: any::rcmdcheck, package=rdt?ignore, package=rdtLite?ignore

- uses: r-lib/actions/check-r-package@v1
env:
_R_CHECK_FORCE_SUGGESTS_: false
28 changes: 0 additions & 28 deletions .travis.yml

This file was deleted.

46 changes: 30 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,64 +1,78 @@
# provDebugR

A debugging tool that leverages provenance to provide handy information
[![R-CMD-check](https://github.com/End-to-end-provenance/provDebugR/workflows/R-CMD-check/badge.svg)](https://github.com/End-to-end-provenance/provDebugR/actions)

A debugging tool that leverages provenance to provide handy information
about R scripts to assist in writing them.

For a more in-depth description of the functions available in this package
For a more in-depth description of the functions available in this package
please [refer to the Wiki.](https://github.com/End-to-end-provenance/provDebugR/wiki/)

# Installation

Version 3.5.0 or later of R is required.

Devtools is needed for installation:

```{r}
install.packages("devtools")
```

Installation of all required packages (can be copied and pasted):

```{r}
install.packages("provParseR")
install.packages("provGraphR")
install.packages("rdtLite")
devtools::install_github("End-to-end-provenance/provDebugR")
```

provDebugR also imports:
* httr
* igraph
* jsonlite
* methods
* testthat
* textutils

- httr
- igraph
- jsonlite
- methods
- testthat
- textutils

Once installed, load provDebugR by calling:

```{r}
library("provDebugR")
```

# Usage

To initialise the debugger with a script, call:

```{r}
prov.debug.run("scriptName.R", snapshot.size = 100)
```

Alternatively, if you just called [`rdtLite`](https://CRAN.R-project.org/package=rdtLite)'s
`prov.run` function, you can call:

```{r}
prov.debug()
```

Lastly, if you have the PROV-JSON provenance file, you can also call:

```{r}
prov.debug.file("provJsonFileName.json")
```

Once the debugger has been initialised, the rest of the functions the package
provides can be used.

To find out more about what each function does, please
To find out more about what each function does, please
[refer to the Wiki.](https://github.com/End-to-end-provenance/provDebugR/wiki/)
* [debug.error](https://github.com/End-to-end-provenance/provDebugR/wiki/debug.error)
* [debug.line](https://github.com/End-to-end-provenance/provDebugR/wiki/debug.line)
* [debug.lineage](https://github.com/End-to-end-provenance/provDebugR/wiki/debug.lineage)
* [debug.state](https://github.com/End-to-end-provenance/provDebugR/wiki/debug.state)
* [debug.type.changes](https://github.com/End-to-end-provenance/provDebugR/wiki/debug.type.changes)
* [debug.variable](https://github.com/End-to-end-provenance/provDebugR/wiki/debug.variable)
* [debug.warning](https://github.com/End-to-end-provenance/provDebugR/wiki/debug.warning)

- [debug.error](https://github.com/End-to-end-provenance/provDebugR/wiki/debug.error)
- [debug.line](https://github.com/End-to-end-provenance/provDebugR/wiki/debug.line)
- [debug.lineage](https://github.com/End-to-end-provenance/provDebugR/wiki/debug.lineage)
- [debug.state](https://github.com/End-to-end-provenance/provDebugR/wiki/debug.state)
- [debug.type.changes](https://github.com/End-to-end-provenance/provDebugR/wiki/debug.type.changes)
- [debug.variable](https://github.com/End-to-end-provenance/provDebugR/wiki/debug.variable)
- [debug.warning](https://github.com/End-to-end-provenance/provDebugR/wiki/debug.warning)
86 changes: 43 additions & 43 deletions tests/testthat/test_init.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,49 +11,49 @@ test_that("Initialization - Empty provenance",
expect_false(provDebugR:::.debug.env$has.graph)
})

# .get.full.code
# tests the helper function of .get.full.code
# this is to prevent travis from having to run rdt/rdtLite
test_that("Initialization - .get.full.code",
{
# FUNCTION INPUTS
# get proc.nodes
json <- system.file("testdata", "exceptions.json", package = "provDebugR")
prov <- provParseR::prov.parse(json, isFile = TRUE)
proc.nodes <- provParseR::get.proc.nodes(prov)

# saved scripts
script1 <- system.file("testscripts", "exceptions.R", package = "provDebugR")
script2 <- system.file("testscripts", "source_warning.R", package = "provDebugR")
script3 <- system.file("testscripts", "source_error.R", package = "provDebugR")

s1 <- c(script1, script2, script3) # all scripts are found
s2 <- c("unknown1", "unknown2", "unknown3") # no scripts found
s3 <- c(script1, script2, "unknown3") # some scripts found, some not found

# CASES
c1 <- provDebugR:::.get.full.code.helper(proc.nodes, s1) # all scripts are found
expect_warning( # no scripts found
c2 <- provDebugR:::.get.full.code.helper(proc.nodes, s2))
expect_warning( # some scripts found, some not found
c3 <- provDebugR:::.get.full.code.helper(proc.nodes, s3))

# EXPECTED
e1 <- system.file("testexpected", "fullCode.csv", package = "provDebugR")
e3 <- system.file("testexpected", "fullCode_missingScripts.csv", package = "provDebugR")

e1 <- read.csv(e1, header = TRUE, row.names = 1, stringsAsFactors = FALSE)
e3 <- read.csv(e3, header = TRUE, row.names = 1, stringsAsFactors = FALSE)

e1 <- e1[ , 1] # all scripts are found
e2 <- proc.nodes$name # no scripts found
e3 <- e3[ , 1] # some scripts found, some not found

# TEST
expect_equal(c1, e1)
expect_equal(c2, e2)
expect_equal(c3, e3)
})
# # .get.full.code
# # tests the helper function of .get.full.code
# # this is to prevent travis from having to run rdt/rdtLite
# test_that("Initialization - .get.full.code",
# {
# # FUNCTION INPUTS
# # get proc.nodes
# json <- system.file("testdata", "exceptions.json", package = "provDebugR")
# prov <- provParseR::prov.parse(json, isFile = TRUE)
# proc.nodes <- provParseR::get.proc.nodes(prov)

# # saved scripts
# script1 <- system.file("testscripts", "exceptions.R", package = "provDebugR")
# script2 <- system.file("testscripts", "source_warning.R", package = "provDebugR")
# script3 <- system.file("testscripts", "source_error.R", package = "provDebugR")

# s1 <- c(script1, script2, script3) # all scripts are found
# s2 <- c("unknown1", "unknown2", "unknown3") # no scripts found
# s3 <- c(script1, script2, "unknown3") # some scripts found, some not found

# # CASES
# c1 <- provDebugR:::.get.full.code.helper(proc.nodes, s1) # all scripts are found
# expect_warning( # no scripts found
# c2 <- provDebugR:::.get.full.code.helper(proc.nodes, s2))
# expect_warning( # some scripts found, some not found
# c3 <- provDebugR:::.get.full.code.helper(proc.nodes, s3))

# # EXPECTED
# e1 <- system.file("testexpected", "fullCode.csv", package = "provDebugR")
# e3 <- system.file("testexpected", "fullCode_missingScripts.csv", package = "provDebugR")

# e1 <- read.csv(e1, header = TRUE, row.names = 1, stringsAsFactors = FALSE)
# e3 <- read.csv(e3, header = TRUE, row.names = 1, stringsAsFactors = FALSE)

# e1 <- e1[ , 1] # all scripts are found
# e2 <- proc.nodes$name # no scripts found
# e3 <- e3[ , 1] # some scripts found, some not found

# # TEST
# expect_equal(c1, e1)
# expect_equal(c2, e2)
# expect_equal(c3, e3)
# })

# .get.scripts
test_that("Initialization - .get.scripts",
Expand Down