pfff

Tools for code analysis, visualizations, or style-preserving source transformation.

Subscribe to updates I use pfff


Statistics on pfff

Number of watchers on Github 2171
Number of open issues 32
Average time to close an issue 22 days
Main language OCaml
Average time to merge a PR 23 days
Open pull requests 4+
Closed pull requests 6+
Last commit over 1 year ago
Repo Created almost 8 years ago
Repo Last Updated 5 months ago
Size 34.4 MB
Homepage http://github.com...
Organization / Authorfacebook
Latest Releasev0.29
Contributors36
Page Updated
Do you use pfff? Leave a review!
View open issues (32)
View pfff activity
View TODOs for pfff (726)
View on github
Latest Open Source Launches
Trendy new open source projects in your inbox! View examples

Subscribe to our mailing list

Evaluating pfff for your project? Score Explanation
Commits Score (?)
Issues & PR Score (?)
                          pfff

Build Status

pfff is a set of tools and APIs to perform static analysis, code visualizations, code navigations, or style-preserving source-to-source transformations such as refactorings on source code. There is good support for C, Java, Javascript and PHP. There is also preliminary support for other languages such as C++, Rust, C#, Html, CSS, Erlang, Lisp, Haskell, Python, OPA and SQL. There is also very good support for OCaml code so that the framework can be used on the code of pfff itself.

For each languages there are mainly 2 libraries, for instance parsing_php.cma and analysis_php.cma, that you can embed in your own application if you need to process PHP code. See the demos/ directory for example of use of the pfff API. See also docs/manual/Parsing_xxx.pdf and docs/manual/Analyzis_xxx.pdf for more documentation on how to use or extend pfff.

pfff is also made of few tools:

  • pfff, which allows to test the different parsers on a single file
  • scheck, a bug finder
  • stags, an Emacs tag generator
  • sgrep, a syntactical grep
  • spatch, a syntactical patch
  • codemap, which is a gtk and cairo based source code visualizer/navigator/searcher leveraging the information computed previously by pfff_db and codegraph.
  • codegraph, a source code indexer and package/module/class dependency visualizer
  • codequery, an interactive tool a la SQL to query information about the structure of a codebase using Prolog as the query engine
  • pfff_db, which does some global analysis on a set of source files and store the data in a marshalled form in a file somewhere (e.g. /tmp/db.json)

For more information, look at the pfff wiki here: http://github.com/facebook/pfff/wiki/Main as well as the docs/manual/ directory.

Usage for pfff:

$ ./pfff -parse_php demos/foo.php

or

$ ./pfff -dump_php demos/foo.php

You can also look at ./pfff --help

Usage for pfff_db:

$ ./pfff_db -lang ml -o /tmp/pfff.json ~/pfff

to analyze all the .ml and .mli files under ~/pfff and store metadata information (the database) in /tmp/pfff.json

Usage for codemap:

$ ./codemap ~/pfff

This should launch a gtk-based GUI that allows you to visualize source code and perform some code search.

Usage for codegraph:

$ ./codegraph -lang cmt -build ~/pfff

to generate a graph_code.marshall file in ~/pfff containing all dependency information about the pfff codebase using the typed bytecode .cmt files generated during the compilation of pfff.

$ ./codegraph ~/pfff

This should launch a gtk-based GUI that allows you to visualize source code dependencies.

More information

Look at the pfff wiki here: http://github.com/facebook/pfff/wiki/Main

pfff open issues Ask a question     (View All Issues)
  • almost 2 years OPAM installation failed
  • almost 2 years No support for local variable in `codegraph`?
  • almost 2 years Error while running codegraph on Mac OS X 10.11.3
  • over 2 years [spatch] Meta variables reformatted during patching
  • over 2 years Codegraph unknown option -lang
  • almost 3 years failed to build on MacOSX 10.10 on file 'utils_js.cmi'
  • about 3 years sgrep cannot identify calls to a static method within the same class
  • about 3 years php parsing issue
  • about 3 years How is new language support added?
  • about 3 years Scheck does not detect bugs
  • about 3 years sgrep on ternary operator in C/C++
  • about 3 years "2" appended for Not found packages (java)
  • over 3 years codequery assumes that implements/mixins exists
  • over 3 years File "main_codegraph.ml", line 263
  • over 3 years Bad annotation: deprecated
  • over 3 years OSX Yosemite 10.10.2 + Homebrew
  • over 3 years Create online pfff interest groups
  • over 3 years Support for Java 8
  • over 3 years Could this adapted to work with srclib?
  • over 3 years allow building with external libraries
  • over 3 years prettyphp reorders statements following PHP open tags and comments on the same line
  • almost 4 years Support PSR conventions when prettifying PHP code
  • almost 4 years Install: OSX 10.10 developer preview + Xcode 5.1.1 error
  • about 4 years Can't use spatch to wrap a function call
  • over 4 years Can't find binaries after installation
  • over 4 years cant use namespace in spatch(in scan for, can use in substitute)
  • over 4 years Codemap blank view at startup
  • over 4 years parsing issue (javascript)
pfff open pull requests (View All Pulls)
  • Serializes graph from pfff to JSON (GraphSON) format
  • Codegraph with novisual option
  • Codegraph/java: eges drawn for methods
  • Disambiguate PHP shortform ternary
pfff questions on Stackoverflow (View All Questions)
  • make inconsistent assumptions over interface Piqobj_to_xml "Pfff"
Other projects in OCaml