Comments (6)
What is the interface you want? where is the pattern stored? in the yaml file? on the command-line?
on stdin?
from semgrep.
Just the command line I think, i.e.:
sgrep --validate-pattern="$X =\ def()" -> return 1
sgrep --validate-pattern="$X == $X" -> return 0
from semgrep.
You'll need to handle patterns on multiple lines
from semgrep.
@aryx could I embed newlines eg: "def $X():\n..." or does sgrep treat them specially?
from semgrep.
you'll need to call me with a string containing real newlines, not "\n" that I have to interpret.
This is why maybe reading from stdin or from a file is simpler. There are always weird things
the shell is doing with arguments interpretation, removing quotes, interpreting $, etc.
from semgrep.
How about stdin then?
cat my-pattern.sgrep | sgrep --validate-pattern-stdin
echo $? # returns 0 if valid or 1 if invalid
from semgrep.
Related Issues (20)
- Recent versions not available on Homebrew HOT 2
- Taint rules will not match in C# checked blocks
- Syntax errors with latest C# features
- semgrep scan --test incorrectly parses generic file as other languages
- Error: Library "tree-sitter-lang.jsonnet" not found. -> required by library "parser_jsonnet.tree_sitter" in _build/default/languages/jsonnet/tree-sitter -> required by executable Main in src/main/dune:2 -> required by _build/default/src/main/Main.exe HOT 1
- dune build src/main/Main.exe HOT 1
- dune build src/main/Main.exe HOT 1
- semgrep --validate --metrics=off Not activated HOT 3
- semgrep error: invalid language: clojure HOT 2
- Solidity operator precedence appears to be incorrect HOT 2
- nosemgrep for HubSpot HubL files HOT 1
- Lua file upgrade.lua skipped by analysis failure due to failed parsing HOT 1
- `LL` and `ULL` breaks parsing and analysis of Lua file HOT 1
- v1.75 introduces FPs in taint rules
- Invalid inline pattern CLI execution should fail early
- [Feature] Include multiple test files per a single rule definition HOT 1
- SAST advice for specifying minimum TLS versions in Java is incorrect HOT 2
- exclude-minified-files not working HOT 1
- My rule can not work for java comment. HOT 1
- [Julia] Using a metavariable captured with named capture group fails for `metavariable-pattern`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from semgrep.