Skip to content

Commit

Permalink
Merge pull request #195 from pharmaverse/159-185-blank-line-spellcheck
Browse files Browse the repository at this point in the history
159 185 blank line spellcheck
  • Loading branch information
bms63 committed Sep 8, 2023
2 parents 1962368 + b55de2c commit cb1208e
Show file tree
Hide file tree
Showing 9 changed files with 67 additions and 12 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/spellcheck.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: Spellcheck

on:
push:
branches:
- main
- dev
pull_request:
branches:
- main
- dev

jobs:
spell:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3

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

- uses: r-lib/actions/setup-r-dependencies@v2
with:
needs: spelling

- name: Run Spelling Check test
uses: insightsengineering/r-spellcheck-action@v3
with:
exclude: data/*
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- Moved website theme to bootstrap 5, enabled search (#179)
- Add `show_repo_url` option in `axecute()` to capture repo URL(s) into log file (#167)
- Moved website theme to bootstarp 5, enabled search (#179)
- Moved website theme to Bootstrap 5, enabled search (#179)
- Add `include_rds` argument to `axecute()` to export log as rds file
- Add `library_call_linter()` to ensure all library calls are at the top of the script (#163)
- Remove argument for remove_log_object from `axecute()` still accessible via `log_write()` (#182)
Expand Down
2 changes: 1 addition & 1 deletion R/interact.R
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ run_safely_loudly <- function(file) {
set_log_element("result", ret$result$result)
set_log_element("warnings", ret$warnings)
set_log_element("errors", ret$result$error)
set_log_element("hash_sum", digest::sha1(readLines(file)))
set_log_element("hash_sum", digest::sha1(readLines(file, warn = FALSE)))

# Session Info
set_log_element("session_info", get_session_info())
Expand Down
2 changes: 1 addition & 1 deletion R/log.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
### Functions to initialise, configure, cleanup, and write the log.rx environment

#' Initialisation of the log.rx environment
#' Initialization of the log.rx environment
#'
#' `log_init()` initialises the log.rx environment
#'
Expand Down
22 changes: 22 additions & 0 deletions inst/WORDLIST
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,25 @@ SDTM
tidyr
rds
logrx
addin
Angly
axecution
customizable
devtools
hashsum
Hotfix
Linter
linters
lintr
logrxpackage
param
Patil
Ren
repo
Rosenstock
Rscript
rx
sessionInfo
tidylog
initialises
scrollable
2 changes: 1 addition & 1 deletion man/log_init.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vignettes/articles/tidylog.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Below we have a simple script using the `us_rent_income` dataset. We will explo
<br>
Using `axecute(ex1_tidylog.R)` we produce a log file. Below we snapshot just the pertinent information for users interested in the `{tidylog}` feeback. This feedback is placed by the `{logrx}` package into the `Messages, Output, and Result` section of the log.
Using `axecute(ex1_tidylog.R)` we produce a log file. Below we snapshot just the pertinent information for users interested in the `{tidylog}` feedback. This feedback is placed by the `{logrx}` package into the `Messages, Output, and Result` section of the log.
<br>
Expand Down
12 changes: 6 additions & 6 deletions vignettes/execution.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ library(logrx)
`logrx` has been built with both the flexibility of code execution and a number of different use cases in mind. While the basic case has been outlined in our [Get Started](https://pharmaverse.github.io/logrx/articles/logrx.html) vignette, here we will be discussing different methods of execution and creation of log files. These examples are meant to guide users who wish to explore different methods of execution or for those using ```logrx``` to create scripting.

# Methods of Execution
Below you will find a number of examples for different methods of exectuion, these go in an increasing level of complexity and increasing level of technical knowledge. The below examples are meant to be starting points for those interested in using ```logrx``` in more complex settings.
Below you will find a number of examples for different methods of execution, these go in an increasing level of complexity and increasing level of technical knowledge. The below examples are meant to be starting points for those interested in using ```logrx``` in more complex settings.

## `axecute()`
The easiest of the execution methods to use is `axecute()`. This function can be used to exeucte code from an R terminal or using command line scripts. A log is
The easiest of the execution methods to use is `axecute()`. This function can be used to execute code from an R terminal or using command line scripts. A log is
set-up around the program, and its code is run safely and loudly (using `safely()` from `{purrr}`).
```{r axecute, eval = FALSE}
axecute("my_script.R")
Expand All @@ -45,7 +45,7 @@ messages, output, and result. This must be passed an executable R file to run a

* `log_write()` to generate and format the log

* `log_remove()` to remove the `log.rx` environment created by code exeuction
* `log_remove()` to remove the `log.rx` environment created by code execution

```{r log_*, eval = FALSE}
log_config("my_script.R")
Expand All @@ -55,7 +55,7 @@ log_remove()
```

## Command Line Execution
While exeucting from an R terminal is nice if you have access to one, you can also execute your code using system command line. This is done using the `Rscript -e` command which executes a file using the registered Rscript executable. Below are a few examples of how to use the command line to execute a file and create a log as well as how to manipulate the outputs of the execution. These are likely to be advanced examples for most users.
While executing from an R terminal is nice if you have access to one, you can also execute your code using system command line. This is done using the `Rscript -e` command which executes a file using the registered Rscript executable. Below are a few examples of how to use the command line to execute a file and create a log as well as how to manipulate the outputs of the execution. These are likely to be advanced examples for most users.

The below chunk will run the file my_script.R and output any standard output that is created by the execution of the file to the default location.
```{r, engine = 'bash', eval = FALSE}
Expand Down Expand Up @@ -87,11 +87,11 @@ r_script_list <- list.files(path = ".", pattern = "\\.R$")
lapply(r_script_list, axecute)
```

Additionally, if you need your code to run using a shell scripting language such as bash these files can be created to run using the previously outlined Command Line Execution examples. The above scripting examples can be translated into a variety of different scritping languages. Below is an example where the bash script is executed in a directory of R files, this should execute all R files in the directory using `axecute()` and create a corresponding set of log files.
Additionally, if you need your code to run using a shell scripting language such as bash these files can be created to run using the previously outlined Command Line Execution examples. The above scripting examples can be translated into a variety of different scripting languages. Below is an example where the bash script is executed in a directory of R files, this should execute all R files in the directory using `axecute()` and create a corresponding set of log files.

```{r, engine = 'bash', eval = FALSE}
for file in *.R; do
[ -f "$file" ] || continue
Rscript -e "logrx::axecute('$file')"
done
```
```
2 changes: 1 addition & 1 deletion vignettes/logrx.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ list of packages and functions
* **Messages, Output and Results (optional)** - List Messages, Outputs and Results
* **Log Output File** - Name and path of the log

Below we have a scrollabe example of what is included in a log file for an `adsl.R` script.
Below we have a scrollable example of what is included in a log file for an `adsl.R` script.


<style>
Expand Down

0 comments on commit cb1208e

Please sign in to comment.