Rmd files non chunks being read as comments
yonicd opened this issue · 4 comments
yonicd commented
Should the non chunk Rmd lines be read as comments?
I looked at this README.Rmd file and i get back this cloc output, which has a total of 83 lines.
cloc::cloc('README.Rmd')
source language file_count file_count_pct loc loc_pct blank_lines blank_line_pct comment_lines comment_line_pct
1 README.Rmd Rmd 1 1 4 1 31 1 47 1
Session info
─ Session info ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────
setting value
version R version 3.5.1 (2018-07-02)
os macOS High Sierra 10.13.6
system x86_64, darwin15.6.0
ui RStudio
language (EN)
collate en_US.UTF-8
ctype en_US.UTF-8
tz America/New_York
date 2018-11-09
─ Packages ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
! package * version date lib source
assertthat 0.2.0 2017-04-11 [1] CRAN (R 3.5.0)
backports 1.1.2 2017-12-13 [1] CRAN (R 3.5.0)
cli 1.0.1 2018-09-25 [1] CRAN (R 3.5.0)
clipr 0.4.1 2018-06-23 [1] CRAN (R 3.5.0)
cloc 0.3.0 2018-11-09 [1] Github (hrbrmstr/cloc@b406628)
covr * 3.2.0 2018-09-21 [1] CRAN (R 3.5.0)
covrpage * 0.0.63 2018-11-09 [1] local
crayon 1.3.4 2017-09-16 [1] CRAN (R 3.5.0)
curl 3.2 2018-03-28 [1] CRAN (R 3.5.0)
devtools 1.13.6 2018-06-27 [1] CRAN (R 3.5.0)
digest 0.6.18 2018-10-10 [1] CRAN (R 3.5.0)
DT 0.5 2018-11-05 [1] CRAN (R 3.5.0)
evaluate 0.12 2018-10-09 [1] CRAN (R 3.5.0)
git2r 0.23.0.9000 2018-10-26 [1] Github (ropensci/git2r@f9d78f7)
htmltools 0.3.6 2017-04-28 [1] CRAN (R 3.5.0)
htmlwidgets 1.3 2018-09-30 [1] CRAN (R 3.5.0)
knitr * 1.20 2018-02-20 [1] CRAN (R 3.5.0)
lazyeval 0.2.1 2017-10-29 [1] CRAN (R 3.5.0)
magrittr * 1.5 2014-11-22 [1] CRAN (R 3.5.0)
memoise 1.1.0 2017-04-21 [1] CRAN (R 3.5.0)
packrat 0.4.9-3 2018-06-01 [1] CRAN (R 3.5.0)
processx 3.2.0.9000 2018-11-02 [1] Github (r-pkgs/processx@8374340)
ps 1.2.1 2018-11-06 [1] CRAN (R 3.5.0)
R6 2.3.0 2018-10-04 [1] CRAN (R 3.5.0)
V Rcpp 0.12.19 2018-11-07 [1] CRAN (R 3.5.0)
remotes 1.1.1 2017-12-20 [1] CRAN (R 3.5.0)
rex 1.1.2 2017-10-19 [1] CRAN (R 3.5.0)
rlang 0.3.0.1 2018-10-25 [1] CRAN (R 3.5.0)
rmarkdown 1.10 2018-06-11 [1] CRAN (R 3.5.0)
rprojroot 1.3-2 2018-01-03 [1] CRAN (R 3.5.0)
rstudioapi 0.8 2018-10-02 [1] CRAN (R 3.5.0)
sessioninfo 1.1.0.9001 2018-10-14 [1] Github (r-lib/sessioninfo@9645364)
testthat * 2.0.0.9000 2018-09-28 [1] Github (r-lib/testthat@8216ebe)
whisker 0.3-2 2013-04-28 [1] CRAN (R 3.5.0)
withr 2.1.2 2018-03-15 [1] CRAN (R 3.5.0)
[1] /Users/yonis/Library/R/3.5/library
[2] /Library/Frameworks/R.framework/Versions/3.5/Resources/library
V ── Loaded and on-disk version mismatch.
yonicd commented
here is the output with what clocks sees as comments removed
> cloc::cloc_remove_comments(source_file = normalizePath('README.Rmd'))
[1] "knitr::opts_chunk$set(\n collapse = TRUE,\n comment = \"#>\"\n)"
hrbrmstr commented
that's a gd q. i'd like to see others chime in. "comments" IMO are explaining code whereas text in Rmd may be just blathering so not sure it should be considered as comments.
maelle commented
I do, I think they are not comments. I would not be horrified if in an analysis you simplified it this way, but wouldn't like cloc
to do that. 🙂