README.Rmd 3.73 KB
Newer Older
Bob Rudis's avatar
Bob Rudis committed
1
---
hrbrmstr's avatar
hrbrmstr committed
2
output: rmarkdown::github_document
hrbrmstr's avatar
README    
hrbrmstr committed
3
4
editor_options: 
  chunk_output_type: console
Bob Rudis's avatar
Bob Rudis committed
5
---
hrbrmstr's avatar
hrbrmstr committed
6
7
```{r pkg-knitr-opts, include=FALSE}
hrbrpkghelpr::global_opts()
Bob Rudis's avatar
Bob Rudis committed
8
9
```

hrbrmstr's avatar
hrbrmstr committed
10
11
12
```{r badges, results='asis', echo=FALSE, cache=FALSE}
hrbrpkghelpr::stinking_badges()
```
Bob Rudis's avatar
Bob Rudis committed
13

hrbrmstr's avatar
hrbrmstr committed
14
15
16
```{r description, results='asis', echo=FALSE, cache=FALSE}
hrbrpkghelpr::yank_title_and_description()
```
Bob Rudis's avatar
Bob Rudis committed
17

hrbrmstr's avatar
hrbrmstr committed
18
## What's Inside The Tin
Bob Rudis's avatar
Bob Rudis committed
19

hrbrmstr's avatar
hrbrmstr committed
20
The following functions are implemented:
Bob Rudis's avatar
Bob Rudis committed
21

hrbrmstr's avatar
hrbrmstr committed
22
23
24
```{r ingredients, results='asis', echo=FALSE, cache=FALSE}
hrbrpkghelpr::describe_ingredients()
```
hrbrmstr's avatar
hrbrmstr committed
25

hrbrmstr's avatar
hrbrmstr committed
26
## Installation
Bob Rudis's avatar
Bob Rudis committed
27

hrbrmstr's avatar
hrbrmstr committed
28
29
```{r install-ex, results='asis', echo=FALSE, cache=FALSE}
hrbrpkghelpr::install_block()
Bob Rudis's avatar
Bob Rudis committed
30
31
```

hrbrmstr's avatar
hrbrmstr committed
32
## Usage
Bob Rudis's avatar
Bob Rudis committed
33

hrbrmstr's avatar
hrbrmstr committed
34
```{r lib-ex}
Bob Rudis's avatar
Bob Rudis committed
35
library(cloc)
hrbrmstr's avatar
hrbrmstr committed
36
library(tibble) # for printing
Bob Rudis's avatar
Bob Rudis committed
37

hrbrmstr's avatar
hrbrmstr committed
38
# current version
Bob Rudis's avatar
Bob Rudis committed
39
packageVersion("cloc")
hrbrmstr's avatar
hrbrmstr committed
40

Bob Rudis's avatar
Bob Rudis committed
41
42
```

hrbrmstr's avatar
hrbrmstr committed
43
Basic usage
Bob Rudis's avatar
Bob Rudis committed
44

hrbrmstr's avatar
hrbrmstr committed
45
46
47
48
49
```{r message=FALSE, warning=FALSE, error=FALSE}
# by dir
cloc(system.file("extdata", package="cloc"))

# by file
hrbrmstr's avatar
hrbrmstr committed
50
cloc(system.file("extdata", "qrencoder.cpp", package="cloc"))
hrbrmstr's avatar
hrbrmstr committed
51
52
53
54

# from a url
cloc("https://rud.is/dl/cloc-1.74.tar.gz")
```
Bob Rudis's avatar
Bob Rudis committed
55

hrbrmstr's avatar
hrbrmstr committed
56
Custom CRAN package counter:
Bob Rudis's avatar
Bob Rudis committed
57

hrbrmstr's avatar
hrbrmstr committed
58
59
```{r message=FALSE, warning=FALSE, error=FALSE}
cloc_cran(c("archdata", "hrbrthemes", "iptools", "dplyr"))
Bob Rudis's avatar
Bob Rudis committed
60
61
```

hrbrmstr's avatar
hrbrmstr committed
62
63
git tree 

hrbrmstr's avatar
README    
hrbrmstr committed
64
```{r message=FALSE, warning=FALSE, error=FALSE, eval=FALSE}
hrbrmstr's avatar
hrbrmstr committed
65
cloc_git("~/packages/cloc")
hrbrmstr's avatar
README    
hrbrmstr committed
66
67
68
69
70
71
##   source language file_count file_count_pct   loc      loc_pct blank_lines blank_line_pct comment_lines comment_line_pct
## 1   cloc     Perl          1      0.1111111 10059 0.9867569158         787    0.910879630          1292     0.9570370370
## 2   cloc Markdown          2      0.2222222    60 0.0058858152          31    0.035879630             0     0.0000000000
## 3   cloc        R          4      0.4444444    52 0.0051010398          22    0.025462963            25     0.0185185185
## 4   cloc      Rmd          1      0.1111111    13 0.0012752600          21    0.024305556            32     0.0237037037
## 5   cloc     YAML          1      0.1111111    10 0.0009809692           3    0.003472222             1     0.0007407407
hrbrmstr's avatar
hrbrmstr committed
72
73
```

hrbrmstr's avatar
hrbrmstr committed
74
75
git tree (with specific commit)

hrbrmstr's avatar
README    
hrbrmstr committed
76
```{r message=FALSE, warning=FALSE, error=FALSE, eval=FALSE}
hrbrmstr's avatar
hrbrmstr committed
77
cloc_git("~/packages/cloc", "3643cd09d4b951b1b35d32dffe35985dfe7756c4")
hrbrmstr's avatar
README    
hrbrmstr committed
78
79
80
81
82
83
##   source language file_count file_count_pct   loc      loc_pct blank_lines blank_line_pct comment_lines comment_line_pct
## 1   cloc     Perl          1      0.1111111 10059 0.9867569158         787    0.910879630          1292     0.9570370370
## 2   cloc Markdown          2      0.2222222    60 0.0058858152          31    0.035879630             0     0.0000000000
## 3   cloc        R          4      0.4444444    52 0.0051010398          22    0.025462963            25     0.0185185185
## 4   cloc      Rmd          1      0.1111111    13 0.0012752600          21    0.024305556            32     0.0237037037
## 5   cloc     YAML          1      0.1111111    10 0.0009809692           3    0.003472222             1     0.0007407407
hrbrmstr's avatar
hrbrmstr committed
84
85
```

86
87
88
89
90
91
remote git tree

```{r message=FALSE, warning=FALSE, error=FALSE}
cloc_git("git://github.com/maelle/convertagd.git")
```

hrbrmstr's avatar
hrbrmstr committed
92
93
94
95
96
97
98
Detailed results by file

```{r message=FALSE, warning=FALSE, error=FALSE}
# whole dir
str(cloc_by_file(system.file("extdata", package="cloc")))

# single file
hrbrmstr's avatar
hrbrmstr committed
99
str(cloc_by_file(system.file("extdata", "qrencoder.cpp", package="cloc")))
hrbrmstr's avatar
hrbrmstr committed
100
101
102
103
104
```

Recognized languages

```{r message=FALSE, warning=FALSE, error=FALSE}
hrbrmstr's avatar
hrbrmstr committed
105
cloc_recognized_languages()
hrbrmstr's avatar
hrbrmstr committed
106
107
108
109
110
111
```

Strip comments and whitespace from individual source files

```{r message=FALSE, warning=FALSE, error=FALSE}
cat(
112
  cloc_remove_comments("https://raw.githubusercontent.com/maelle/convertagd/master/README.Rmd")
hrbrmstr's avatar
hrbrmstr committed
113
114
115
)
```

116
117
118
119
## cloc Metrics

```{r echo=FALSE}
cloc_pkg_md()
120
121
```

hrbrmstr's avatar
hrbrmstr committed
122
## Code of Conduct
Bob Rudis's avatar
Bob Rudis committed
123

hrbrmstr's avatar
hrbrmstr committed
124
Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.