Git Product home page Git Product logo

sarif-rs's Introduction

Workflow Status codecov

sarif-rs

A group of Rust projects for interacting with the SARIF format.

Example

Parse cargo clippy output, convert to SARIF (clippy-sarif), then pretty print the SARIF to terminal (sarif-fmt).

$ cargo clippy --message-format=json | clippy-sarif | sarif-fmt
$ warning: using `Option.and_then(|x| Some(y))`, which is more succinctly expressed as `map(|x| y)`
    ┌─ sarif-fmt/src/bin.rs:423:13
    │
423 │ ╭             the_rule
424 │ │               .full_description
425 │ │               .as_ref()
426 │ │               .and_then(|mfms| Some(mfms.text.clone()))
    │ ╰───────────────────────────────────────────────────────^
    │
    = `#[warn(clippy::bind_instead_of_map)]` on by default
      for further information visit https://rust-lang.github.io/rust-clippy/master#bind_instead_of_map

Install

Each CLI may be installed via cargo, cargo-binstall or directly downloaded from the corresponding Github release.

Cargo

cargo install <cli_name> # ex. cargo install sarif-fmt

Cargo-binstall

cargo binstall <cli_name> # ex. cargo binstall sarif-fmt

Github Releases

The latest version is continuously published and tagged.

Using curl,

# make sure to adjust the target and version (you may also want to pin to a specific version)
curl -sSL https://github.com/psastras/sarif-rs/releases/download/shellcheck-sarif-latest/shellcheck-sarif-x86_64-unknown-linux-gnu -o shellcheck-sarif

Documentation

See each subproject for more detailed information:

  • clang-tidy-sarif: CLI tool to convert clang-tidy diagnostics into SARIF. See the Rust documentation.
  • clippy-sarif: CLI tool to convert clippy diagnostics into SARIF. See the Rust documentation.
  • hadolint-sarif: CLI tool to convert hadolint diagnostics into SARIF. See the Rust documentation.
  • shellcheck-sarif: CLI tool to convert shellcheck diagnostics into SARIF. See the Rust documentation.
  • sarif-fmt: CLI tool to pretty print SARIF diagnostics. See the Rust documentation.
  • serde-sarif: Typesafe SARIF structures for serializing and deserializing SARIF information using serde. See the Rust documentation.

Development

Before you begin, ensure the following programs are available on your machine:

Assuming cargo is installed on your machine, the standard cargo commands can be run to build and test all projects in the workspace:

cargo build
cargo test

For more information on specific configurations, refer to the cargo documentation.

nix is used internally (ie. via test fixtures) to manage other dependencies (so you don't have to manage them yourself.)

Releasing

To release a new version (publish to crates.io), prefix the head commit with release: and update the relevant rust crate versions. Once merged into main the pipeline should pick up the change and publish a new version.

TODOs

  • Stabilize the serde-sarif APIs
  • All around documentation improvements
  • Lots of code cleanup, especially in the CLI codebases
  • Testing
  • General CI and release flow improvements
  • Support for other converters

License: MIT

sarif-rs's People

Contributors

dependabot[bot] avatar dtolnay avatar erezamihud avatar fgardt avatar igrr avatar jonasbb avatar kianmeng avatar kintaro avatar psastras avatar timdiekmann avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.