pfff php program analysis at facebook yoann padioleau
play

Pfff: PHP Program Analysis at Facebook Yoann Padioleau (Facebook) - PowerPoint PPT Presentation

Pfff: PHP Program Analysis at Facebook Yoann Padioleau (Facebook) http://github.com/facebook/pfff OCaml Users and Developers Workshop 2013 About this talk n Feel free to ask questions during the talk PHP Program Analysis at Facebook n


  1. Pfff: PHP Program Analysis at Facebook Yoann Padioleau (Facebook) http://github.com/facebook/pfff OCaml Users and Developers Workshop 2013

  2. About this talk n Feel free to ask questions during the talk

  3. PHP Program Analysis at Facebook n Deadcode removal (global analysis) n Test coverage (dynamic analysis) n Use/Def checker (e.g. use of undefined function) n Variable checker (e.g. use of undeclared variable) n Syntactical Grep lint rules n Tainting Analysis via abstract interpreter (XSS) n Type checker daemon (Julien’s talk at CUFP’13) n Separation Logic? (Monoidics ocaml startup acquired) But I will not talk at all about any of this in this talk

  4. Pfff: Tools to Help Understand Large Codebase Yoann Padioleau (Facebook) http://github.com/facebook/pfff OCaml Users and Developers Workshop 2013

  5. Demo Codemap • Google maps for source code • Program analysis + software visualization • Need a 30’ monitor to really appreciate

  6. Demo Codegraph • Focus on code relationships, not source code • Understand the “Software Architecture”

  7. Demo Codemap + Codegraph

  8. Pfff tools and APIs n Other tools in Pfff: n CodeQuery: Prolog queries on codebase n stags: precise TAGS generator n sgrep/spatch: syntactical grep and patch n scheck: linter n Program analysis APIs for many languages (parsers, AST visitor/dumper/matcher/highlighter, use/def global analysis, coverage analysis, refactoring, etc): n OCaml (thx to .cmt in 4.00) n PHP n Java (thx to joust and javalib) n C/C++ (thx to yacfe and clang) n Html, Css, Javascript n …

  9. Conclusion n CodeMap: a scalable semantic-based source code visualizer/searcher/ navigator n CodeGraph: a scalable dependencies visualizer n Future work: n Reordering to minimize backward deps n Web UI (most of it done, with ocsigen) $ git clone git://github.com/facebook/pfff.git

  10. Features n Big picture, treemaps, “ macro level ” n Search, navigation n Semantic-based code highlighting “ micro level ” n Connection to editor (emacs/vim) n Extensible via layers (predator mode) Codemap is not an editor

  11. Features: treemap n Each rectangle is a file n Size of rectangle =~ size of file n Color of rectangle = “ aspect ” (test, main, storage, security, etc) n “ Code aware ” (heuristics) n Auto generated file do not eat real-estate n Code is more important than data, xml, jpg n Tiling, use all the space

  12. Features: search and navigation n Search n Highlighted rectangle n Ranked entities n Navigation n Up/down (not as smooth as google maps) n Direct access to file (faster than speedbar or expand-directory widgets) n Can see spread directories

  13. Features: semantic code visualizer n grammar-based highlighting, not regexps as in emacs/vim n Know records vs functions vs constants n Functions/classes are in bigger size than statements n Tiling, use all the space, multi columns n Semantic aware (global analysis) n Important functions are in bigger size

  14. Layers: alternate color schemes n Age (help find dead code) n #authors (important stuff usually) n Activity (what ’ s going on?) n Code coverage n Bugs/warnings of linter n grep/sgrep results n Top/Bottom modules n …

  15. Conclusion n A semantic-based source code visualizer/searcher/navigator n Accelerate loading the code into your brain (can see 20 files at once) n Future work: n Smoother zoom $ git clone git://github.com/facebook/pfff.git

  16. Related work n SeeSoft (does not scale, no treemaps) n Code Thumbnails (2 different modes) n 3d visualization (not sure it helps, eat pixels) n Disk explorer (not code aware, no micro- level)

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend