FBInfer for Review Bot
Review Request #11202 — Created Sept. 24, 2020 and submitted
FBInfer Tool is now working for all the following build configurations:
- Android
- Apache Ant
- Buck
- C
- CMake
- Gradle with and without a Wrapper
- iOS
- Java
- Make
- Maven
- Objective-C
- XCode
The usability of this tool is largely dependent on the setup of a
user's ReviewBoard environment. Meaning that if a user would like to
use Review Bot to test an Android project. The user must have a working
Android SDK in the server instance in which the Review Bot is pulling
down the repository. Setups for each particular environment will be
offered in the documentation. The latest revisions include
optimizations that reduce the usage of infer run
. So that it is
executed minimally, to enhance speed and efficiency.
Each build configuration was tested manually with its own environment
and repository. More information about the tests can be found in
Week 3 and Week 4 of my Notion journal: https://bit.ly/351ttRQ.
Description | From | Last Updated |
---|---|---|
Can you update the screenshot to show the latest text? |
david | |
Summary should say "Review Bot", rather than "ReviewBot." We've altered the name a bit, but still have places where we … |
chipx86 | |
Something seems to have gone wrong with the hange description. Guessing it's because there's no blank line before or after … |
chipx86 | |
F401 'reviewbot.utils.process.execute' imported but unused |
reviewbot | |
E302 expected 2 blank lines, found 1 |
reviewbot | |
W293 blank line contains whitespace |
reviewbot | |
E124 closing bracket does not match visual indentation |
reviewbot | |
E303 too many blank lines (2) |
reviewbot | |
W391 blank line at end of file |
reviewbot | |
F401 'reviewbot.utils.process.execute' imported but unused |
reviewbot | |
W291 trailing whitespace |
reviewbot | |
Could you add a comment at the start of the file? e.g. Following the doc8.py, """Review Bot tool to run … |
ceciliawei | |
Yep, that is definitely an artifact from shuffling my code around. Good catch, seems that flake8 did not complain about … |
jblazusi | |
Were you intended to put the command in the end? Shouldn't it just be list.extend(...)? |
ceciliawei | |
Since this change is in another CR for review, is it possible to remove the change from this CR? So … |
ceciliawei | |
I was reading something related to json then I thought about this code review. Would it be helpful to put … |
ceciliawei | |
This should probably be dedented one space. |
david | |
This should use single quotes. |
david | |
Let's use double quotes around "build" |
david | |
Let's add a trailing comma to this line. |
david | |
This should use single quotes. |
david | |
Let's add a trailing comma to this line. |
david | |
This should use single quotes. |
david | |
Let's use double quotes around "iphonesimulator", which lets us avoid the \\ characters. |
david | |
Let's add a trailing comma to this line. |
david | |
Can you add periods to the end of the comments in here? This line and others below. |
david | |
Let's add a trailing comma to this line. |
david | |
There are a bunch of places where we use settings['build_type']. Perhaps pull that out into a build_type variable? |
david | |
Let's add a trailing comma to this line. |
david | |
Please add a blank line between these two. |
david | |
Add a blank line between these two please. |
david | |
The comma within the function call here can go away. |
david | |
I don't think we need to list the file here, since the diff comment will be attached to the file … |
david | |
Just for consistency, can we call the entry point fbinfer? |
david | |
I just realized, we should use shlex.split(build_type) here, to parse it as a shell would. Otherwise if there are quoted … |
david | |
"fbinfer" or "FBInfer"? |
chipx86 | |
How about putting the string inside of the () on the next line, indented 4 spaces? That'll give it breathing … |
chipx86 | |
This can be one statement. |
chipx86 | |
You'll want a try/except around this, since it can fail. |
chipx86 | |
Typo: "compilation". The comment could use an adjustment. I wasn't sure at first glance what it was saying. |
chipx86 | |
How about: build_type = 'make' settings['build_type'] = build_type This is a bit cleaner, since you're not having to store a … |
chipx86 | |
It's best to use += instead of .extend(). Operators are faster to invoke than functions. |
chipx86 | |
Better to use += here too. |
chipx86 | |
And here. |
chipx86 | |
This will need a try/except. |
chipx86 | |
This becomes a bit easier to see as one concrete operation if you do: execute(['infer', 'run', '--'] + shlex.split(build_type) + … |
chipx86 | |
+= here as well. |
chipx86 | |
This needs a try/except. |
chipx86 | |
fp is the standard variable for a file pointer when opening a file. You should also specify an explicit mode … |
chipx86 | |
Can we break after this match? |
chipx86 | |
Formatting will be more consistent with our standards by doing: f.comment('Bug Type: %s\n%s: %s' % (entry['bug_type_hum'], entry['severity'] entry['qualifier']), entry['line']) Or, … |
chipx86 | |
No blank line here. |
chipx86 | |
E128 continuation line under-indented for visual indent |
reviewbot | |
E231 missing whitespace after ',' |
reviewbot | |
If you make the change to handle_files that I suggested below, then cmake should be added to this list as … |
david | |
By my reading of the code, if the build type is one of multi_file_build_types, we'll never load the report and … |
david | |
Would it be better to initialize build_type in __init__ instead of defining it in the method? |
ceciliawei | |
Same comment as in the other CR. |
ceciliawei | |
^ |
ceciliawei | |
^ |
ceciliawei |
- Commit:
-
bcd3d151388605cb49da1482c3d915c3de48c42f24795958fc405f18f96cd705be483ba7701ae272
Checks run (2 succeeded)
- Description:
-
~ [WIP] FBInfer for ReviewBot
~ [WIP] FBInfer for ReviewBot
+ FBInfer is officially working on simple Java files. + More work needs to be done to confirm that it will + compile and analyze correctly with other build types. + Work needs to also be done to handle scenarios, where + the project cannot compile successfully. - Testing Done:
-
+ Only simple tests on a single Java file have been ran.
+ More tests will need to be conducted on the various + build types: Android, Maven, Apache Ant, etc... - Groups:
-
- People:
- Added Files:
- Description:
-
[WIP] FBInfer for ReviewBot
~ FBInfer is officially working on simple Java files. ~ More work needs to be done to confirm that it will ~ compile and analyze correctly with other build types. ~ FBInfer is officially working on simple Java files. More work needs to be ~ done to confirm that it will compile and analyze correctly with other ~ build types. Work needs to also be done to handle scenarios, where - Work needs to also be done to handle scenarios, where the project cannot compile successfully. - Testing Done:
-
~ Only simple tests on a single Java file have been ran.
~ More tests will need to be conducted on the various ~ build types: Android, Maven, Apache Ant, etc... ~ Only simple tests on a single Java file have been ran. More tests will
~ need to be conducted on the various build types: Android, Maven, ~ Apache Ant, etc...
- Commit:
-
24795958fc405f18f96cd705be483ba7701ae272fb9808513b6469d0b88c043f30dab2604d5e524e
Checks run (2 succeeded)
- Summary:
-
[WIP] FBInfer for ReviewBotFBInfer for ReviewBot
- Description:
-
~ [WIP] FBInfer for ReviewBot
~ FBInfer is officially working on simple Java files. More work needs to be ~ done to confirm that it will compile and analyze correctly with other ~ build types. Work needs to also be done to handle scenarios, where ~ the project cannot compile successfully. ~ FBInfer Tool is officially working for all the following build configurations:
~ * Android ~ * Apache Ant ~ * Buck ~ * C + * CMake + * Gradle with and without a Wrapper + * iOS + * Java + * Make + * Maven + * Objective-C + * XCode + The usability of this tool is largely dependent on the setup of a user's + ReviewBoard environment. Meaning that if a user would like to use ReviewBot + to test an Android project. The user must have a working Android SDK in + the server instance in which the ReviewBot is pulling down the repository. + Setups for each particular environment will be offered in the documentation. - Testing Done:
-
~ Only simple tests on a single Java file have been ran. More tests will
~ need to be conducted on the various build types: Android, Maven, ~ Apache Ant, etc... ~ Each build configuration was tested manually with its own environment and
~ repository. More information about the tests can be found in Week 3 and ~ Week 4 of my Notion journal: + https://www.notion.so/reviewboard/Jacob-Blazusiak-6a6975cb74c44873aaeca947073391ac.
- Description:
-
~ FBInfer Tool is officially working for all the following build configurations:
~ * Android ~ * Apache Ant ~ * Buck ~ * C ~ * CMake ~ * Gradle with and without a Wrapper ~ * iOS ~ * Java ~ * Make ~ * Maven ~ * Objective-C ~ * XCode ~ FBInfer Tool is officially working for all the following build configurations:
~ <ul> ~ <li>Android</li> ~ <li>Apache Ant</li> ~ <li>Buck</li> ~ <li>C</li> ~ <li>CMake</li> ~ <li>Gradle with and without a Wrapper</li> ~ <li>iOS</li> ~ <li>Java</li> ~ <li>Make</li> ~ <li>Maven</li> ~ <li>Objective-C</li> + <li>XCode</li> + </ul> The usability of this tool is largely dependent on the setup of a user's ReviewBoard environment. Meaning that if a user would like to use ReviewBot to test an Android project. The user must have a working Android SDK in the server instance in which the ReviewBot is pulling down the repository. Setups for each particular environment will be offered in the documentation.
- Description:
-
~ FBInfer Tool is officially working for all the following build configurations:
~ <ul> ~ <li>Android</li> ~ <li>Apache Ant</li> ~ <li>Buck</li> ~ <li>C</li> ~ <li>CMake</li> ~ <li>Gradle with and without a Wrapper</li> ~ <li>iOS</li> ~ <li>Java</li> ~ <li>Make</li> ~ <li>Maven</li> ~ <li>Objective-C</li> ~ FBInfer Tool is officially working for all the following build configurations:
~ * Android ~ * Apache Ant ~ * Buck ~ * C ~ * CMake ~ * Gradle with and without a Wrapper ~ * iOS ~ * Java ~ * Make ~ * Maven ~ * Objective-C ~ * XCode - <li>XCode</li> - </ul> The usability of this tool is largely dependent on the setup of a user's ReviewBoard environment. Meaning that if a user would like to use ReviewBot to test an Android project. The user must have a working Android SDK in the server instance in which the ReviewBot is pulling down the repository. Setups for each particular environment will be offered in the documentation.
- Commit:
-
fb9808513b6469d0b88c043f30dab2604d5e524e4043c0057885792bdd962af0c84b9ee431d767c7
Checks run (2 succeeded)
- Description:
-
~ FBInfer Tool is officially working for all the following build configurations:
~ FBInfer Tool is now working for all the following build configurations:
* Android * Apache Ant * Buck * C * CMake * Gradle with and without a Wrapper * iOS * Java * Make * Maven * Objective-C * XCode ~ The usability of this tool is largely dependent on the setup of a user's ~ ReviewBoard environment. Meaning that if a user would like to use ReviewBot ~ to test an Android project. The user must have a working Android SDK in ~ the server instance in which the ReviewBot is pulling down the repository. ~ Setups for each particular environment will be offered in the documentation. ~ The usability of this tool is largely dependent on the setup of a ~ user's ReviewBoard environment. Meaning that if a user would like to ~ use ReviewBot to test an Android project. The user must have a working ~ Android SDK in the server instance in which the ReviewBot is pulling ~ down the repository. Setups for each particular environment will be + offered in the documentation. - Testing Done:
-
~ Each build configuration was tested manually with its own environment and
~ repository. More information about the tests can be found in Week 3 and ~ Week 4 of my Notion journal: ~ Each build configuration was tested manually with its own environment
~ and repository. More information about the tests can be found in ~ Week 3 and Week 4 of my Notion journal: https://bit.ly/351ttRQ. - https://www.notion.so/reviewboard/Jacob-Blazusiak-6a6975cb74c44873aaeca947073391ac.
- Commit:
-
4043c0057885792bdd962af0c84b9ee431d767c7c7a7924ac757939c14fff1bab0d6050010011046
Checks run (2 succeeded)
- Commit:
-
c7a7924ac757939c14fff1bab0d60500100110460bda1d630a5111f48210af2b61aae8c61e9694e0
Checks run (2 succeeded)
-
This is looking great. There are a bunch of comments here but they're pretty much all just style nitpicks.
-
-
-
-
-
-
-
-
-
-
-
-
There are a bunch of places where we use
settings['build_type']
. Perhaps pull that out into abuild_type
variable? -
-
-
-
-
I don't think we need to list the file here, since the diff comment will be attached to the file already.
-
- Change Summary:
-
Adjusted code with respect to David's requests.
- Commit:
-
0bda1d630a5111f48210af2b61aae8c61e9694e038d550637e18d4f495b26a46cdd827eca237e945
Checks run (2 succeeded)
- Commit:
-
38d550637e18d4f495b26a46cdd827eca237e94506eb28ab037db20b1d72db68d19564ffba6d150b
Checks run (2 succeeded)
- Description:
-
FBInfer Tool is now working for all the following build configurations:
* Android * Apache Ant * Buck * C * CMake * Gradle with and without a Wrapper * iOS * Java * Make * Maven * Objective-C * XCode The usability of this tool is largely dependent on the setup of a user's ReviewBoard environment. Meaning that if a user would like to use ReviewBot to test an Android project. The user must have a working Android SDK in the server instance in which the ReviewBot is pulling down the repository. Setups for each particular environment will be ~ offered in the documentation. ~ offered in the documentation. + The latest revisions include optimizations that reduce the usage of + infer run
. So that it is executed minimally, to enhance speed and+ efficiency. - Added Files:
- Commit:
-
06eb28ab037db20b1d72db68d19564ffba6d150bec0d93f6f13c5df3a0dcf49b57a256f2d18f6a5d
Checks run (2 succeeded)
-
-
Summary should say "Review Bot", rather than "ReviewBot." We've altered the name a bit, but still have places where we have the old version.
-
Something seems to have gone wrong with the hange description. Guessing it's because there's no blank line before or after the list, which is needed for Markdown so it doesn't turn into italics.
-
-
How about putting the string inside of the
()
on the next line, indented 4 spaces? That'll give it breathing room. Like:{ ... 'help_text': ( 'Include a ...' '...' ), }
-
-
-
Typo: "compilation".
The comment could use an adjustment. I wasn't sure at first glance what it was saying.
-
How about:
build_type = 'make' settings['build_type'] = build_type
This is a bit cleaner, since you're not having to store a value and then look it up immediately after.
-
-
-
-
-
This becomes a bit easier to see as one concrete operation if you do:
execute(['infer', 'run', '--'] + shlex.split(build_type) + [path])
-
-
-
fp
is the standard variable for a file pointer when opening a file.You should also specify an explicit mode parameter.
One last thing: This can fail (due to non-existence or permissions issues), so you will need to capture exceptions here. Maybe move this into the
try
. -
-
Formatting will be more consistent with our standards by doing:
f.comment('Bug Type: %s\n%s: %s' % (entry['bug_type_hum'], entry['severity'] entry['qualifier']), entry['line'])
Or, maybe better:
f.comment('Bug Type: %(bug_type_hum)s\n' '%(severity)s %(qualifier)s' % entry, entry['line'])
By the way, is it
bug_type_hum
orbug_type_num
? -
- Change Summary:
-
Addressed comments made by Christian.
- Summary:
-
FBInfer for ReviewBotFBInfer for Review Bot
- Description:
-
~ FBInfer Tool is now working for all the following build configurations:
~ * Android ~ * Apache Ant ~ * Buck ~ * C ~ * CMake ~ * Gradle with and without a Wrapper ~ * iOS ~ * Java ~ * Make ~ * Maven ~ * Objective-C ~ * XCode ~ The usability of this tool is largely dependent on the setup of a ~ FBInfer Tool is now working for all the following build configurations:
~ ~ - Android
~ - Apache Ant
~ - Buck
~ - C
~ - CMake
~ - Gradle with and without a Wrapper
~ - iOS
~ - Java
~ - Make
~ - Maven
~ - Objective-C
~ - XCode
+ + The usability of this tool is largely dependent on the setup of a
user's ReviewBoard environment. Meaning that if a user would like to ~ use ReviewBot to test an Android project. The user must have a working ~ Android SDK in the server instance in which the ReviewBot is pulling ~ use Review Bot to test an Android project. The user must have a working ~ Android SDK in the server instance in which the Review Bot is pulling down the repository. Setups for each particular environment will be offered in the documentation. The latest revisions include optimizations that reduce the usage of infer run
. So that it is executed minimally, to enhance speed andefficiency. - Commit:
-
ec0d93f6f13c5df3a0dcf49b57a256f2d18f6a5dcc771a368ba1bb4f7135e6adfb05f2e23c5c2117
- People:
- Change Summary:
-
Addressed styling issues raised by Review Bot.
- Description:
-
FBInfer Tool is now working for all the following build configurations:
- Android
- Apache Ant
- Buck
- C
- CMake
- Gradle with and without a Wrapper
- iOS
- Java
- Make
- Maven
- Objective-C
- XCode
The usability of this tool is largely dependent on the setup of a
user's ReviewBoard environment. Meaning that if a user would like to use Review Bot to test an Android project. The user must have a working Android SDK in the server instance in which the Review Bot is pulling down the repository. Setups for each particular environment will be ~ offered in the documentation. ~ The latest revisions include optimizations that reduce the usage of ~ infer run
. So that it is executed minimally, to enhance speed and~ offered in the documentation. The latest revisions include ~ optimizations that reduce the usage of infer run
. So that it is~ executed minimally, to enhance speed and efficiency. - efficiency. - Commit:
-
cc771a368ba1bb4f7135e6adfb05f2e23c5c2117f152ce7d4784c10036a77a101465014ed347fdf1
Checks run (2 succeeded)
-
I just noticed a pretty significant bug with the
multi_file_build_types
. It will require some reworking, but other than that much of this implementation looks very solid. -
If you make the change to
handle_files
that I suggested below, thencmake
should be added to this list as well. -
By my reading of the code, if the build type is one of
multi_file_build_types
, we'll never load the report and create comments.I think perhaps we should split things up so that this method is very simple:
if settings['build_type'] in self.multi_file_build_types: self.run_multi_file_build(files) else: for f in files: self.run_single_file_build(f)
We can then have
run_multi_file_build
do all the infer_cmd work that's done above here (plus actually loadreport.json
and create comments for any files that are changed), andrun_single_file_build
would look a lot like what your currenthandle_file
implementation looks like.
- Change Summary:
-
Fixed major bug that David pointed out and restructured some code into functions for easier readability.
- Commit:
-
f152ce7d4784c10036a77a101465014ed347fdf12763e2b292d5ec821e8dbe7e2fad1890dd9fb419