Count lines of code, comments and whitespace in source files/archives

cloc(source = ".", extract_with = NULL)

Arguments

source

file, directory or archive to read from (can be a valid URL)

extract_with

passed into cloc command line. This option is only needed if cloc is unable to figure out how to extract the contents of the input file(s) by itself.

Value

tibble

Examples

# by dir cloc(system.file("extdata", package="cloc"))
#> # A tibble: 2 x 10 #> source language file_count file_count_pct loc loc_pct blank_lines #> <chr> <chr> <int> <dbl> <int> <dbl> <int> #> 1 extda… C++ 1 0.5 142 0.507 41 #> 2 extda… R 1 0.5 138 0.493 24 #> # … with 3 more variables: blank_line_pct <dbl>, comment_lines <int>, #> # comment_line_pct <dbl>
# by file cloc(system.file("extdata", "qrencoder.cpp", package="cloc"))
#> # A tibble: 1 x 10 #> source language file_count file_count_pct loc loc_pct blank_lines #> <chr> <chr> <int> <dbl> <int> <dbl> <int> #> 1 qrenc… C++ 1 1 142 1 41 #> # … with 3 more variables: blank_line_pct <dbl>, comment_lines <int>, #> # comment_line_pct <dbl>
# requires a network connection therefore is set for you to run it manually
# NOT RUN { # from a url cloc("https://rud.is/dl/cloc-1.74.tar.gz") # }