facebook / infer

A static analyzer for Java, C, C++, and Objective-C
http://fbinfer.com/
MIT License
14.96k stars 2.02k forks source link

How to intergrate Infer's analysis result into Phabricator? #673

Open sencho opened 7 years ago

sencho commented 7 years ago

We uses Infer static analyze tool of Facebook and want to know which API could use to post the result to Phabricator,thank you.

dulmarod commented 7 years ago

We don't have an open source API for that yet I'm afraid. We may work on that in the next few months. For now, you would need to start from the report.json and build the integration.

sencho commented 7 years ago

Phabricator does not accept the feature PR, then how can deliver it as soon as possible ?

dulmarod commented 7 years ago

Sorry I can't help you with that, we use a version of Phabricator that is internal to Facebook, so we haven't tried sending them PRs.

sencho commented 7 years ago

Would you share your plan how to realize in this case.would provide a fork version?

jvillard commented 7 years ago

You can use the conduit API to talk to Phabricator, for instance to send one inline comment for each infer report on a diff.

sencho commented 7 years ago

@jvillard ,I have seen the Phabricator API,the matter is Infer JSON format reporter fields is not match ,in this case it do not work unless reassembled the JSON data by tools jq . I guess in the Facebook workflow is not the case, the normal should be generated Infer JSON format report can be sent directly to the Phabricator API, and this API you are private, is that so? I have a suggestion, can Infer generate a public version of the API can be used directly to the JSON format?

jeremydubreil commented 7 years ago

@sencho: What is the CI tool your are using? Infer will generate a JSON report in some Infer specific format and this report is not intended to be consumed directly by Phabricator (even though the idea is interesting). However, the analysis script that is running on the CI can read the Infer report and then use the Phabricator conduit API to create error messages for the code review tools.

sencho commented 7 years ago

@jeremydubreil ,I’m using GItLab CI,I think a static analysis tool is best to provide a set of CI solutions, especially static analysis tools rely on the machine to complete the work, should be automatically executed by the computer, CI analysis of the results to the code review tool.

jeremydubreil commented 7 years ago

@sencho: I am not sure I understand you comment. Is having the possibility for Phabricator to load the Infer reports directly what you are suggesting here?

sencho commented 7 years ago

img @jeremydubreil

I recommend infer to provide an JSON data format for phabricator API, commenting on the results of the analysis. Mayber as #674 said,Infer could provide a option like --phabricator-json,output a json report ,then CI can use this json post to phabricator API.