Coder Social home page Coder Social logo

jetbrains / qodana-sarif Goto Github PK

View Code? Open in Web Editor NEW
9.0 8.0 4.0 663 KB

☕️ Java library for working with SARIF files by Qodana team

Home Page: https://jetbrains.github.io/qodana-sarif/

License: Apache License 2.0

Java 94.97% Kotlin 5.03%
qodana github-actions ci-cd sarif

qodana-sarif's Introduction

qodana-sarif

official JetBrains project Qodana GitHub Discussions Twitter Follow

This Java library contains classes describing the SARIF (Static Analysis Results Interchange Format) and utilities to work with them.

Features

  • Lazy Reading: The library supports a lazy reading format of SARIF, which allows the report to be read and processed gradually, potentially reducing memory consumption.

  • Full Report Reading: The library also supports reading the full SARIF report simultaneously. Be aware this is CPU and memory intensive.

  • Flexible Result Analysis: The com.jetbrains.qodana.sarif.model.Result object provides several properties which can be used to filter and analyze the issues in the report.

Usage

Adding to your project

Add the following to the build.gradle.kts:

val qodanaSarifVersion = "0.2.8"

repositories {
    maven("https://cache-redirector.jetbrains.com/intellij-dependencies")
}

dependencies {
    implementation("com.jetbrains.qodana:qodana-sarif:$qodanaSarifVersion")
}

Lazy Reading

fun getProblems(): Sequence<com.jetbrains.qodana.sarif.model.Result> = sequence {
    java.io.FileReader(filename).use { fileReader ->
        for (indexedResult in com.jetbrains.qodana.sarif.SarifUtil.lazyReadIndexedResults(fileReader)) {
            yield(indexedResult.result)
        }
    }
}

Full Report Reading

fun readReport(): com.jetbrains.qodana.sarif.model.SarifReport {
    return java.io.FileReader(filename).use { fileReader ->
        com.jetbrains.qodana.sarif.SarifUtil.readReport(fileReader)
    }
}

Result Properties

You can use one of the following com.jetbrains.qodana.sarif.model.Result properties in your utilities:

  • com.jetbrains.qodana.sarif.model.Result#getBaselineState Nullable baseline state - one of (new, updated, absent, unchanged)
  • com.jetbrains.qodana.sarif.model.Result#getRuleId Rule id that raised the problem
  • com.jetbrains.qodana.sarif.model.Result#getLevel Severity level of the issue

qodana-sarif's People

Contributors

avafanasiev avatar hybloid avatar jckoenen avatar kjoxcvjoixcv avatar lebedevea avatar tiulpin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  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.