Skip to content

Commit

Permalink
Merge pull request #151 from MangoTheCat/release-1.0.3
Browse files Browse the repository at this point in the history
Release 1.0.3
  • Loading branch information
KarinaMarks committed Jul 13, 2022
2 parents 62ceff2 + c22b345 commit 52f458a
Show file tree
Hide file tree
Showing 102 changed files with 3,371 additions and 3,219 deletions.
12 changes: 7 additions & 5 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
^.*\.Rproj$
^\.Rproj\.user$
^Makefile$
^README.Rmd$
^.travis.yml$
^appveyor.yml$
^appveyor\.yml$
index.Rmd
index.md
^docs$
^docs$
^\.github$
^codecov\.yml$
^LICENSE\.md$
^CRAN-SUBMISSION$
^cran-comments\.md$
^pkgdown
1 change: 1 addition & 0 deletions .github/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.html
49 changes: 49 additions & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]

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@v2

- uses: r-lib/actions/setup-r@v2
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@v2
with:
extra-packages: any::rcmdcheck
needs: check

- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
50 changes: 50 additions & 0 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
on:
push:
branches:
- main
- master
tags:
-'*'

name: pkgdown

jobs:
pkgdown:
runs-on: macOS-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2

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

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

- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}

- name: Restore R package cache
uses: actions/cache@v2
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-

- name: Install dependencies
run: |
remotes::install_deps(dependencies = TRUE)
install.packages("pkgdown", type = "binary")
shell: Rscript {0}

- name: Install package
run: R CMD INSTALL .

- name: Deploy package
run: |
git config --local user.email "actions@github.com"
git config --local user.name "GitHub Actions"
Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)'
31 changes: 31 additions & 0 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]

name: test-coverage

jobs:
test-coverage:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v2

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::covr
needs: coverage

- name: Test coverage
run: covr::codecov(quiet = FALSE)
shell: Rscript {0}
11 changes: 0 additions & 11 deletions .travis.yml

This file was deleted.

70 changes: 54 additions & 16 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,30 +1,59 @@
Package: goodpractice
Title: Advice on R Package Building
Version: 1.0.2.9000
Authors@R: c(person("Gabor", "Csardi", email = "csardi.gabor@gmail.com",
role = c("aut")),
person("Hannah", "Frick", email = "hfrick@mango-solutions.com",
role = c("aut", "cre")))
Version: 1.0.3
Authors@R:
c(person(given = "Ascent Digital Services UK Limited",
role = "cph",
comment = c(GitHub = "MangoTheCat")),
person(given = "Karina",
family = "Marks",
role = c("aut", "cre"),
email = "karina.marks@ascent.io",
comment = c(GitHub = "KarinaMarks")),
person(given = "Daniel",
family = "de Bortoli",
role = c("aut"),
comment = c(GitHub = "ddbortoli")),
person(given = "Gabor",
family = "Csardi",
role = "aut",
email = "csardi.gabor@gmail.com"),
person(given = "Hannah",
family = "Frick",
role = "aut",
email = "hannah.frick@gmail.com"),
person(given = "Owen",
family = "Jones",
role = "aut",
email = "owenjonesuob@gmail.com",
comment = c(GitHub = "owenjonesuob")),
person(given = "Hannah",
family = "Alexander",
role = "aut",
email = "halexander@mango-solutions.com"),
person(given = "Ana",
family = "Simmons",
role = c("ctb"),
email = "ana.simmons@ascent.io",
comment = c(GitHub = "anasimmons")),
person(given = "Fabian",
family = "Scheipl",
role = "ctb",
comment = c(GitHub = "fabian-s")))
Description: Give advice about good practices when building R packages.
Advice includes functions and syntax to avoid, package structure,
code complexity, code formatting, etc.
Advice includes functions and syntax to avoid, package structure, code
complexity, code formatting, etc.
License: MIT + file LICENSE
LazyData: true
URL: https://github.com/mangothecat/goodpractice
BugReports: https://github.com/mangothecat/goodpractice/issues
RoxygenNote: 6.0.1
Suggests:
testthat,
knitr,
rmarkdown
Imports:
clisymbols,
covr,
crayon,
cyclocomp (>= 1.1.0),
desc,
jsonlite,
lintr,
lintr (>= 3.0.0),
praise,
rcmdcheck,
rstudioapi,
Expand All @@ -34,7 +63,17 @@ Imports:
withr,
xml2,
xmlparsedata (>= 1.0.1)
Collate:
Suggests:
knitr,
rmarkdown,
testthat (>= 3.0.0)
VignetteBuilder:
knitr
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.1.2
Config/testthat/edition: 3
Collate:
'api.R'
'customization.R'
'lists.R'
Expand All @@ -58,4 +97,3 @@ Collate:
'print.R'
'rstudio_markers.R'
'utils.R'
VignetteBuilder: knitr
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
YEAR: 2016
COPYRIGHT HOLDER: Mango Solutions
YEAR: 2022
COPYRIGHT HOLDER: Ascent Digital Services UK Limited
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# MIT License

Copyright (c) 2022 Ascent Digital Services UK Limited

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
5 changes: 0 additions & 5 deletions Makefile

This file was deleted.

27 changes: 24 additions & 3 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
# 1.0.2
# goodpractice 1.0.3

First CRAN release
Additions:

* Limit for cyclomatic complexity check can be adjusted using the `goodpractice.cyclocomp.limit` option, default 50 (#132, @fabian-s).
* The number of lines printed to the console by each check result can be set using the new `positions_limit` parameter into `print()` - previously it was always 5 lines (#130, @fabian-s).
* GitHub Actions now used for CI/CD checks (#145), as well as to calculate code coverage with {covr} and build the package site with {pkgdown}.



Bugfixes:

* Documentation for custom checks significantly improved (#133, @fabian-s).
* Year updated in `LICENSE`, and `LICENSE.md` added to clarify that {goodpractice} uses the MIT license (#144).




# goodpractice 1.0.2 (2018-06-14)

First CRAN release.

- added 2 vignettes
- added examples
Expand All @@ -9,6 +27,9 @@ First CRAN release
- fixed check on library/require calls on windows
- wrapped prep steps in try

# 1.0.0



# goodpractice 1.0.0

First public release.
10 changes: 7 additions & 3 deletions R/chk_cyclocomp.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

#' @include lists.R

cyclocomp_limit <- 50


CHECKS$cyclocomp <- make_check(

Expand All @@ -10,6 +10,7 @@ CHECKS$cyclocomp <- make_check(
preps = "cyclocomp",

gp = function(state) {
cyclocomp_limit <- getOption("goodpractice.cyclocomp.limit", 50)
cyc <- state$cyclocomp
long <- which(cyc$cyclocomp > cyclocomp_limit)
funcs <- paste0(
Expand All @@ -19,12 +20,15 @@ CHECKS$cyclocomp <- make_check(
)
paste0(
"write short and simple functions. These functions have high
cyclomatic complexity:", funcs, "."
cyclomatic complexity (>", cyclocomp_limit,"): ", funcs, ". ",
"You can make them easier to reason about by encapsulating distinct steps
of your function into subfunctions."
)
},

check = function(state) {
if(inherits(state$cyclocomp, "try-error")) return(NA)
cyclocomp_limit <- getOption("goodpractice.cyclocomp.limit", 50)
if (inherits(state$cyclocomp, "try-error")) return(NA)
all(state$cyclocomp$cyclocomp <= cyclocomp_limit)
}
)

0 comments on commit 52f458a

Please sign in to comment.