unsafe-unicorn

Crates.iounsafe-unicorn
lib.rsunsafe-unicorn
version0.0.1
sourcesrc
created_at2017-09-14 22:37:03.206533
updated_at2017-09-21 16:02:02.63015
descriptionlibrary for analyzing usage of unsafe code in rust projects
homepage
repositoryhttps://github.com/avadacatavra/unsafe-unicorn
max_upload_size
id31814
size17,746
Diane Hosfelt (avadacatavra)

documentation

README

A crate for analyzing the usage of unsafe code in Rust, based on cloc-rust.

Currently, this is based on a textual analysis of code. In the future, this could be expanded to use the AST for further analysis.

For more information on unsafe code:

Example

extern crate unsafe_unicorn;

use unsafe_unicorn::{ClocStats, Cloc, ClocVerbosity};

fn main() {

    // Get the stats for a single file
    let c = ClocStats::from_file("./resources/test.rs").unwrap();
    println!("{}", c);

    // Get the stats for the resources directory
    let mut cloc = Cloc::new();
    cloc.analyze_dir("./resources").unwrap();
    println!("{}", cloc);

    // Change the verbosity to be file based and then get stats file by file for resources dir
    cloc.set_verbose(ClocVerbosity::File);
    cloc.analyze_dir("./resources").unwrap();
    println!("{}", cloc)

}

More examples are available in examples/

TODO

  • make PR for tokei
  • add dependency analysis
  • expand tests
  • add docs
  • clean up code
  • look for c-like array iteration?
Commit count: 4

cargo fmt