Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/nmfs-ost/asar into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Schiano-NOAA committed Oct 8, 2024
2 parents a1dd37c + 2e9c902 commit 91642c9
Show file tree
Hide file tree
Showing 23 changed files with 385 additions and 99 deletions.
69 changes: 69 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Bug Report
description: Report asar not working as expected.
title: "[Bug]: "
labels: ["bug", "triage_needed"]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report! Before
filling out this report please search the existing issues to see
if the problem has already been reported. If it has, please add a
comment to the open issue or link to the related, but closed, issue in
this report.
- type: textarea
id: describe
attributes:
label: Describe the bug
description: Please provide a description of the bug.
validations:
required: true
- type: textarea
id: reproduce
attributes:
label: Describe how to reproduce the bug
description: |
Please include a minimal reproducible example (i.e., a
[reprex]((https://reprex.tidyverse.org/articles/reprex-dos-and-donts.html))).
If you have not heard of a [reprex](http://reprex.tidyverse.org/)
before, you can start by reading about them on the [tidyverse
blog](https://www.tidyverse.org/help/#reprex). Feel free to copy, paste,
and edit the [demo
vignette](https://github.com/NOAA-FIMS/FIMS/blob/4539fc4b6e65b901231c4fb66a113bb5b5d54d22/vignettes/fims-demo.Rmd)
for your reprex.
placeholder: |
# insert reprex here
validations:
required: false
- type: textarea
id: screenshots
attributes:
label: Screenshots
description: If applicable, add screenshots to help explain your problem.
validations:
required: false
- type: dropdown
id: os
attributes:
label: Which OS are you seeing the problem on?
multiple: true
options:
- Windows
- Mac
- Linux
- Other
validations:
required: false
- type: input
id: version
attributes:
label: Which version of asar are you seeing the problem on?
validations:
required: false
- type: textarea
id: context
attributes:
label: Additional Context
description: Add any other context about the problem here.
validations:
required: false
43 changes: 43 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Feature Request
description: Request new features or changes to features
title: "[Feature]: "
labels: ["enhancement", "triage_needed"]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this feature request! Before
filling out this report please search the existing issues to see
if the problem has already been reported. If it has, please add a
comment to the open issue or link to the related, but closed, issue in
this report.
- type: textarea
id: problem
attributes:
label: Is your feature request related to a problem? Please describe.
description: A clear and concise description of what the problem is.
placeholder: I'm always frustrated when...
validations:
required: true
- type: textarea
id: solution
attributes:
label: Describe the solution you would like.
description: A clear and concise description of what you want to happen.
validations:
required: true
- type: textarea
id: alternatives
attributes:
label: Describe alternatives you have considered
description: A clear and concise description of any alternative solutions or features you have considered.
placeholder: Other solutions include ...
validations:
required: true
- type: textarea
id: context
attributes:
label: Additional context
description: Add any other context or screenshots about the feature request here.
validations:
required: false
23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/question.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Question about asar
description: Ask a question about asar
title: "[Question]: "
labels: ["question", "triage_needed"]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to ask a question!
- type: textarea
id: question
attributes:
label: What is your question?
placeholder: Please ask a clear and concise question about asar.
validations:
required: true
- type: textarea
id: context
attributes:
label: Additional context
description: Add any other context or screenshots here.
validations:
required: false
12 changes: 12 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!---
Thanks for opening a PR. This commented text will **NOT** appear in the final PR. Toggle between Write and Preview to see what your PR will look like without the comments.
-->

# What is the feature?
*

# How have you implemented the solution?
*

# Does the PR impact any other area of the project, maybe another repo?
*
44 changes: 44 additions & 0 deletions .github/workflows/pr-checklist.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# This workflow automatically adds a comment containing a reviewer checklist
# when a new pull request is opened.
name: Add a comment with reviewer checklist when PR opened
on:
pull_request:
types: [opened]
jobs:
pr-checklist:
runs-on: ubuntu-latest
name: pr-checklist
steps:
- name: Checkout
uses: actions/checkout@v3
- name: 'Comment PR'
uses: actions/[email protected]
if: github.event_name == 'pull_request'
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
var msg = `# Instructions for code reviewer
Hello reviewer, thanks for taking the time to review this PR!
- Please use this checklist during your review, checking off items that you have verified are complete!
- For PRs that don't make changes to code (e.g., changes to README.md or Github actions workflows), feel free to skip over items on the checklist that are not relevant. Remember it is still important to do a thorough review.
- Then, comment on the pull request with your review indicating where you have questions or changes need to be made before merging.
- Remember to review **every line of code** you’ve been asked to review, look at the context, make sure you’re improving code health, and compliment developers on good things that they do.
- PR reviews are a great way to learn, so feel free to share your tips and tricks. However, for optional changes (i.e., not required for merging), please include \`nit:\` (for nitpicking) before making the suggestion. For example, \`nit:\` I prefer using a \`data.frame()\` instead of a \`matrix\` because...
- Engage with the developer when they respond to comments and check off additional boxes as they become complete so the PR can be merged in when all the tasks are fulfilled. Make it clear when this has been reached by commenting on the PR with something like \`This PR is now ready to be merged, no changes needed\`.
## Checklist
- [ ] The PR is requested to be merged into the appropriate branch (typically main)
- [ ] The code is well-designed.
- [ ] The functionality is good for the users of the code.
- [ ] Any User Interface changes are sensible and look good.
- [ ] The code isn’t more complex than it needs to be.
- [ ] Code coverage remains high, indicating the new code is tested.
- [ ] The developer used clear names for everything.
- [ ] Comments are clear and useful, and mostly explain why instead of what.
- [ ] Code is appropriately documented (doxygen and roxygen).
`
const { issue: { number: issue_number }, repo: { owner, repo } } = context;
github.issues.createComment({ issue_number, owner, repo, body: msg });
5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Imports:
fs,
ggplot2,
gridExtra,
gt,
naniar,
officer,
openxlsx,
Expand All @@ -30,10 +31,10 @@ Imports:
utils
Suggests:
knitr,
rmarkdown,
parallel,
snowfall,
r4ss,
rmarkdown,
snowfall,
testthat (>= 3.0.0)
VignetteBuilder:
knitr
Expand Down
15 changes: 12 additions & 3 deletions R/add_theme.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ add_theme <- function(x) {
# )
# )
# this is bad coding practice, but what I have for now


# Initialize theme_obj to NULL
theme_obj <- NULL

if (class(x)[1] == "flextable") {
theme_obj <- x |>
flextable::merge_h(i = 1, part = "header") |>
Expand All @@ -26,17 +31,21 @@ add_theme <- function(x) {
} else if (class(x)[1] == "gt_tbl") {
theme_obj <- x
# gt object
} else if (class(x)[1] == "kableExtra" | as.character(class(x)[2]) == "knitr_kable") {
} else if ("kableExtra" %in% class(x) ||
(length(class(x)) > 1 && class(x)[2] == "knitr_kable")) {
theme_obj <- x
} else if (class(x)[1] == "gg" | class(x)[2] == "ggplot") { # - removed bc wouldn't work with only 1 entry in the class for other object classes
} else if ("gg" %in% class(x) || "ggplot" %in% class(x)) {
theme_obj <- x +
ggplot2::theme(
plot.background = ggplot2::element_rect(fill = "transparent"),
panel.background = ggplot2::element_rect(fill = "transparent"),
panel.grid = ggplot2::element_blank(),
panel.border = ggplot2::element_rect(colour = "black", fill = NA, linewidth = 0.5)
# text = ggplot2::element_text(size = 12, family = "Cambria")
)
) +
# add default nmfs color palette (palette will be "ocean")
nmfspalette::scale_color_nmfs() +
nmfspalette::scale_fill_nmfs()
# Determining how to treat a legend if there is one
# check if one is present
# check_for_legend <- function(x) {
Expand Down
32 changes: 18 additions & 14 deletions R/create_template.R
Original file line number Diff line number Diff line change
Expand Up @@ -528,23 +528,27 @@ create_template <- function(
# Convert output file if TRUE
if (convert_output) {
print("__________Converting output file__________")
if(tolower(model) == "bam" & is.null(fleet_names)) {
if (tolower(model) == "bam" & is.null(fleet_names)) {
warning("Fleet names not defined.")
} else if (tolower(model) == "bam") {
convert_output(output_file = model_results,
outdir = resdir,
file_save = TRUE,
model = model,
fleet_names = fleet_names,
savedir = subdir,
save_name = paste(species, "_std_res_", year, sep = ""))
convert_output(
output_file = model_results,
outdir = resdir,
file_save = TRUE,
model = model,
fleet_names = fleet_names,
savedir = subdir,
save_name = paste(sub(" ", "_", species), "_std_res_", year, sep = "")
)
} else {
convert_output(output_file = model_results,
outdir = resdir,
file_save = TRUE,
model = model,
savedir = subdir,
save_name = paste(species, "_std_res_", year, sep = ""))
convert_output(
output_file = model_results,
outdir = resdir,
file_save = TRUE,
model = model,
savedir = subdir,
save_name = paste(species, "_std_res_", year, sep = "")
)
}
}

Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ asar::create_template(
year = 2010,
author = c("John Snow", "Danny Phantom", "Patrick Star"),
include_affiliation = TRUE,
parameters = FALSE,
resdir = "C:/Users/Documents/Example_Files",
model_results = "Report.sso",
model = "SS3"
Expand Down
2 changes: 1 addition & 1 deletion inst/templates/skeleton/acknowledgments.qmd
Original file line number Diff line number Diff line change
@@ -1 +1 @@
## Acknowledgements
## Acknowledgements {#sec-acknowledgements}
2 changes: 1 addition & 1 deletion inst/templates/skeleton/appendix.qmd
Original file line number Diff line number Diff line change
@@ -1 +1 @@
## Appendices
## Appendices {#sec-appendix}
2 changes: 1 addition & 1 deletion inst/templates/skeleton/data.qmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Data
## Data {#sec-data}

<!---
Include the following:
Expand Down
2 changes: 1 addition & 1 deletion inst/templates/skeleton/discussion.qmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Discussion
## Discussion {#sec-discussion}

<!---
There are no specified guidelines to structure this section; however, please include subsections discussing ecosystem considerations (if applicable) and research recommendations/improvements to the assessment.
Expand Down
6 changes: 3 additions & 3 deletions inst/templates/skeleton/executive_summary.qmd
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
## Executive Summary
## Executive Summary {#sec-executive-summary}

<!---
Table of updates among the current stock assessment report
--->

### Assessment Methods
### Assessment Methods {#sec-assessment-methods}

<!---
- Current Assessment
- Additional data updates
- Major changes
--->

### Stock Status
### Stock Status {#sec-stock-status}

<!---
Short description followed by a tables with reference points, stock status, and projections
Expand Down
10 changes: 5 additions & 5 deletions inst/templates/skeleton/introduction.qmd
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
## Introduction
## Introduction {#sec-introduction}

Testing adding in an introduction for `r params$species`. There is currently no read of parameters for child documents.

### Management and Assessment History
### Management and Assessment History {#sec-history}

<!---
- Provide a brief description of management history of the stock and status (including change in fishery behavior).
- History of assessment approaches.
--->

### Stock Structure and ID
### Stock Structure and ID {#sec-stock-id}

<!---
Provide a short description (a longer explanation will be included in the data section if applicable)
--->

### Fishery Descriptions
### Fishery Descriptions {#sec-fishery-desscriptions}

<!---
Short summary of fleet composition (i.e. boat types), gear types, species targeted, and fishing grounds (one paragraph).
--->

### Ecosystem Considerations or climate indicators
### Ecosystem Considerations or climate indicators {#sec-eco-indicators}

<!---
If this section is not relevant, please state "Ecosystem considerations and/or climate indicators were not included in this assessment."
Expand Down
Loading

0 comments on commit 91642c9

Please sign in to comment.