Git Product home page Git Product logo

badgecreatr's Introduction

Project Status: Active The project has reached a stable, usable state and is being actively developed. Licence codecov minimal R version CRAN_Status_Badge packageversion Last-changedate

Status Master branch: Build Status

Status Develop branch: Build Status

Introduction

This package was inspired by the badgerbadger package that checks for badges of travis, code coverage open issues, dependencies and licenses. It would be nice to have a simple function that adds these things to a readme.rmd file in R. It will save you typing and searching for the exact markdown on the websites of travis, codecov, repostatus.org etc.

This package does now place the following badges /shields:

  • repo status according to https://www.repostatus.org/
  • licence (recognize from DESCRIPTION file)
  • travis shield
  • code coverage
  • minimal R version (recognize from DESCRIPTION file)
  • cran badge
  • packageversion (recognize from DESCRIPTION file)
  • last change (this will automagically update everytime you knit your readme.rmd)
  • finds github account and reponame automatically
  • finds local repo
  • nr of open issues
  • number of pull requests
  • rdocumentation badge

Possible future badges

  • number of downloads CRAN
  • number of dependencies and:
  • a way to visualize their version
  • project lifecycle badge as used by tidyverse

Other changes initiatilzation on readme.md only (without active components)

Workflow

I like to use the following workflow:

  • start a new project in rstudio
  • after some functions are made start a package
  • start a github repo
  • create a readme.rmd
  • ( this is where badgecreatr comes in) create badges
  • continue with the project
  • submit to cran, bioconductor, ropensci etc

You will probably call badgecreatr only once, somewhere during your work.

If you call badgecreatr again when you already have badges, they will be recognized. [(see NEWS)]](NEWS.md)

Installation

badgecreatr is on CRAN, install using install.packages("badgecreatr"). But is has a flaw that I have fixed in the dev version.

The newest 'developmental' version is installed with devtools::install_github("rmhogervorst/badgecreatr")

Use

You can use this package in multiple ways: add a bunch of badges at once with badgecreatr::badgeplacer(), or you can add the badges with seperate commands, I have named them all badge_* so that autocomplete will make it much easier for you to find the correct one. See the vignette about scenarios of use for more info.

Contact

Want to help or have questions? Contact me directly, use an issue, fork me or submit a pull request.

star this repo fork this repo

Inspiration

I found the projectstatus https://www.repostatus.org/ and the wonderful shields.io projects and wanted to implement that for all my packages. But that took a lot of work. Repetitive work, and I don't like that.

The badgerbadgerbadger project in ruby did all these things automatically. I wanted to do the same thing for R projects. And I did.

badgecreatr's People

Contributors

andrie avatar katrinleinweber avatar privefl avatar rmhogervorst avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

badgecreatr's Issues

seperate and create for different scenarios

-[] scenario 1: starting a package with minimal badges. (base version as is) only keep the one time stamps

  • [] scenario 2: base version but with logic added to seperate code part that tracks changes to R version, change date and versions.
  • [] scenario 3: you already have some badges, but you want to add newer ones (cran, rdocumentation, travis, etc).
  • [] scenario 4: you want to add certain badges, essentially a list of badges that you want, regardless of whats already there (so it should ignore badges, ignore if there is a travis file)

Functions not working (Linux, Ubuntu 16.04.1)

Using the CRAN version:

findbadges()
Error in stringr::str_match(grep("R \\(", description, value = TRUE),  : 
  subscript out of bounds

Same error message for badgecreatr().

Using the Github version:

> findbadges()
$projectstatus_readme
[1] TRUE

$licencebadge_readme
[1] FALSE

$travisbadge_readme
[1] TRUE

$codecoverage_readme
[1] FALSE

$rversion_readme
[1] TRUE

$cranbadge_readme
[1] TRUE

$packageversionbadge_readme
[1] TRUE

$last_change_readme
[1] TRUE

$licence
[1] "MIT +"

$packagename
[1] "oddsratio"

$travisfile
[1] TRUE

$codecov_in_travisfile
[1] FALSE

Warning message:
In readLines(".travis.yml") : incomplete final line found on '.travis.yml'

I definitely have a .travis.yml file in my wd.
Calling the functions from the directory root of my R package.
Path: "~/someName/PackageName"

check if R version is given in DESCRIPTION file, if not give warning and use current version

Or check minimal requirements in DESCRIPTION.

according to CRAN
The ‘Package’, ‘Version’, ‘License’, ‘Description’, ‘Title’, ‘Author’, and ‘Maintainer’ fields are mandatory, all other fields are optional. Fields ‘Author’ and ‘Maintainer’ can be auto-generated from ‘Authors@R’, and may be omitted if the latter is provided: however if they are not ASCII we recommend that they are provided.

depends does not need to have a version for R.

Perhaps use current version of R and give warning

shields for licences

codecov badge,

recognize that codecov is active in travis
automagically create link to codecov

warnings in cmd check:: non-ASCII characters ... WARNING

==> devtools::check(cleanup = FALSE)

Updating badgecreatr documentation
Loading badgecreatr
Writing NAMESPACE
Writing badgecreatr.Rd
Writing travisbadge.Rd
Writing projectstatusbadge.Rd
Setting env vars ---------------------------------------------------------------
CFLAGS : -Wall -pedantic
CXXFLAGS: -Wall -pedantic
Building badgecreatr -----------------------------------------------------------
"C:/PROGRA1/R/R-321.4RE/bin/x64/R" --no-site-file --no-environ --no-save
--no-restore --quiet CMD build
"D:\RmhDocs\Documents\docs\actief\Projecten\badgecreatr" --no-resave-data
--no-manual

  • checking for file 'D:\RmhDocs\Documents\docs\actief\Projecten\badgecreatr/DESCRIPTION' ... OK
  • preparing 'badgecreatr':
  • checking DESCRIPTION meta-information ... OK
  • checking for LF line-endings in source and make files
  • checking for empty or unneeded directories
  • building 'badgecreatr_0.0.0.9000.tar.gz'

Setting env vars ---------------------------------------------------------------
R_CHECK_CRAN_INCOMING : FALSE
R_CHECK_FORCE_SUGGESTS: FALSE
Checking badgecreatr -----------------------------------------------------------
"C:/PROGRA1/R/R-321.4RE/bin/x64/R" --no-site-file --no-environ --no-save
--no-restore --quiet CMD check
"C:\Users\roel\AppData\Local\Temp\Rtmpi6Bbiv/badgecreatr_0.0.0.9000.tar.gz"
--as-cran --timings --no-manual

  • using log directory 'D:/RmhDocs/Documents/docs/actief/Projecten/badgecreatr.Rcheck'

  • using R version 3.2.4 Revised (2016-03-16 r70336)

  • using platform: x86_64-w64-mingw32 (64-bit)

  • using session charset: ISO8859-1

  • using options '--no-manual --as-cran'

  • checking for file 'badgecreatr/DESCRIPTION' ... OK

  • this is package 'badgecreatr' version '0.0.0.9000'

  • package encoding: UTF-8

  • checking package namespace information ... OK

  • checking package dependencies ... OK

  • checking if this is a source package ... OK

  • checking if there is a namespace ... OK

  • checking for executable files ... OK

  • checking for hidden files and directories ... OK

  • checking for portable file names ... OK

  • checking whether package 'badgecreatr' can be installed ... OK

  • checking installed package size ... OK

  • checking package directory ... OK

  • checking DESCRIPTION meta-information ... OK

  • checking top-level files ... OK

  • checking for left-over files ... OK

  • checking index information ... OK

  • checking package subdirectories ... OK

  • checking R files for non-ASCII characters ... WARNING
    Found the following file with non-ASCII characters:
    searches.R
    Portable packages must use only ASCII characters in their R code,
    except perhaps in comments.
    Use \uxxxx escapes for other characters.

  • checking R files for syntax errors ... OK

  • checking whether the package can be loaded ... OK

  • checking whether the package can be loaded with stated dependencies ... OK

  • checking whether the package can be unloaded cleanly ... OK

  • checking whether the namespace can be loaded with stated dependencies ... OK

  • checking whether the namespace can be unloaded cleanly ... OK

  • checking loading without being on the library search path ... OK

  • checking dependencies in R code ... OK

  • checking S3 generic/method consistency ... OK

  • checking replacement functions ... OK

  • checking foreign function calls ... OK

  • checking R code for possible problems ... OK

  • checking Rd files ... OK

  • checking Rd metadata ... OK

  • checking Rd line widths ... OK

  • checking Rd cross-references ... OK

  • checking for missing documentation entries ... OK

  • checking for code/documentation mismatches ... OK

  • checking Rd \usage sections ... OK

  • checking Rd contents ... OK

  • checking for unstated dependencies in examples ... OK

  • checking examples ... OK

  • checking for unstated dependencies in 'tests' ... OK

  • checking tests ...
    Running 'testthat.R' ERROR
    Running the tests in 'tests/testthat.R' failed.
    Last 13 lines of output:
    12: callGeneric(repo = lookup_repository(), flags = flags)
    13: eval(call, parent.frame())
    14: eval(expr, envir, enclos)
    15: branches(repo = lookup_repository(), flags = flags)
    16: lookup_repository()
    17: stop("The working directory is not in a git repository")

    testthat results ================================================================
    OK: 10 SKIPPED: 0 FAILED: 1

    1. Error: travisbadge function creates output

    Error: testthat unit tests failed
    Execution halted

  • DONE
    Status: 1 ERROR, 1 WARNING

Warning message:
running command '"C:/PROGRA1/R/R-321.4RE/bin/x64/R" CMD BATCH --vanilla "testthat.R" "testthat.Rout"' had status 1

See
'D:/RmhDocs/Documents/docs/actief/Projecten/badgecreatr.Rcheck/00check.log'
for details.

checking tests ... ERROR
Running the tests in 'tests/testthat.R' failed.
Last 13 lines of output:
12: callGeneric(repo = lookup_repository(), flags = flags)
13: eval(call, parent.frame())
14: eval(expr, envir, enclos)
15: branches(repo = lookup_repository(), flags = flags)
16: lookup_repository()
17: stop("The working directory is not in a git repository")

testthat results ================================================================
OK: 10 SKIPPED: 0 FAILED: 1

  1. Error: travisbadge function creates output

    Error: testthat unit tests failed
    Execution halted

checking R files for non-ASCII characters ... WARNING
Found the following file with non-ASCII characters:
searches.R
Portable packages must use only ASCII characters in their R code,
except perhaps in comments.
Use \uxxxx escapes for other characters.
R CMD check results
1 error | 1 warning | 0 notes
Warning message:
cleanup is deprecated

another new badge

rpackages.io rank

[![rpackages.io rank](https://www.rpackages.io/badge/badgecreatr.svg)](https://www.rpackages.io/package/badgecreatr)

Error in stringr::str_match

Hello,

I just installed your package and tested it with:
badgecreatr::badgeplacer(status = "wip", githubaccount = "privefl", githubrepo = "mypack").
Yes, I was not inspired with the name, I should change it in the near future.
I got the following error:
Error in stringr::str_match(grep("R \\(", description, value = TRUE), : subscript out of bounds.

Note that I already have a README.Rmd with some badges in it (got them from devtools):
README.zip

Thanks for this package anyway.
Florian

change badgecreator function so that it accepts arguments for github username and name of project.

simple fix for if github username and stuff cannot be read from git2r.

makes it easier to implement.

something like:

badgecreate(status = "active", travis = TRUE, codecov = TRUE, licence = "search", githubaccount = "search", githubrepo = "search")

where it says search, the function will search for the information. options:

  • status one of: concept, wip, suspended, abandoned, active, inactive, unsupported
  • travis: true or false
  • codecov true or false
  • licence: search for licence in description or MIT, GPL-3 GPL-2, proprietary, CC0,
  • githubaccount: search using git2r or name it
  • githubrepo: search using git2r or name it

vignette idea: how to extend this package

give overview of project and how to help with links to github project.

explain:
new badges should have:

  • unit test in test_badges
  • export markdown
  • have a description of arguments in Roxygen style
  • have #' @family badges
  • description in changelog

Don't add dividers if no badges are to be added

When I re-run badgecreatr::badgeplacer(), my README.rmd file gets an extra set of dividers added to the top of the file. It would be really neat if badgecreatr could not add anything to the file if all the badges are already present.

badgeplacer function

When I run the badgeplacer(...) function, this error appears:

Error in search_git(location) :
trying to get slot "name" from an object (class "git_branch") that is not an S4 object

R version badge?

Add a badge for R version, if it is bioconductor available?

Perhaps link to old current dev? Needs to depend on something else, current version?
Or based on travis report?

bring back the functions

perhaps paste the functions in the rmarkdown document. That way the correct badge is placed when things change. Small change because the separate badge functions already paste the correct markdown.

Ideally:
badgeplacer::place_badges()

markdown for things that do not change: travis, github, cran. codecov
r for volatile things: rversion, package version badge , last change, projectstatus

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.