Changes in response to the CRAN review.
print_poorly_styled_code() is renamed to
poorly_styled_code(). It now returns the example code as a
character vector, which prints as before and can be passed directly to
styler::style_text(), instead of writing it to the console
with cat().check_unused_dependencies() now deletes the temporary
files it renders.delete_project_skeleton() is
written with message() rather than cat().validator() reported files generated by other tools as
misplaced, e.g., the .csv files that RStudio writes in
.Rproj.user/, which made a project opened as an RStudio
project impossible to validate cleanly (#4, reported by @JAQuent). Hidden
directories are now ignored, along with those generated by ‘renv’,
‘packrat’, ‘Quarto’, and ‘Node.js’.write_dataset_description(), which creates or
updates a psych-DS dataset_description.json in the project
root from the project’s codebooks: each codebook row becomes a
PropertyValue in variableMeasured, so every
variable is still described only once. The generated
processing.qmd demonstrates it in a chunk that is not run
by default, and explains that the codebook .csv is the simpler option
while the .json is the more psych-DS compliant one. Thanks to @bleonar5 for proposing
psych-DS metadata support (#2).key-value pairs ending in _data,
e.g., study-1_stage-processed_data.csv and
study-1_stage-processed_codebook.csv.validator() gains psych-DS checks, reported as a new
"WARN" status: data file names that do not follow the
psych-DS convention of key-value pairs ending in
_data; data files described only by a
.csv/.xlsx codebook rather than in
dataset_description.json; and codebooks or
.json files that cannot be matched to the data file they
describe. Warnings are not failures, so they do not affect
strict = TRUE.validator() now checks that every data file under
data/ is documented, not only those in
data/processed/, accepting a codebook file, a psych-DS
sidecar .json, or the columns being listed in
dataset_description.json. Undocumented raw data is a
warning, since raw data often arrives with names and contents that
cannot be changed.validator() gains exclude_dirs, to ignore
further directories.create_project_skeleton() gains multi-study projects:
studies sets the number of studies, and layout
chooses between one folder per study ("by_study",
e.g. study_1/code/) and one subfolder per study inside each
folder ("by_type", e.g. code/study_1/).
validator() detects the layout automatically. Re-running
with a larger studies adds studies without changing
existing files.create_project_skeleton() also creates:
rproj = TRUE) that does not
save or restore the workspace;_quarto.yml (quarto_yml = TRUE) that
renders the processing and analysis files in order, via Build >
Render Project in RStudio, quarto::quarto_render(), or
quarto render;CITATION.cff template, which gives a Cite this
repository button on GitHub;tools/project_creator.qmd, which re-runs the skeleton
with the same settings;.gitkeep files, so that empty folders are tracked by
git;processing.qmd that creates
and updates a codebook (data dictionary) for the processed data, with
columns to complete by hand marked “TO BE COMPLETED MANUALLY”.create_project_skeleton() now returns the status of
every folder and file ("created",
"overwritten", "skipped", or
"exists") and prints a one-line summary
(quiet = TRUE turns it off).CITATION.cff,
and instructions for validating the project..qmd files share an updated YAML header
(light/dark themes, table of contents, numbered sections, code tools,
self-contained HTML).validator() has new checks:
.html files are up to date with their
.qmd;setwd() calls or absolute paths;validator() results print as coloured PASS/FAIL/SKIP
lines with guidance, checks that cannot be run are reported as SKIP,
summary() gives the counts and layout, and
strict = TRUE throws an error on any failure, e.g. to fail
a GitHub Actions job.delete_project_skeleton() gains keep_file,
to name the file to protect instead of detecting it. A dry run no longer
asks for confirmation, and the function now returns the paths it
deleted, or would delete.create_project_skeleton(),
delete_project_skeleton(), and
style_all_files() no longer have a default path, so that
they only write or delete files where you say. The generated
tools/*.qmd files pass "../" explicitly, so
they are unaffected.delete_project_skeleton() did not recognise the
protected file as being inside the project on Windows, so it could
delete everything, including the file it was meant to protect.check_unused_dependencies() reported every package
attached with library() or require() as
unused, because it never counted their calls. It now counts calls both
with and without pkg::, and renders quietly.create_project_skeleton() returned paths with a leading
/ on Windows.covr; both workflows install Quarto so that the rendering
tests run.cli and stats are now imported, and
covr is suggested.tempdir(); the
example for check_unused_dependencies() runs only if Quarto
is installed.testthat test suite, a GitHub Actions
R-CMD-check workflow, spelling checks
(inst/WORDLIST), and cran-comments.md.create_project_skeleton(), validator(), and
delete_project_skeleton().DESCRIPTION (URLs, BugReports,
selective imports) and split the licence into the CRAN
LICENSE stub plus LICENSE.md.R CMD check --as-cran now passes with no errors or
warnings.create_project_skeleton()), validation
(validator()), deletion
(delete_project_skeleton()), and code hygiene helpers.