Skip to content

Add check for inits named with square brackets#452

Merged
rok-cesnovar merged 4 commits intostan-dev:masterfrom
mike-lawrence:check_init_format
Feb 17, 2021
Merged

Add check for inits named with square brackets#452
rok-cesnovar merged 4 commits intostan-dev:masterfrom
mike-lawrence:check_init_format

Conversation

@mike-lawrence
Copy link
Copy Markdown
Collaborator

@mike-lawrence mike-lawrence commented Feb 17, 2021

Addresses #451 (& stan-dev/cmdstan#966)

Submission Checklist

  • Run unit tests
  • Declare copyright holder and agree to license (see below)

Summary

Please describe the purpose of the pull request.

Copyright and Licensing

Please list the copyright holder for the work you are submitting
(this will be you or your assignee, such as a university or company):
Michael A. Lawrence

By submitting this pull request, the copyright holder is agreeing to
license the submitted work under the following licenses:

@mike-lawrence
Copy link
Copy Markdown
Collaborator Author

Ah shoot, silly mistakes in both code and in my procedure for checking the tests passed before submitting this PR. Corrected now.

Copy link
Copy Markdown
Member

@rok-cesnovar rok-cesnovar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, one suggestion for the error text. But can also leave it and improve the text later.

Comment thread R/args.R Outdated
}

if (grepl("\\[",names(unlist(init)))) {
stop("'init' contains entries with parameter names that include square-brackets, which is not permitted. To supply inits for a multi-element parameter, create a single entry with the parameter's name in the init list and use c()/matrix()/etc to specify the values.", call. = FALSE)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
stop("'init' contains entries with parameter names that include square-brackets, which is not permitted. To supply inits for a multi-element parameter, create a single entry with the parameter's name in the init list and use c()/matrix()/etc to specify the values.", call. = FALSE)
stop("'init' contains entries with parameter names that include square-brackets, which is not permitted. To supply inits for a vector, matrix or array of parameters, create a single entry with the parameter's name in the init list and specify init values for the entire parameter container.", call. = FALSE)

@rok-cesnovar
Copy link
Copy Markdown
Member

Thanks for fixing this! Also, can you add an entry to the NEWS.md.

@codecov-io
Copy link
Copy Markdown

codecov-io commented Feb 17, 2021

Codecov Report

Merging #452 (49bf006) into master (c38fdb3) will decrease coverage by 0.83%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #452      +/-   ##
==========================================
- Coverage   93.17%   92.33%   -0.84%     
==========================================
  Files          12       12              
  Lines        2871     2832      -39     
==========================================
- Hits         2675     2615      -60     
- Misses        196      217      +21     
Impacted Files Coverage Δ
R/args.R 99.34% <100.00%> (+<0.01%) ⬆️
R/install.R 67.93% <0.00%> (-3.21%) ⬇️
R/run.R 95.10% <0.00%> (-1.69%) ⬇️
R/utils.R 90.54% <0.00%> (-1.36%) ⬇️
R/model.R 92.12% <0.00%> (-0.53%) ⬇️
R/csv.R 98.68% <0.00%> (-0.53%) ⬇️
R/zzz.R 80.95% <0.00%> (+7.14%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c38fdb3...49bf006. Read the comment docs.

@rok-cesnovar
Copy link
Copy Markdown
Member

Great! Will merge once tests pass again.

@rok-cesnovar rok-cesnovar merged commit dee290f into stan-dev:master Feb 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants