Coder Social home page Coder Social logo

template-rules's Introduction

template-rules

powered by semgrep r2c community slack

a template repo for semgrep rules and semgrep performance.

Geting started

This guide assumes you are familiar with Semgrep and have it already installed.

  1. Test out this template repo with the following command:
git clone https://github.com/semgrep/template-rules.git

To test out the rules template, run:

semgrep --config template-rules/rules template-rules/rules/hello-world.py

To test out the benchmarking scripts in semgrep/perf, run:

cd semgrep/perf
make

or refer to https://github.com/returntocorp/semgrep/tree/develop/perf.

  1. Copy this template to your own repo.

Performance CI Configurations


What are these for?

These configurations are Github Action scripts that you can run in CI. You can find them in perf-templates.

benchmark-tests.yml benchmark-tests.yml is a YAML file that runs the timing benchmark with source code in perf.

The Run Timing Benchmark With Latest Semgrep Version action runs the benchmark script with the following flags:

  • --small-only: runs the script on small benchmarking repositories only, as compared to medium-sized or large-sized repositories.
  • --std-only: runs semgrep with no optimization flags.
  • --output-time-per-rule-json: outputs a JSON file that states the total time taken per rule per repository and the average time taken per rule.

The Run Timing Benchmark With Specified Config File action runs the benchmark script with the additional flag:

  • --config: runs the benchmarking script using the repositories and rules specified in a YAML config file.

config-template.yml config-template.yml is a YAML file that lets the user specify which repositories and rules to run the benchmarking scripts on. Feeding this file into the --config flag for the run-benchmarks script in the semgrep/perf folder.

How can I use these?

  1. Copy the desired configuration files into your .github/workflows folder.
  2. Change these configuration templates as needed.
  3. Create a pull request with these changes and see if the appropriate tests are running in your Github Actions!

Rule Templates

  1. Add your rules (and their test files) to the rules folder
  2. Iterate rules and ensure they pass the built-in tests
  3. Open a PR to the Awesome Semgrep list
  4. Ask for help in the Semgrep community slack any time ๐Ÿ‘‹

template-rules's People

Contributors

anshuman-dev avatar colleend avatar dependabot[bot] avatar drewdennison 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.