semgrep VS jscodeshift

Compare semgrep vs jscodeshift and see what are their differences.

semgrep

Lightweight static analysis for many languages. Find bug variants with patterns that look like source code. (by semgrep)

jscodeshift

A JavaScript codemod toolkit. (by facebook)
Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
semgrep jscodeshift
74 28
9,724 8,955
2.2% 1.0%
9.9 5.2
about 2 hours ago about 2 months ago
OCaml JavaScript
GNU Lesser General Public License v3.0 only MIT License
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.

semgrep

Posts with mentions or reviews of semgrep. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2024-04-16.
  • A Deep Dive Into Terraform Static Code Analysis Tools: Features and Comparisons
    6 projects | dev.to | 16 Apr 2024
    Semgrep OSS Owner/Maintainer: Semgrep Age: First release on GitHub on February 6th, 2020 License: GNU Lesser General Public License v2.1
  • Semgrep – Find bugs and enforce code standards
    1 project | news.ycombinator.com | 9 Apr 2024
  • Application Security - Bridging Frontend and Cybersecurity: What is Application Security?
    1 project | dev.to | 2 Apr 2024
    Semgrep - https://semgrep.dev
  • Creating a DevSecOps pipeline with Jenkins — Part 1
    3 projects | dev.to | 17 Mar 2024
    For the SAST stage, I used SonarQube tool. SonarQube is an open-source platform developed by SonarSource for continuous inspection of code quality to perform automatic reviews with static analysis of code to detect bugs and code smells on more than 30 programming languages. I preferred SonarQube instead of other SAST tools because it has a detailed documentation and plugins about integration with Jenkins and SonarQube works with Java projects pretty well. Of course you can similar multi-language-supported tools such as Semgrep or language-specific tools such as Bandit.
  • Tree-Sitter
    4 projects | news.ycombinator.com | 17 Feb 2024
    > Not sure I understand your point.

    The problem is using Treesitter (for syntax highlighting and "semantic movements") and an LSP at the same time. So if your language has a LSP, using Treesitter additionally is redundant at best and introduces inconcistency at worst.

    I'm not talking about using Treesitter as the parser for the LSP.

    > Most popular languages have language-specific tools

    I'd say even less popular langauges like Coq^H^H^HRocq, Lean 4, Koka, Idris, Unison, ... have their "own" tools, I do not know of a language that uses a Treesitter parser in its LSP, but I do know about tools like https://semgrep.dev/ (written in OCaml) and Github's code search which use Treesitter.

  • AST-grep(sg) is a CLI tool for code structural search, lint, and rewriting
    15 projects | news.ycombinator.com | 10 Dec 2023
    Well, when I seach for "semgrep", I get a very nice corporate landing page with a "Book Demo" button. Which is a level of hassle that just isn't worth it for smaller teams, because "Book Demo" usually means "We're going to try to do a dance to see how much money we can extract from you." Which smaller teams may only want to do for a handful of key tools.

    (4 years ago, I was more willing to put up with enterprise licensing. But in the last two years, I've seen way too many enterprise vendors try to squeeze every penny they can get from existing clients. An enterprise sales process now often means "Expect 30% annual price hikes once you're in too deep to back out.")

    There's also an open source "semgrep" project here: https://github.com/semgrep/semgrep. But this seems to be basically a vulernability scanner, going by the README.

    Whereas AST-grep seems to focus heavily on things like:

    1. One-off searching: "Search my tree for this pattern."

    2. Refactoring: "Replace this pattern with this other pattern."

    AST-grep also includes a vulnerability scanning mode like semgrep.

    It's possible that semgrep also has nice support for (1) and (2), but it isn't clearly visible on their corporate landing page or the first open source README I found.

  • Top 10 Snyk Alternatives for Code Security
    3 projects | dev.to | 31 Aug 2023
    7. Semgrep
  • Semgrep: Semantic Grep for Code
    1 project | news.ycombinator.com | 4 Aug 2023
  • semgrep VS bearer - a user suggested alternative
    2 projects | 10 Jul 2023
  • Powerful SAST project for Android Application Security
    3 projects | /r/bugbounty | 21 Jun 2023
    This project is a compilation of Semgrep rules derived from the OWASP Mobile Application Security Testing Guide (MASTG) specifically for Android applications. The aim is to enhance and support Mobile Application Penetration Testing (MAPT) activities conducted by the ethical hacker community. The primary objective of these rules is to address the static tests outlined in the OWASP MASTG.

jscodeshift

Posts with mentions or reviews of jscodeshift. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2023-08-01.
  • Building a JSON Parser from scratch with JS 🤯
    7 projects | dev.to | 1 Aug 2023
    A parser can have various applications in everyday life, and you probably use some parser daily. Babel, webpack, eslint, prettier, and jscodeshift. All of them, behind the scenes, run a parser that manipulates an Abstract Syntax Tree (AST) to do what you need - we'll talk about that later, don't worry.
  • [AskJS] Can anyone recommend a test runner with ESM and Custom Loader Support?
    3 projects | /r/javascript | 11 Jun 2023
    OP: If this is an avenue you feel like entertaining, here are some nice codemod tools that could ease the transition for you: CodeQue, Subsecond, and the old standard jscodeshift.
  • [AskJS] Are there any tools to help automatically update imports when splitting typescript libraries in a Monorepo?
    3 projects | /r/javascript | 19 May 2023
    If that isn't enough or you find issues with it, the current de-facto standard for codemods is jscodeshift. You'll write more code, but at least you only have to write it once.
  • env: node\r: No such file or directory
    1 project | dev.to | 9 Mar 2023
    Here is the pull request https://github.com/facebook/jscodeshift/pull/549
  • Criando um Parser de JSON do zero
    7 projects | dev.to | 24 Feb 2023
  • Show HN: Starter.place – Gumroad for Starter Repos
    3 projects | news.ycombinator.com | 22 Feb 2023
    Those are important but tough problems!

    1. I feel like codemods and a setup shell prompt are the best solution to this, but this looks different for each language (eg, in JS there is https://github.com/facebook/jscodeshift). I could make UI around that for listers to provide parts of the app that should replaced and buyers to provide values for it, but it could be quite a rabbit hole. This is actually why I show the README for the repos, so users can see if the setup steps are comprehensive before buying (for paid ones).

    2. I agree atomic commits can help someone navigate a new codebase. In the same spirit as my response to #1, I don't feel confident I could enforce this, but I could surface the commits on the starter repo page so potential buyers could see if the author laid things out well.

    Thanks for the ideas!

  • Automatic Dependency Upgrade Tool (with auto-resolve breaking changes)
    2 projects | /r/react | 5 Feb 2023
    That's why I've been working on a tool that automatically upgrades major versions of libraries with breaking changes, the idea is to simplify the process and save developers time and effort by having a bank of transformers (using codemod & jscodeshift) and open source them:
  • Effective Refactoring with Codemods
    5 projects | dev.to | 30 Jan 2023
    JSCodeshift: A toolkit for running and writing codemods.
  • Launch HN: FlyCode (YC S22) – Let product teams edit web apps without coding
    2 projects | news.ycombinator.com | 6 Sep 2022
    Hi HN community, we are Jake, Tzachi and Etai, co-founders of FlyCode (https://www.flycode.com/). FlyCode makes it easy for product, UX, and marketing teams to edit web apps without coding, so they don’t have to wait on (or consume) developer time, and can iterate, test, and release faster. See a quick example here: https://www.youtube.com/watch?v=jDL5oa2nEHo

    Non-technical teams frequently need to edit the copy (text), images, and links that appear in a web app. How to manage these has long been a pain on software projects. You can keep them separate from the code, in some form that non-programmers can edit, but this adds a lot of complexity and is usually brittle, as it can bypass the regular development workflows (as CI, staging envs & deploy previews). It’s simpler to keep them in the code—but then only programmers can easily edit them. Everyone else has to wait to get their changes in, plus the devs have to do a lot of edits that aren’t their main work. This slows projects down and is expensive. It also means that product/marketing/UX teams can’t do things that require rapid iteration, such as sophisticated forms of A/B or usability testing. This limits their work and ultimately is bad for both quality and revenue.

    There have been many approaches to solving this dilemma, including custom built admin tools that are limited in functionality and require maintenance, offloading to CMS that require heavy integration, are normally used for simple static apps, and bind your stack to their SDKs. Or wasting a developer’s time to do it for you…

    We took a new approach by automatically analyzing a codebase’s structure, similar to a compiler. This allows us to automatically populate our platform in which product/UX/marketing teams can easily use to edit their text and images. We programmatically turn those edits into code changes. Our GitHub bot then takes these code changes and creates a pull request just like a developer would—but without the latency (and boredom!). Developers retain codebase ownership, while non-developers become individual contributors to the dev process, just like the others.

    We use well-established practices for parsing and editing source code (like https://github.com/facebook/jscodeshift), covering most of the major technologies used for building web apps (React, Angular, Vue, and Ruby on Rails included).

    Once our software has parsed your codebase, it generates an editing portal for your app that teams can easily use to find, manage, and edit product copy, images, and links, and then auto-generate PRs. You can edit product copy regardless of whether it is in resource files or hardcoded (fun fact: some of the largest and fastest-growing tech companies have most of their strings hardcoded!), and you can replace and upload new images and icons to your product.

    The integration with GitHub (https://www.flycode.com/developers) took us a long time to get right. There’s not a lot of documentation around integrating GitHub to platforms, and things like connecting an org or connection requests turned out to be non-trivial. We're particularly proud of the result because unlike with other tools, you don’t have to do any significant integration work.

    Our GitHub app finds texts and images in the source code and sends them to our platform (you have full control of what and where we scan). Once a user requests a change it updates the texts and the images in the codebase and creates a pull request.

    We did a Show HN earlier this year: https://news.ycombinator.com/item?id=31166924, which helped us get some serious leads, which was awesome. Since then we’ve moved out of beta, added new content types (images), launched a new UI and visual editor (EAP), and automated the onboarding of new repos.

    We have a handful of companies paying for this and spent the last year focusing on making it extremely simple to use. It only takes 3 minutes to connect our GitHub app and configure the system for your team to start editing. It doesn’t require any changes to your code, or any special maintenance. You can get started here: https://app.flycode.com

    We are hoping to use this launch to get some more feedback from you all! We are far from our vision to be a platform for everything front-end but are working hard every day to improve the user experience and feature requests from our early collaborators (editing links, themes, variables, JSON configuration, defining in-code A/B tests, etc.).

    We're really happy to show this to you all and thank you for reading about it. For those that sign up, time yourself to check that our “3-minute connect + config” claim isn't just a sales tactic! We look forward to further conversation in the comments.

  • JARVIS – Write me a Codemod
    6 projects | dev.to | 6 Sep 2022
    jscodeshift

What are some alternatives?

When comparing semgrep and jscodeshift you can also consider the following projects:

SonarQube - Continuous Inspection

codemod - Codemod is a tool/library to assist you with large-scale codebase refactors that can be partially automated but still require human oversight and occasional intervention. Codemod was developed at Facebook and released as open source.

snyk - Snyk CLI scans and monitors your projects for security vulnerabilities. [Moved to: https://github.com/snyk/cli]

Acorn - A small, fast, JavaScript-based JavaScript parser

codeql - CodeQL: the libraries and queries that power security researchers around the world, as well as code scanning in GitHub Advanced Security

putout - 🐊 Pluggable and configurable JavaScript Linter, code transformer and formatter, drop-in ESLint superpower replacement 💪 with built-in support for js, jsx typescript, flow, markdown, yaml and json. Write declarative codemods in a simplest possible way 😏

Spotbugs - SpotBugs is FindBugs' successor. A tool for static analysis to look for bugs in Java code.

react-codemod - React codemod scripts

pre-commit - A framework for managing and maintaining multi-language pre-commit hooks.

comby - A code rewrite tool for structural search and replace that supports ~every language.

detect-secrets - An enterprise friendly way of detecting and preventing secrets in code.

ts-migrate - A tool to help migrate JavaScript code quickly and conveniently to TypeScript