Semgrep Rules

Semgrep rules specific to Frappe Framework

Install Semgrep Rules

bench get-app https://github.com/frappe/semgrep-rules

Tags

  • erpnext
  • frappe-framework
  • lint
  • semgrep

Add the Frappe Gems badge to your README

Maintain Semgrep Rules? Paste this into your README:

[![Listed on Frappe Gems](https://frappegems.com/api/method/frappe_gems.seo.badge?app=frappe%2Fsemgrep-rules)](https://frappegems.com/gems/apps/frappe/semgrep-rules)

About Semgrep Rules

Frappe Semgrep rules

Semgrep rules specific to Frappe Framework

These rules guard against typical mistakes or bad practices while working on Frappe Framework apps. Frappe's own apps also use this to simplify repetitive checks in code review process.

How to Use in my app

Github Action

You can use a GitHub Action to automatically validate changes with semgrep rules on all PRs.

name: Linters

on:
  pull_request: { }

jobs:
  linters:
    name: Frappe Linter
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3

      - name: Set up Python
        uses: actions/setup-python@v4
        with:
          python-version: '3.10'

      - name: Download Semgrep rules
        run: git clone --depth 1 https://github.com/frappe/semgrep-rules.git frappe-semgrep-rules

      - name: Download semgrep
        run: pip install semgrep

      - name: Run Semgrep rules
        run: semgrep ci --config ./frappe-semgrep-rules/rules

Manually / running semgrep locally

  • Install and verify that semgrep works semgrep --version
  • clone the rules repository with git clone
  • Run semgrep specifying rules folder as config semgrep --config=~/path/to/frappe-semgrep-rules/rules your_app_folder

Tip: You can optionally pass --severity=ERROR to ignore rules that produce warnings and only catch errors.

How to contribute new rules

Related Other apps for Frappe & ERPNext

  • Erpnext — Free and Open Source Enterprise Resource Planning (ERP)
  • Helpdesk — Modern, Streamlined, Free and Open Source Customer Service Software
  • Print Designer — Visual print designer for Frappe / ERPNext
  • Ctr — CTR模型代码和学习笔记总结
  • Whitelabel — Whitelabel ERPNext
  • Fossunited — fossunited.org
  • Helm — Helm Chart Repository for Frappe/ERPNext
  • Frappe Attachments S3 — A frappe app to upload file attachments in doctypes to s3.