簡單的源代碼統計工具:sloc
它可以實現以幾種類型的源代碼統計:
- 源代碼行數
- 有注釋的行數
- 有注釋塊的行數
- 單行注釋的行數
- 混合源碼和注釋的行數
- 空行數
- 物理行數 </ul>
- CSV
- JSON
- Commandline table
sloc能夠輸出以下格式:
$ sloc src/ ---------- Result ------------ Physical : 1202 Source : 751 Comment : 322 Single-line comment : 299 Block comment : 23 Mixed : 116 Empty : 245 Number of files read : 10
或者:
$ sloc --details \ --format cli-table \ --keys total,source,comment \ --exclude i18n*.\.coffee \ --format-option no-head src/ ┌─────────────────────────────────┬──────────┬────────┬─────────┐ │ src/cli.coffee │ 98 │ 74 │ 7 │ ├─────────────────────────────────┼──────────┼────────┼─────────┤ │ src/helpers.coffee │ 26 │ 20 │ 0 │ ├─────────────────────────────────┼──────────┼────────┼─────────┤ │ src/sloc.coffee │ 196 │ 142 │ 20 │ ├─────────────────────────────────┼──────────┼────────┼─────────┤ │ src/formatters/simple.coffee │ 44 │ 28 │ 7 │ ├─────────────────────────────────┼──────────┼────────┼─────────┤ │ src/formatters/csv.coffee │ 25 │ 14 │ 5 │ ├─────────────────────────────────┼──────────┼────────┼─────────┤ │ src/formatters/cli-table.coffee │ 22 │ 13 │ 0 │ └─────────────────────────────────┴──────────┴────────┴─────────┘
支持的語言:
- CoffeeScript
- C / C++
- C#
- Clojure / ClojureScript
- CSS / SCSS / LESS / Stylus
- Erlang
- Go
- Groovy
- HTML
- Handlebars
- Haskell
- Haxe
- Hilbert
- hy
- Java
- JavaScript
- Julia
- Lua
- LiveScript
- Nix
- Mochi
- Monkey
- Mustache
- Perl 5
- Python
- PHP
- R
- Racket
- Ruby
- Rust
- Scala
- SVG
- Swift
- Typescript
- Visual Basic
- Yaml
- XML
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!