Add a backend to Parse the R package DESCRIPTION files
Closed this issue · 3 comments
Spec is here: https://r-pkgs.org/description.html
Testing bonus:
It would be cool if we had some tests to test this backend all by itself running on a bunch of different files that purport to be DESCRIPTION
files.
It would be especially cool if you could just drop new ones into a folder somewhere in the backend directory and the test would pick them up.
I recommend first describing how you'd want to build such a test case.
This is a more complex challenge, but it's well within your skill set. If you're interested, please try it out. Try and write up your rough design here before you write the code for it.
Testing bonus:
It would be cool if we had some tests to test this backend all by itself running on a bunch of different files that purport to be
DESCRIPTION
files.It would be especially cool if you could just drop new ones into a folder somewhere in the backend directory and the test would pick them up.
I recommend first describing how you'd want to build such a test case.
This is a more complex challenge, but it's well within your skill set. If you're interested, please try it out. Try and write up your rough design here before you write the code for it.
The way to purport other files to be DESCRIPTION
files would be if they had the fs.FileInfo
of a DESCRIPTION
file since we use the Name() method of fs.FileInfo
to check whether a file is a DESCRIPTION
file. So a rough design would be make a folder in backend to put files in which would have a DESCRIPTION
file by default and then I would need a method to get the contents of the files which are in []byte and get an fs.FileInfo
of the DESCRIPTION
file in the folder. Then we initialize a context.Context and a cran
backend variable for using the ScanData method and then we run the ScanData method with the context.Context variable, contents of the file in []byte and the fixed fs.FileInfo
in a loop for each file. Then we compare the outputs to determine if the test is successful, for starters I am thinking of just comparing the licenses and errors in the output.
Implemented in git main!