Check if functions in R files are consistent with dev_history
Created by: statnmap
If functions are renamed, old R files stay in the "R/" directory.
Create a new function to warn if there are functions not in any dev_history.
This function needs to be independent or optional as there may be old functions from before using {fusen}.
This would also require to parse all dev_history.Rmd in the dev/ folder Maybe a simple parse would only look if filename of R/ files still exist in one of the dev_history.
- Maybe I need to get the lines from inflate that do parsermd + get_functions()
list.files(R/ directory) ; get filenames without extension Also, the same with tests files. readlines(all_rmds) : grep() if filename as its equivalent in text. Return a tibble of still existing + where and not found
Or list in a metadata file during inflate (yaml ?):
- This lists outputs of the flat file
- This lists scripts that should not be cleaned because manually added
flat_add_toto.Rmd:
R: fun.R, zaza.R
tests: test-fun.R, test-zaza.R
vignette: start-fun.Rmd
dont_clean:
R: my_fun_from_before.R, my_golem_module.R
tests: test-my_fun_from_before.R
vignette: Userguide.Rmd
=> The inflate()
function:
-
updates the part dedicated to the corresponding flat file with all files created. -
List filenames (from this specific flat file) that are removed during this update, verify if they still exists, and proposes to delete them -
Inflate could also run the complete clean ? Maybe not now. Wait for the functions to be extensively tested -
Detect inflate options in the inflate
chunk. Make the chunk namedinflate
mandatory -
Store inflate options so that if I run directly fusen::inflate()
in the console, it is correctly inflated -
Inform if previous version inflated is not the same as current: Probably need to re-inflate all files for version <= 0.4.1
=> The clean function:
-
verify if flat files still exist -
verify if all listed files still exist -
lists all files that will be cleaned and ask -
recommend to commit before clean -
cleans all files listed after yes -
Add a tool to detect duplicates in "R/" directory. See comment below
=> There is no need to verify if functions are still there or not, because everything happens at the scale of the filename
=> Allow to deprecate a flat_file:
-
Move it to "dev/dev_history/flat_..." -
Change the path of this file in the config file -
Clean the "do not edit by hand" => "Originally created from dev/dev_history/flat_..." -
Add "do not edit by hand" and "do not inflate" in the flat file, and comment the complete "inflate" chunk.
=> The migration process from previous {fusen} and keep some files
-
Detect all R, tests, vignettes files -
Detect files linked to a flat_file to register to "config_fusen.yaml" -
Allow some "keep" files, not created with the fusen process -
Allow to register everything before starting the cleaning process, assuming all files are legitimate: ``