semgrep / pfff

pfff is mainly an OCaml API to write static analysis, dynamic analysis, code visualizations, code navigations, or style-preserving source-to-source transformations such as refactorings on source code.
https://semgrep.dev
Other
186 stars 29 forks source link

Add max_len parameter to read_file for partial reads #551

Closed mjambon closed 2 years ago

mjambon commented 2 years ago

This is used by spacegrep, which will now be able to read from named pipes created with bash e.g.

$ spacegrep hello <(echo 'hello world')

Test plan for read_file:

make test

Tests for named pipes would be too complicated (involving a fork). For testing them, try semgrep-core -lang js -e x <(echo 'x'), which should return a match.

This PR also exposes the show_token_location function which is occasionally useful for debugging semgrep.

Security