Skip to content

Commit

Permalink
v0.2.1 updates
Browse files Browse the repository at this point in the history
Fix #131, Fix #129, Fix #127, Fix #126, Fix #119, Fix #118, Fix #114.
  • Loading branch information
brodieG committed Jan 18, 2019
2 parents c46b4d1 + cc618b5 commit a437322
Show file tree
Hide file tree
Showing 114 changed files with 3,047 additions and 1,195 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
env:
- NOT_CRAN=TRUE _R_CHECK_LENGTH_1_LOGIC2_=TRUE

language: r

r:
- 3.1
- oldrel
Expand Down
26 changes: 7 additions & 19 deletions CRAN.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,16 @@
This is a minor release primarily intended
to address the undeclared dependencies in
tests raised by Professor Hornik.

I have removed the tests in question completely
from the built package. Previously, these tests
were run conditionally.
to add R 3.1 support.

## R CMD check --as-cran

Completes with 'Status: OK'

## Test Environments
On a tarball built with R 3.5.1

I have tested this package against the following
environments:
## Test Environments

* Travis Ubuntu 14.04.5 LTS
* R devel (2018-06-10 r74877)
* R version 3.5.0 (2017-01-27)
* R version 3.4.4 (2017-01-27)
* R version 3.2.5 (2017-01-27)
* Winbuilder
* R devel (2018-06-07 r74865)
https://win-builder.r-project.org/T0GxmEvBfRne
* Locally Mac OS 10.12.6
* R Version 3.5.0 (2017-01-27)
I have tested this package against R-devel on
Winbuilder and on Travis (Linux). Additionally,
I have tested against release and older
versions on Linux and OSx.

8 changes: 5 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Type: Package
Title: Diffs for R Objects
Description: Generate a colorized diff of two R objects for an intuitive
visualization of their differences.
Version: 0.1.11
Date: 2018-07-28
Version: 0.2.1
Date: 2019-01-02
Authors@R: c(
person(
"Brodie", "Gaslam", email="brodie.gaslam@yahoo.com",
Expand All @@ -19,14 +19,16 @@ License: GPL (>= 2)
LazyData: true
URL: https://github.com/brodieG/diffobj
BugReports: https://github.com/brodieG/diffobj/issues
RoxygenNote: 6.0.1
RoxygenNote: 6.1.0.9000
VignetteBuilder: knitr
Encoding: UTF-8
Suggests:
knitr,
rmarkdown,
testthat
Collate:
'capt.R'
'options.R'
'pager.R'
'check.R'
'finalizer.R'
Expand Down
42 changes: 42 additions & 0 deletions DEVNOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,45 @@
## Crayon or Not Crayon

### ANSI detection And Settings

Do we want our substring functions to be ansi blind if we detect that the system
does not support ansi?

One problem right now is that when in 'raw' mode, we set `crayon.enabled=FALSE`,
but we might still be in a system that supports ANSI and the input itself may
have ANSI in it.

Ideally we move away from crayon for ansi detection and rely solely on the
`style` parameter. So probably do that now.

But what about the special case where we are on a system that does not support
ANSI escapes, and we want to see the diffs in the ANSI escapes? Do we just not
support this?

Probably better to add a separate "ansi.sgr.supported" that for now can default
to crayon::has_color()? Then what do we do when someone uses and ANSI style but
this is off? Just use it anyway? And provide global nchar and substr functions
that are aware of this setting? Yes.

## Fansi Problems

Would be great to use fansi instead of crayon for substr as it will be much
faster, and also support wide characters, but there are two major issues:

* We still need a terminal ansi-support test, which is well developed and
tested in crayon.
* The fansi tests use `unitizer`, which suggests `diffobj`; need to check if
this actually would cause a circular dependency or not. So diffobj would
import fansi, which suggests unitizer. Currently unitizer imports diffobj.
So there does seem to be build time circular dependency. We could either
change all the fansi tests to not be unitizer (or move the unitizer tests to
`extra`, and have another version of them that tests output with .Rout files).
This seems like a massive PITA, and also annoying because we'll need to make
sure both sets of tests are run on travis, but not on CRAN, which then makes
it hard to make sure we're submitting the same tarball. The more realistic
solution might be to remove `diffobj` as an `imports` and `suggests` so that
it is possible to build unitizer without diffobj.

## Compiled Testing

Run the 'ses' tests with valgrind. They should have 100% coverage of the C
Expand Down
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Generated by roxygen2: do not edit by hand

S3method(print,diffobj_ogewlhgiadfl)
export(AlignThreshold)
export(Pager)
export(PagerBrowser)
export(PagerOff)
export(PagerSystem)
Expand Down
28 changes: 28 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,33 @@
# diffobj

## v0.2.0-1

### Features

* [#129](https://github.com/brodieG/diffobj/issues/129): Allow pager
specification via lists rather than full `Pager` objects for easier changes to
defaults. As part of this we changed `StyleRaw` objects to use default
pager instead of `PagerOff`.
* [#126](https://github.com/brodieG/diffobj/issues/126): Add embedding diffs in
Shiny to vignette.
* [#119](https://github.com/brodieG/diffobj/issues/119): `ignore.whitespace` now
also ignores white space differences adjoining punctuation.
* [#118](https://github.com/brodieG/diffobj/issues/118): New option to preserve
temporary diff file output when using pager (see `?Pager`).
* [#114](https://github.com/brodieG/diffobj/issues/114): New options `strip.sgr`
and `sgr.supported` allow finer control of what happens when input already
contains ANSI CSI SGR and how ANSI CSI SGR is handled in string manipulations.
Related to this, `options(crayon.enabled=TRUE)` is no longer set when
capturing output prior to diff as it used to be. By default pre-existing ANSI
CSI SGR is stripped with a warning prior to comparison.

### Bugs

* [#131](https://github.com/brodieG/diffobj/issues/131): Fix missing slot in S4
class definition (discovered by Bill Dunlap).
* [#127](https://github.com/brodieG/diffobj/issues/127): Width CSS conflicts
with bootstrap (reported by @eckyu, debugged/fixed by @cpsievert).

## v0.1.11

* [#123](https://github.com/brodieG/diffobj/issues/123): Compatibility with R3.1
Expand Down
40 changes: 20 additions & 20 deletions R/capt.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2018 Brodie Gaslam
# Copyright (C) 2019 Brodie Gaslam
#
# This file is part of "diffobj - Diffs for R Objects"
#
Expand Down Expand Up @@ -57,7 +57,7 @@ capt_print <- function(target, current, etc, err, extra){
if(getRversion() >= "3.2.0") {
print.match <- try(
match.call(
get("print", envir=etc@frame),
get("print", envir=etc@frame, mode='function'),
as.call(c(list(quote(print), x=NULL), dots)),
envir=etc@frame
) )
Expand Down Expand Up @@ -124,22 +124,17 @@ capt_str <- function(target, current, etc, err, extra){

if(getRversion() < "3.2.0") {
# nocov start
str.match <- try(
match.call(
str_tpl,
call=as.call(c(list(quote(str), object=NULL), dots))
) )
str.match <- match.call(
str_tpl,
call=as.call(c(list(quote(str), object=NULL), dots))
)
# nocov end
} else {
str.match <- try(
match.call(
str_tpl,
call=as.call(c(list(quote(str), object=NULL), dots)), envir=etc@frame
) )
str.match <- match.call(
str_tpl,
call=as.call(c(list(quote(str), object=NULL), dots)), envir=etc@frame
)
}
if(inherits(str.match, "try-error"))
err("Unable to compose `str` call")

names(str.match)[[2L]] <- ""

# Handle auto mode (side by side always for `str`)
Expand Down Expand Up @@ -234,10 +229,12 @@ capt_str <- function(target, current, etc, err, extra){
if(!max.level.supplied) {
repeat{
if((safety <- safety + 1L) > max.depth && !first.loop)
# nocov start
stop(
"Logic Error: exceeded list depth when comparing structures; contact ",
"maintainer."
)
# nocov end
if(!first.loop) {
tar.str <- tar.capt[tar.lvls <= lvl]
cur.str <- cur.capt[cur.lvls <= lvl]
Expand Down Expand Up @@ -381,11 +378,11 @@ capt_csv <- function(target, current, etc, err, extra){
tar.df <- try(do.call(read.csv, c(list(target), extra), quote=TRUE))
if(inherits(tar.df, "try-error")) err("Unable to read `target` file.")
if(!is.data.frame(tar.df))
err("`target` file did not produce a data frame when read")
err("`target` file did not produce a data frame when read") # nocov
cur.df <- try(do.call(read.csv, c(list(current), extra), quote=TRUE))
if(inherits(cur.df, "try-error")) err("Unable to read `current` file.")
if(!is.data.frame(cur.df))
err("`current` file did not produce a data frame when read")
err("`current` file did not produce a data frame when read") # nocov

capt_print(tar.df, cur.df, etc, err, extra)
}
Expand All @@ -394,11 +391,14 @@ capt_csv <- function(target, current, etc, err, extra){

set_mode <- function(etc, tar.capt, cur.capt) {
stopifnot(is(etc, "Settings"), is.character(tar.capt), is.character(cur.capt))
nc_fun <- etc@style@nchar.fun
if(etc@mode == "auto") {
if(
any(nc_fun(cur.capt) > etc@text.width.half) ||
any(nc_fun(tar.capt) > etc@text.width.half)
any(
nchar2(cur.capt, sgr.supported=etc@sgr.supported) > etc@text.width.half
) ||
any(
nchar2(tar.capt, sgr.supported=etc@sgr.supported) > etc@text.width.half
)
) {
etc@mode <- "unified"
} }
Expand Down

0 comments on commit a437322

Please sign in to comment.