a cargo subcommand for counting lines of code in Rust projects

Overview

cargo-count

Join the chat at https://gitter.im/kbknapp/cargo-count

Linux: Build Status

A cargo subcommand for displaying line counts of source code in projects, including a niave unsafe counter for Rust source files. This subcommand was originally based off and inspired by the project tokei by Aaronepower

Demo

To count the source code in the Rust repository (checkout 4c99649), and print some naive statistics on how much "unsafe" code exists.

NOTE: The Rust repository is quite large, if you're on a slow internet connect consider using a smaller repository, such as the cargo-count repo.

$ git clone https://github.com/rust-lang/rust
$ cd rust
$ cargo count --separator , --unsafe-statistics
Gathering information...
         Language    Files  Lines    Blanks  Comments  Code     Unsafe (%)
         --------    -----  -----    ------  --------  ----     ----------
         Rust        6,018  528,510  66,984  133,698   327,792  3,163 (0.96%)
         C           54     9,962    1,445   1,492     7,025    7,025 (100.00%)
         CSS         4      1,266    149     52        1,065    
         JavaScript  4      1,118    131     166       821      
         Python      31     4,797    843     585       3,369    
         C Header    13     1,865    284     585       996      996 (100.00%)
         C++         4      1,611    185     81        1,345    1,345 (100.00%)
         --------    -----  -----    ------  --------  ----     ----------
Totals:              6,128  549,129  70,021  136,659   342,413  12,529 (3.66%)

The --separator , sets a , character as the thousands separator, and --unsafe-statistics looks for, and counts lines of unsafe.

Installing

cargo-count can be installed with cargo install

$ cargo install cargo-count

This may require a nightly version of cargo if you get an error about the install command not being found. You may also compile and install the traditional way by followin the instructions below.

Compiling

Follow these instructions to compile cargo-count, then skip down to Installation.

  1. Ensure you have current version of cargo and Rust installed
  2. Clone the project $ git clone https://github.com/kbknapp/cargo-count && cd cargo-count
  3. Build the project $ cargo build --release (NOTE: There is a large performance differnce when compiling without optimizations, so I recommend alwasy using --release to enable to them)
  4. Once complete, the binary will be located at target/release/cargo-count

Installation and Usage

All you need to do is place cargo-count somewhere in your $PATH. Then run cargo count anywhere in your project directory. For full details see below.

Linux / OS X

You have two options, place cargo-count into a directory that is already located in your $PATH variable (To see which directories those are, open a terminal and type echo "${PATH//:/\n}", the quotation marks are important), or you can add a custom directory to your $PATH

Option 1 If you have write permission to a directory listed in your $PATH or you have root permission (or via sudo), simply copy the cargo-count to that directory # sudo cp cargo-count /usr/local/bin

Option 2 If you do not have root, sudo, or write permission to any directory already in $PATH you can create a directory inside your home directory, and add that. Many people use $HOME/.bin to keep it hidden (and not clutter your home directory), or $HOME/bin if you want it to be always visible. Here is an example to make the directory, add it to $PATH, and copy cargo-count there.

Simply change bin to whatever you'd like to name the directory, and .bashrc to whatever your shell startup file is (usually .bashrc, .bash_profile, or .zshrc)

$ mkdir ~/bin
$ echo "export PATH=$PATH:$HOME/bin" >> ~/.bashrc
$ cp cargo-count ~/bin
$ source ~/.bashrc

Windows

On Windows 7/8 you can add directory to the PATH variable by opening a command line as an administrator and running

C:\> setx path "%path%;C:\path\to\cargo-count\binary"

Otherwise, ensure you have the cargo-count binary in the directory which you operating in the command line from, because Windows automatically adds your current directory to PATH (i.e. if you open a command line to C:\my_project\ to use cargo-count ensure cargo-count.exe is inside that directory as well).

Options

There are a few options for using cargo-count which should be somewhat self explanitory.

USAGE:
    cargo count [FLAGS] [OPTIONS] [--] [ARGS]

FLAGS:
    -S, --follow-symlinks      Follows symlinks and counts source files it finds
    -a, --all                  Do not ignore .gitignored paths
                               (Defaults to false when omitted)
    -h, --help                 Prints help information
        --unsafe-statistics    Displays lines and percentages of "unsafe" code
    -V, --version              Prints version information
    -v, --verbose              Print verbose output

OPTIONS:
    -l, --language <exts>...    Only count these languges (by source code extension)
                                (i.e. '-l js py cpp')
    -e, --exclude <paths>...    Files or directories to exclude (automatically includes '.git')
        --utf8-rule <rule>      Sets the UTF-8 parsing rule (Defaults to 'strict')
                                 [values: ignore lossy strict]
    -s, --separator <sep>       Set the thousands separator for pretty printing

ARGS:
    to_count...    The files or directories (including children) to count
                   (defaults to current working directory when omitted)

When using '--exclude <path>' the path given can either be relative to the current 
directory, or absolute. When '<path>' is a file, it must be relative to the current 
directory or it will not be found. Example, if the current directory has a child 
directory named 'target' with a child fild 'test.rs' and you use `--exclude target/test.rs' 

Globs are also supported. For example, to exclude 'test.rs' files from all child directories 
of the current directory you could do '--exclude */test.rs'.

License

cargo-count is released under the terms of the MIT. See the LICENSE-MIT file for the details.

Dependencies Tree

cargo-count dependencies

Comments
  • C and C Headers have some unsafe code

    C and C Headers have some unsafe code

    Since the unsafe counter is naive and counts all C and C++ as unsafe it's strange that some code in .c and .h files is not unsafe. See the example in the README.md...

    opened by kbknapp 8
  • imp: Ignore files in accordance with .gitignore

    imp: Ignore files in accordance with .gitignore

    I noticed discussion of this in issues #8 and #9. Here's the approach I took:

    • By default .gitignored paths are ignored.
    • A -a / --all flag returns the old behavior.
    • A single .gitignore file is looked for in the directory in which cargo count is called. No attempt is made to find additional .gitignore files in sub-directories.

    I have a pull request open with the gitignore crate to reclassify tempdir as a dev dependency. If that patch gets merged, this patch should be able to be amended to not bring in any additional dependencies except gitignore itself.

    opened by m-n 7
  • cpp is not the only extension for C++

    cpp is not the only extension for C++

    { ".cc", ".cpp", ".cp", ".cxx", ".c++", ".C" }
    

    As far as I know, these are all valid extensions for C++ source code, with cc and cpp being the most popular. Currently cargo-count only supports cpp.

    T: bug D: easy P1: required C: languages 
    opened by ztdwu 7
  • chore(cargo.lock): Update deps.

    chore(cargo.lock): Update deps.

    Significantly this removes several no-longer necessary crates which were previously transitive dependencies by way of gitignore. This includes rand which was breaking the build on nightly.

    opened by m-n 5
  • Ensure

    Ensure "unsafe" counts

    The unsafe counter probably isn't counting all the unsafe lines due to a crappy regex, and maybe due to bad bracket counting after finding unsafe blocks.

    greping for unsafe { (even those lines that don't contain // at all, much less to say in correct places that should lead to commented out unsafe) in the Rust repo leads to ~2,000. Now consider some of those are the start of an unsafe block. So there should be around 2,000+ unsafe lines when running cargo count, yet currently it reports only ~1,200.

    T: bug D: intermediate P1: required E: tedious C: unsafe counter 
    opened by kbknapp 4
  • cargo count counts rust source files in the target/ directory

    cargo count counts rust source files in the target/ directory

    On a project using piston with 5 source files and no unsafe code in src/, I get this output:

    $ cargo count --unsafe-statistics
    Gathering information...
             Language  Files  Lines  Blanks  Comments  Code   Unsafe (%)
             --------  -----  -----  ------  --------  ----   ----------
             Rust      10     28094  2972    517       24605  964 (3.92%)
             TOML      1      23     3       0         20     
             --------  -----  -----  ------  --------  ----   ----------
    Totals:            11     28117  2975    517       24625  964 (3.91%)
    

    I believe that this is due to cargo count taking into account files in the target/ directory, such as generated source files:

    $ find . -iname '*.rs'
    ./target/debug/build/glutin-7fb876b2b34f427b/out/glx_bindings.rs
    ./target/debug/build/glutin-7fb876b2b34f427b/out/test_gl_bindings.rs
    ./target/debug/build/glutin-7fb876b2b34f427b/out/egl_bindings.rs
    ./target/debug/build/glutin-7fb876b2b34f427b/out/glx_extra_bindings.rs
    ./target/debug/build/gl-9653698dd50d604e/out/bindings.rs
    ./src/rust/level_serialization/mod.rs
    ./src/rust/map/mod.rs
    ./src/rust/player/mod.rs
    ./src/rust/lib.rs
    ./src/rust/main.rs
    

    Perhaps cargo count should either hardcode ignoring target/, or read and ignore files ignored in .gitignore like cargo does?

    C: cli 
    opened by daboross 2
  • cago count will fail if a symlink points to a parent directory

    cago count will fail if a symlink points to a parent directory

    $ mkdir sample
    $ cd sample
    $ ln -s . foo
    $ cargo count
    Gathering information...
    thread '<main>' panicked at 'called `Result::unwrap()` on an `Err` value: Error { repr: Os { code: 40, message: "Too many levels of symbolic links" } }', src/libcore/result.rs:731
    

    This is similar to my other issue #6, but fails for a different reason.

    Overall, cargo count should probably not be following symlinks that are directories. It may or may not want to follow ones pointing to regular files.

    T: bug D: easy P2: want to have C: i/o 
    opened by d3zd3z 2
  • cargo count dies if there are broken symlinks in tree

    cargo count dies if there are broken symlinks in tree

    $ mkdir sample
    $ cd sample
    $ ln -s invalid foo
    $ cargo count
    Gathering information...
    thread '<main>' panicked at 'called `Result::unwrap()` on an `Err` value: Error { repr: Os { code: 2, message: "No such file or directory" } }', src/libcore/result.rs:731
    

    The culprit seems to be the calls to metadata in get_all_files, which will fail on a bogus symlink. Perhaps symlink_metadata would be better.

    T: bug D: easy P2: want to have C: i/o 
    opened by d3zd3z 2
  • fix(Cargo.lock): update version to 0.2.3

    fix(Cargo.lock): update version to 0.2.3

    Cargo.toml lists the cargo-count version as 0.2.3 while Cargo.lock had the version listed as 0.2.2; this made "cargo install" fail. Updating the Cargo.lock to also list 0.2.3 fixes this.

    opened by ghost 1
  • Unused import std::io::Write

    Unused import std::io::Write

    I ran cargo install cargo-count on nightly. It worked but I saw this warning:

       Compiling cargo-count v0.2.1
    .cargo/registry/src/github.com-1ecc6299db9ec823/cargo-count-0.2.1/src/main.rs:190:5: 190:19 warning: unused import, #[warn(unused_imports)] on by default
    .cargo/registry/src/github.com-1ecc6299db9ec823/cargo-count-0.2.1/src/main.rs:190 use std::io::Write;
                                                                                          ^~~~~~~~~~~~~~
    
    T: enhancement D: easy P3: nice to have 
    opened by dtolnay 1
  • Block comment bug

    Block comment bug

    Single-line block comment counts erroneously. For this sample

    /* */
    fn main() {
        println!("Hello world");
    }
    

    I got

             Language  Files  Lines  Blanks  Comments  Code  Unsafe (%)
             --------  -----  -----  ------  --------  ----  ----------
             Rust      1      4      0       4         0     0 (NaN%)
             TOML      1      4      0       0         4     
             --------  -----  -----  ------  --------  ----  ----------
    Totals:            2      8      0       4         4     0 (0.00%)
    
    
    
    opened by Vinatorul 1
  • Looking for maintainers?

    Looking for maintainers?

    Hello @kbknapp 👋 This project has a considerable number of stars (so likely has many users), but has not seen a commit in over 4 years. There's a few unresolved issues with the crate that are causing unsafe statistics to be wrongly reported, and and a handful of PRs still need to be reviewed and merged.

    Are you open to adding new maintainers to the project? I'd like to see some of these issues closed. 🙂

    Thanks, Sean

    opened by seanpianka 0
  • Numerous warnings when building cargo-count

    Numerous warnings when building cargo-count

    $ rustc --version
    rustc 1.52.1 (9bc8c42bb 2021-05-09)
    
    $ sw_vers
    ProductName:	macOS
    ProductVersion:	11.3.1
    BuildVersion:	20E241
    

    I'm seeing the following warnings when building with cargo build --release:

       Compiling libc v0.2.15
       Compiling winapi-build v0.1.1
       Compiling winapi v0.2.8
       Compiling unicode-width v0.1.3
       Compiling regex-syntax v0.3.5
       Compiling unicode-segmentation v0.1.2
       Compiling vec_map v0.6.0
       Compiling bitflags v0.7.0
       Compiling ansi_term v0.9.0
       Compiling strsim v0.5.1
       Compiling glob v0.2.11
       Compiling utf8-ranges v0.1.3
       Compiling tabwriter v0.1.25
       Compiling kernel32-sys v0.2.2
       Compiling memchr v0.1.11
       Compiling term_size v0.2.1
       Compiling gitignore v1.0.4
       Compiling aho-corasick v0.5.2
       Compiling clap v2.11.2
       Compiling thread-id v2.0.0
       Compiling thread_local v0.2.6
       Compiling regex v0.1.75
       Compiling cargo-count v0.2.4 (/Users/mjm/rust2/cargo-count)
    warning: unused macro definition
      --> src/macros.rs:17:1
       |
    17 | / macro_rules! werr(
    18 | |     ($($arg:tt)*) => ({
    19 | |         use std::io::{Write, stderr};
    20 | |         write!(&mut stderr(), $($arg)*).ok();
    21 | |     })
    22 | | );
       | |__^
       |
       = note: `#[warn(unused_macros)]` on by default
    
    warning: unused macro definition
      --> src/macros.rs:61:1
       |
    61 | / macro_rules! debug {
    62 | |     ($fmt:expr) => ();
    63 | |     ($fmt:expr, $($arg:tt)*) => ();
    64 | | }
       | |_^
    
    warning: trait objects without an explicit `dyn` are deprecated
      --> src/error.rs:58:32
       |
    58 |     fn cause(&self) -> Option<&Error> {
       |                                ^^^^^ help: use `dyn`: `dyn Error`
       |
       = note: `#[warn(bare_trait_objects)]` on by default
    
    warning: use of deprecated trait `std::ascii::AsciiExt`: use inherent methods instead
      --> src/config.rs:10:1
       |
    10 | / arg_enum! {
    11 | |     #[derive(Debug)]
    12 | |     pub enum Utf8Rule {
    13 | |         Ignore,
    ...  |
    16 | |     }
    17 | | }
       | |_^
       |
       = note: `#[warn(deprecated)]` on by default
       = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
    
    warning: use of deprecated associated function `std::error::Error::description`: use the Display impl or to_string()
       --> src/macros.rs:6:54
        |
    6   |             Err(e) => return Err(CliError::Generic(e.description().to_owned()))
        |                                                      ^^^^^^^^^^^
        | 
       ::: src/main.rs:285:5
        |
    285 |     cli_try!(counts.count());
        |     ------------------------- in this macro invocation
        |
        = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
    
    warning: use of deprecated associated function `std::error::Error::description`: use the Display impl or to_string()
       --> src/macros.rs:6:54
        |
    6   |             Err(e) => return Err(CliError::Generic(e.description().to_owned()))
        |                                                      ^^^^^^^^^^^
        | 
       ::: src/main.rs:286:5
        |
    286 |     cli_try!(counts.write_results());
        |     --------------------------------- in this macro invocation
        |
        = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
    
    warning: use of deprecated associated function `std::error::Error::description`: use the Display impl or to_string()
      --> src/macros.rs:6:54
       |
    6  |             Err(e) => return Err(CliError::Generic(e.description().to_owned()))
       |                                                      ^^^^^^^^^^^
       | 
      ::: src/config.rs:55:34
       |
    55 |                         ret.push(cli_try!(env::current_dir()).join(p));
       |                                  ---------------------------- in this macro invocation
       |
       = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
    
    warning: use of deprecated associated function `std::error::Error::description`: use the Display impl or to_string()
      --> src/macros.rs:6:54
       |
    6  |             Err(e) => return Err(CliError::Generic(e.description().to_owned()))
       |                                                      ^^^^^^^^^^^
       | 
      ::: src/config.rs:61:26
       |
    61 |                 ret.push(cli_try!(env::current_dir()).join(".git"));
       |                          ---------------------------- in this macro invocation
       |
       = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
    
    warning: use of deprecated associated function `std::error::Error::description`: use the Display impl or to_string()
      --> src/macros.rs:6:54
       |
    6  |             Err(e) => return Err(CliError::Generic(e.description().to_owned()))
       |                                                      ^^^^^^^^^^^
       | 
      ::: src/config.rs:65:22
       |
    65 |                 vec![cli_try!(env::current_dir()).join(".git")]
       |                      ---------------------------- in this macro invocation
       |
       = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
    
    warning: use of deprecated associated function `std::error::Error::description`: use the Display impl or to_string()
      --> src/macros.rs:6:54
       |
    6  |             Err(e) => return Err(CliError::Generic(e.description().to_owned()))
       |                                                      ^^^^^^^^^^^
       | 
      ::: src/config.rs:77:22
       |
    77 |                 vec![cli_try!(env::current_dir())]
       |                      ---------------------------- in this macro invocation
       |
       = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
    
    warning: use of deprecated associated function `std::error::Error::description`: use the Display impl or to_string()
       --> src/macros.rs:6:54
        |
    6   |             Err(e) => return Err(CliError::Generic(e.description().to_owned()))
        |                                                      ^^^^^^^^^^^
        | 
       ::: src/count/counts.rs:116:36
        |
    116 |                 let mut file_ref = cli_try!(File::open(&file));
        |                                    --------------------------- in this macro invocation
        |
        = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
    
    warning: use of deprecated associated function `std::error::Error::description`: use the Display impl or to_string()
       --> src/macros.rs:6:54
        |
    6   |             Err(e) => return Err(CliError::Generic(e.description().to_owned()))
        |                                                      ^^^^^^^^^^^
        | 
       ::: src/count/counts.rs:126:25
        |
    126 |                         cli_try!(file_ref.read_to_end(&mut vec_buf));
        |                         --------------------------------------------- in this macro invocation
        |
        = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
    
    warning: use of deprecated associated function `std::error::Error::description`: use the Display impl or to_string()
       --> src/macros.rs:6:54
        |
    6   |             Err(e) => return Err(CliError::Generic(e.description().to_owned()))
        |                                                      ^^^^^^^^^^^
        | 
       ::: src/count/counts.rs:130:25
        |
    130 |                         cli_try!(file_ref.read_to_string(&mut buffer));
        |                         ----------------------------------------------- in this macro invocation
        |
        = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
    
    warning: use of deprecated associated function `std::error::Error::description`: use the Display impl or to_string()
       --> src/macros.rs:6:54
        |
    6   |               Err(e) => return Err(CliError::Generic(e.description().to_owned()))
        |                                                        ^^^^^^^^^^^
        | 
       ::: src/count/counts.rs:272:9
        |
    272 | /         cli_try!(write!(w,
    273 | |                         "\tLanguage\tFiles\tLines\tBlanks\tComments\tCode{}\n",
    274 | |                         if self.cfg.usafe { "\tUnsafe (%)" } else { "" }));
        | |___________________________________________________________________________- in this macro invocation
        |
        = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
    
    warning: use of deprecated associated function `std::error::Error::description`: use the Display impl or to_string()
       --> src/macros.rs:6:54
        |
    6   |               Err(e) => return Err(CliError::Generic(e.description().to_owned()))
        |                                                        ^^^^^^^^^^^
        | 
       ::: src/count/counts.rs:275:9
        |
    275 | /         cli_try!(write!(w,
    276 | |                         "\t--------\t-----\t-----\t------\t--------\t----{}\n",
    277 | |                         if self.cfg.usafe { "\t----------" } else { "" }));
        | |___________________________________________________________________________- in this macro invocation
        |
        = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
    
    warning: use of deprecated associated function `std::error::Error::description`: use the Display impl or to_string()
       --> src/macros.rs:6:54
        |
    6   |               Err(e) => return Err(CliError::Generic(e.description().to_owned()))
        |                                                        ^^^^^^^^^^^
        | 
       ::: src/count/counts.rs:285:17
        |
    285 | /                 cli_try!(write!(w,
    286 | |                                 "\t{}\t{}\t{}\t{}\t{}\t{}\t{}\n",
    287 | |                                 count.lang.name(),
    288 | |                                 count.total_files(),
    ...   |
    296 | |                                     format!("{} ({:.2}%)", count.usafe(), usafe_per)
    297 | |                                 }));
        | |____________________________________- in this macro invocation
        |
        = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
    
    warning: use of deprecated associated function `std::error::Error::description`: use the Display impl or to_string()
       --> src/macros.rs:6:54
        |
    6   |             Err(e) => return Err(CliError::Generic(e.description().to_owned()))
        |                                                      ^^^^^^^^^^^
        | 
       ::: src/count/counts.rs:299:17
        |
    299 |                 cli_try!(write!(w, "\t{}\n", count));
        |                 ------------------------------------- in this macro invocation
        |
        = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
    
    warning: use of deprecated associated function `std::error::Error::description`: use the Display impl or to_string()
       --> src/macros.rs:6:54
        |
    6   |               Err(e) => return Err(CliError::Generic(e.description().to_owned()))
        |                                                        ^^^^^^^^^^^
        | 
       ::: src/count/counts.rs:302:9
        |
    302 | /         cli_try!(write!(w,
    303 | |                         "\t--------\t-----\t-----\t------\t--------\t----{}\n",
    304 | |                         if self.cfg.usafe { "\t----------" } else { "" }));
        | |___________________________________________________________________________- in this macro invocation
        |
        = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
    
    warning: use of deprecated associated function `std::error::Error::description`: use the Display impl or to_string()
       --> src/macros.rs:6:54
        |
    6   |               Err(e) => return Err(CliError::Generic(e.description().to_owned()))
        |                                                        ^^^^^^^^^^^
        | 
       ::: src/count/counts.rs:305:9
        |
    305 | /         cli_try!(write!(w,
    306 | |                         "{}\t\t{}\t{}\t{}\t{}\t{}{}\n",
    307 | |                         "Totals:",
    308 | |                         fmt::format_number(self.tot as u64, self.cfg.thousands),
    ...   |
    318 | |                             "".to_owned()
    319 | |                         }));
        | |____________________________- in this macro invocation
        |
        = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
    
    warning: use of deprecated associated function `std::error::Error::description`: use the Display impl or to_string()
       --> src/macros.rs:6:54
        |
    6   |             Err(e) => return Err(CliError::Generic(e.description().to_owned()))
        |                                                      ^^^^^^^^^^^
        | 
       ::: src/count/counts.rs:321:9
        |
    321 |         cli_try!(w.flush());
        |         -------------------- in this macro invocation
        |
        = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
    
    warning: use of deprecated associated function `std::error::Error::description`: use the Display impl or to_string()
      --> src/error.rs:44:58
       |
    44 |         write!(f, "{} {}", Format::Error("error:"), self.description())
       |                                                          ^^^^^^^^^^^
    
    warning: 21 warnings emitted
    
        Finished release [optimized] target(s) in 19.15s
    
    opened by mikemadden42 0
  • unable to install

    unable to install

        Updating git repository `https://github.com/kbknapp/cargo-count`
      Installing cargo-count v0.2.4 (https://github.com/kbknapp/cargo-count#eebe6f87)
        Updating crates.io index
    error: failed to compile `cargo-count v0.2.4 (https://github.com/kbknapp/cargo-count#eebe6f87)`, intermediate artifacts can be found at `/tmp/cargo-installSJ1NfQ`
    
    Caused by:
      failed to select a version for the requirement `clap = "~2.11.2"`
      candidate versions found which didn't match: 2.33.3, 2.33.2, 2.33.1, ...
      location searched: crates.io index
    required by package `cargo-count v0.2.4 (/home/cheng/.cargo/git/checkouts/cargo-count-01e28dcffdb7943b/eebe6f8)`
    
    
    opened by GopherJ 4
  • Fixed the unsafe regex.

    Fixed the unsafe regex.

    The previous regex missed many occurrences of unsafe, because it required something before and behind the keyword (see #38). Requiring a word boundary fixes that problem.

    However, the counting of unsafe code is still fishy. For example, occurrences of "unsafe" in strings are counted as unsafe code. Also, the formatting matters. This counts as 3 unsafe lines:

    unsafe {
      func();
    }
    

    And this as 1 unsafe line:

    unsafe
    {
      func();
    }
    
    opened by Nils-TUD 0
Releases(v0.2.1)
Owner
Kevin K.
I love to code, skydive, and do the things.
Kevin K.
Dead simple, memoized cargo subcommand to hoist cargo-built binaries into the current working directory, written in Rust.

cargo-hoist Dead simple cargo subcommand to hoist cargo-built binaries into scope. stable Install | User Docs | Crate Docs | Reference | Contributing

refcell.eth 6 Nov 9, 2023
Cargo subcommand for running cargo without dev-dependencies.

cargo-no-dev-deps Cargo subcommand for running cargo without dev-dependencies. This is an extraction of the --no-dev-deps flag of cargo-hack to be use

Taiki Endo 5 Jan 12, 2023
Cargo subcommand `release`: everything about releasing a rust crate.

cargo release Features Ensure you are in a good state for release, including: Right branch Up-to-date with remote Clean tree Supports workspaces using

null 933 Jan 8, 2023
A very simple third-party cargo subcommand to execute a custom command

cargo-x A very simple third-party cargo subcommand to execute a custom command Usage install cargo-x cargo install cargo-x or upgrade cargo install -

刘冲 9 Dec 26, 2022
Cargo script subcommand

cargo-script cargo-script is a Cargo subcommand designed to let people quickly and easily run Rust "scripts" which can make use of Cargo's package eco

Daniel Keep 643 Jan 3, 2023
A cargo subcommand for checking and applying updates to installed executables

cargo-update A cargo subcommand for checking and applying updates to installed executables Documentation Manpage Installation Firstly, ensure you have

наб 827 Jan 4, 2023
A cargo subcommand that displays ghidra function output through the use of the rizin rz-ghidra project.

cargo-rz-ghidra A cargo subcommand that displays ghidra function output through the use of the rizin rz-ghidra project. Install cargo install --git ht

wcampbell 4 Nov 5, 2022
Cargo subcommand to easily run targets/examples

cargo-select Cargo subcommand to easily run targets/examples/tests Fuzzy match against targets, examples or tests in current rust project. cargo-selec

null 13 Sep 15, 2022
Cargo-eval - A cargo plugin to quickly evaluate some Rust source code.

cargo eval A cargo plugin to quickly evaluate some Rust source code. Installation $ cargo install --git https://github.com/timClicks/cargo-eval.git Us

Tim McNamara 9 Dec 21, 2022
A simple cli to clone projects and fetch all projects in a GitHub org..

stupid-git A simple cli to clone projects and update all projects. get all repository from GitHub clone all pull all with git stash Usage create sgit.

Fengda Huang 5 Sep 15, 2022
A cargo plugin to shrink cargo's output

cargo single-line A simple cargo plugin that shrinks the visible cargo output to a single line (okay, in the best case scenario). In principle, the pl

Denis 5 Oct 30, 2022
Cargo-about - 📜 Cargo plugin to generate list of all licenses for a crate 🦀

?? cargo-about Cargo plugin for generating a license listing for all dependencies of a crate See the book ?? for in-depth documentation. Please Note:

Embark 281 Jan 1, 2023
A fast, resilient, isomorphic hacker news clone in ~1k lines of rust.

Hackernews sauron A hacker news clone in ~1k lines of rust. This is using sauron web-framework. Feature Isomorphic Completely identical server-side re

Jovansonlee Cesar 102 Nov 19, 2022
Neovim plugin for moving lines up and down, written in Rust

Moveline.nvim Moveline is a simple plugin for moving lines up and down. It's written in Rust using my library nvim-utils. Installation Moveline can be

Will Hopkins 34 Mar 18, 2023
Just a simple object renderer, written in under 500 lines using Rust.

All cargoes that the project runs are: bitflags: a crate for defining bitflag types cfg-if: a small macro crate for defining cfg-based - conditional c

null 3 May 4, 2023
A tool for adding new lines to files, skipping duplicates and write in Rust!

anew A tool for adding new lines to files written in Rust. The tool aids in appending lines from stdin to a file, but only if they don't already appea

z3r0yu 4 Nov 16, 2023
Turns lines of text into SVG files.

Sentences 2 svg Does what it says on the tin. This takes in a file with some sentences and outputs numbered svgs. There are 3 arguments to keep in min

Fallen 4 Eyes 1 Jan 1, 2022
Command-line tool that provides a workflow for extending, editing, diffing, and writing to vim-style grep lines.

Grug Grug is a command-line tool that provides a workflow for expanding, editing, diffing, and writing edits to files using vim-styled grep lines (suc

null 4 Apr 25, 2023
🦀 Stupid simple presentation of the number of words, characters and lines on your clipboard.

clipcount: Counting words from the clipboard content Why does this exist? Do you find yourself often needing to count the number of words in a piece o

Magnus Rødseth 3 Feb 23, 2024