rcloc 0.1.0__py3-none-win_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
Binary file
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: rcloc
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Classifier: Development Status :: 4 - Beta
|
|
5
|
+
Classifier: Environment :: Console
|
|
6
|
+
Classifier: Environment :: Console :: Curses
|
|
7
|
+
Classifier: Intended Audience :: Developers
|
|
8
|
+
Classifier: Programming Language :: Rust
|
|
9
|
+
Classifier: Topic :: Software Development
|
|
10
|
+
Classifier: Topic :: Utilities
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Summary: A fast Rust re-implementation of cloc (count lines of code) with an ncdu-like interactive tree browser
|
|
13
|
+
Keywords: cloc,sloc,loc,lines of code,tui
|
|
14
|
+
License-Expression: GPL-3.0-or-later
|
|
15
|
+
Requires-Python: >=3.8
|
|
16
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
17
|
+
Project-URL: Homepage, https://github.com/renefritze/rcloc-gui
|
|
18
|
+
Project-URL: Issues, https://github.com/renefritze/rcloc-gui/issues
|
|
19
|
+
|
|
20
|
+
# rcloc
|
|
21
|
+
|
|
22
|
+
`rcloc` is a re-implementation of [cloc](https://github.com/AlDanial/cloc)
|
|
23
|
+
("count lines of code") in Rust. It accepts the same command line, reads the
|
|
24
|
+
same options file and language-definition files, and prints cloc's report
|
|
25
|
+
formats. It adds two things on top:
|
|
26
|
+
|
|
27
|
+
* **Interactive mode** (`rcloc --tui`): an [ncdu](https://dev.yorhel.nl/ncdu)-style
|
|
28
|
+
browser for the source tree, showing recursive blank/comment/code counts for
|
|
29
|
+
every directory, with a per-language breakdown of the selected entry.
|
|
30
|
+
* **Version-control awareness by default**: if an input directory is inside a
|
|
31
|
+
git, Mercurial or Subversion checkout, rcloc counts only files under version
|
|
32
|
+
control, the same as `cloc --vcs=git`. Use `--no-vcs` (or `--vcs=none`) to
|
|
33
|
+
walk the directory tree like plain cloc does.
|
|
34
|
+
|
|
35
|
+
It is also much faster than cloc: it counts the 112 MB cargo registry
|
|
36
|
+
(about 6,000 files) in 0.4 s, where cloc takes 6.4 s.
|
|
37
|
+
|
|
38
|
+
## Installation
|
|
39
|
+
|
|
40
|
+
Binary wheels are published on PyPI, so no Rust toolchain is needed:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
pip install rcloc
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
`pipx install rcloc` and `uv tool install rcloc` work as well. To build
|
|
47
|
+
from source:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
cargo install --git https://github.com/renefritze/rcloc-gui
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Usage
|
|
54
|
+
|
|
55
|
+
Anything you would pass to cloc works:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
rcloc .
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
rcloc --by-file --json src/ include/
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
rcloc --exclude-dir=vendor,third_party --include-lang=Rust,Python .
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
rcloc --diff v1.0/ v2.0/
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
```text
|
|
74
|
+
$ rcloc --hide-rate --exclude-dir=fixtures .
|
|
75
|
+
github.com/renefritze/rcloc-gui v 0.1.0
|
|
76
|
+
-------------------------------------------------------------------------------
|
|
77
|
+
Language files blank comment code
|
|
78
|
+
-------------------------------------------------------------------------------
|
|
79
|
+
Rust 14 338 196 8280
|
|
80
|
+
JSON 1 0 0 7720
|
|
81
|
+
YAML 2 13 8 176
|
|
82
|
+
Markdown 1 40 0 141
|
|
83
|
+
TOML 2 6 0 52
|
|
84
|
+
Python 1 9 7 45
|
|
85
|
+
-------------------------------------------------------------------------------
|
|
86
|
+
SUM: 21 406 211 16414
|
|
87
|
+
-------------------------------------------------------------------------------
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
The command-line parser behaves like Perl's Getopt::Long as configured by
|
|
91
|
+
cloc: `--opt=value`, `--opt value`, single-dash long options (`-by-file`),
|
|
92
|
+
underscore spellings (`--exclude_dir`) and unique abbreviations
|
|
93
|
+
(`--by-file-by`) are all accepted. `rcloc --help` lists every option.
|
|
94
|
+
|
|
95
|
+
### Interactive mode
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
rcloc --tui # current directory
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
rcloc --tui ~/src/project --exclude-lang=JSON
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
All filtering options apply in interactive mode too.
|
|
106
|
+
|
|
107
|
+
| Key | Action |
|
|
108
|
+
| --- | --- |
|
|
109
|
+
| `↑`/`↓`, `k`/`j`, PgUp/PgDn, Home/End | move |
|
|
110
|
+
| `→`, `l`, Enter | open directory |
|
|
111
|
+
| `←`, `h`, Backspace | parent directory |
|
|
112
|
+
| `c` / `m` / `b` / `t` / `f` / `n` | sort by code / comment / blank / total / files / name (press again to reverse) |
|
|
113
|
+
| `d` | directories first |
|
|
114
|
+
| `L` | filter all counts by one language (Esc clears) |
|
|
115
|
+
| `i` | toggle the language panel |
|
|
116
|
+
| `r` | rescan |
|
|
117
|
+
| `?` | help |
|
|
118
|
+
| `q` | quit |
|
|
119
|
+
|
|
120
|
+
### Version control detection
|
|
121
|
+
|
|
122
|
+
For each input directory, rcloc looks for `.git`, `.hg` or `.svn` in that
|
|
123
|
+
directory and its parents. If it finds one, it lists files with
|
|
124
|
+
`git ls-files`, `hg files` or `svn list -R`. If a git checkout is found but
|
|
125
|
+
the `git` executable is missing, rcloc falls back to a walk that honours
|
|
126
|
+
`.gitignore`. Files named explicitly on the command line are always counted.
|
|
127
|
+
|
|
128
|
+
* `--vcs=git|svn|hg` forces a VCS.
|
|
129
|
+
* `--vcs='<command>'` uses any command that prints one file per line.
|
|
130
|
+
* `--no-vcs` / `--vcs=none` disables detection.
|
|
131
|
+
|
|
132
|
+
`--vcs=auto` is the default.
|
|
133
|
+
|
|
134
|
+
### Configuration files
|
|
135
|
+
|
|
136
|
+
* **Options file:** `~/.config/cloc/options.txt` is read (or the file given
|
|
137
|
+
with `--config`). It holds one option per line, with or without leading
|
|
138
|
+
`--`. Options given on the command line take precedence, exactly as in
|
|
139
|
+
cloc, so an existing cloc setup works unchanged.
|
|
140
|
+
* **Language definitions:** `--read-lang-def` (merge), `--force-lang-def`
|
|
141
|
+
(replace) and `--write-lang-def` use cloc's file format.
|
|
142
|
+
|
|
143
|
+
### Compatibility with cloc
|
|
144
|
+
|
|
145
|
+
The built-in language table (extensions, file names, shebang interpreters,
|
|
146
|
+
comment filters, 3rd-generation scale factors) was extracted from cloc 2.13,
|
|
147
|
+
and every comment filter was ported, including the Regexp::Common comment
|
|
148
|
+
regexes and the heuristics that tell apart languages sharing an extension
|
|
149
|
+
(`.m`, `.pl`, `.h`, `.inc`, `.ts`, `.v`, …). Duplicate detection (MD5),
|
|
150
|
+
binary-file detection and the report layouts follow cloc as well.
|
|
151
|
+
|
|
152
|
+
Results were compared with cloc 1.98 on real code trees: the cargo
|
|
153
|
+
registry, `/usr/include`, the Python standard library and site-packages,
|
|
154
|
+
and Perl's library directories. rcloc gives exactly the same per-file
|
|
155
|
+
results for every language whose definition did not change between cloc
|
|
156
|
+
1.98 and 2.13. For Perl and Python, cloc 2.13 changed the filters (POD
|
|
157
|
+
handling and the order of docstring removal), and rcloc follows 2.13.
|
|
158
|
+
`--diff` output is byte-identical to cloc's on the version pairs tested.
|
|
159
|
+
`scripts/compare_with_cloc.py` repeats the comparison against any
|
|
160
|
+
installed cloc.
|
|
161
|
+
|
|
162
|
+
Differences:
|
|
163
|
+
|
|
164
|
+
* The report header names rcloc (`github.com/renefritze/rcloc-gui v <version>`).
|
|
165
|
+
* Counting runs in parallel; `--processes=N` sets the number of threads.
|
|
166
|
+
* VCS detection is on by default (see above).
|
|
167
|
+
* Not implemented yet: counting inside archives (tar/zip inputs), git
|
|
168
|
+
commit or tag inputs and `--git-diff-*`, `--sum-reports`, `--sql`,
|
|
169
|
+
`--html`, `--fmt`, `--use-sloccount`, `--unicode`, `--file-encoding`.
|
|
170
|
+
|
|
171
|
+
## Development
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
cargo test
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
python3 scripts/compare_with_cloc.py /some/source/tree --ignore-langs Perl,Python
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
The comparison script needs an installed cloc and a release build
|
|
182
|
+
(`cargo build --release`).
|
|
183
|
+
|
|
184
|
+
### Releasing to PyPI
|
|
185
|
+
|
|
186
|
+
`.github/workflows/release.yml` builds wheels with
|
|
187
|
+
[maturin](https://www.maturin.rs/) for Linux (manylinux and musllinux:
|
|
188
|
+
x86_64, x86, aarch64, armv7, ppc64le, s390x), macOS (x86_64, arm64) and
|
|
189
|
+
Windows (x64, x86, arm64), plus an sdist. It runs on every pull request that
|
|
190
|
+
touches the packaging files, and it publishes to PyPI when a `v*` tag
|
|
191
|
+
matching the crate version is pushed. Publishing uses
|
|
192
|
+
[trusted publishing](https://docs.pypi.org/trusted-publishers/): register
|
|
193
|
+
this repository, the workflow `release.yml` and the environment `pypi` as a
|
|
194
|
+
trusted publisher for the `rcloc` project on PyPI once.
|
|
195
|
+
|
|
196
|
+
## License
|
|
197
|
+
|
|
198
|
+
GPL-3.0-or-later. The language definitions in `data/languages.json` are
|
|
199
|
+
derived from cloc, which is © Al Danial and licensed under the GPL (version 2
|
|
200
|
+
or later).
|
|
201
|
+
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
rcloc-0.1.0.data/scripts/rcloc.exe,sha256=H8UrgO0m4rTZBT4aTUo3OT6Ocaqsz9AtADyB9iNN0aE,3418112
|
|
2
|
+
rcloc-0.1.0.dist-info/METADATA,sha256=21gR_g2AClsRXkaSJUS13ilx7wnt4Hai7UKzu5g9FSw,7885
|
|
3
|
+
rcloc-0.1.0.dist-info/WHEEL,sha256=NMcgpbgSQKFPcOlxqemqcJWw9mOLJ5cWmlwQILii2R4,94
|
|
4
|
+
rcloc-0.1.0.dist-info/licenses/LICENSE,sha256=IwGE9guuL-ryRPEKi6wFPI_zOhg7zDZbTYuHbSt_SAk,35823
|
|
5
|
+
rcloc-0.1.0.dist-info/sboms/rcloc.cyclonedx.json,sha256=-5trxqy8IO4d680OY6WiUbHyU-wV0qyKPcWdvpjmPMs,206859
|
|
6
|
+
rcloc-0.1.0.dist-info/RECORD,,
|