Implement FBInfer tool in ReviewBot (WIP)
Review Request #7702 — Created Oct. 15, 2015 and discarded
Add a new static analysis tool for Android/iOS code in ReviewBot.
FBInfer is essentially another static analysis tool, like pep8 or pyflakes, that provides automatic feedback on bugs in Android/iOS apps.
This feature will add support for code written in Java, Objective-C, and C, so that Review Bot can automatically provide bug feedback regarding a review request in these languages. This is a useful tool for Review Bot to have because as of now, there are only tools for code written in Python and C++. Because a lot of programmers use Java, Objective-C, and C, especially for mobile development, it would be helpful for Review Bot to provide support for such languages.
I have tested using a local server and instance of ReviewBoard. From the testing I did, FBInfer didn't seem to be working at all to compile and provide feedback of the files.
Description | From | Last Updated |
---|---|---|
You are going to want to add .idea to your global git ignore. |
brennie | |
Can you revert this change? This typo is actually fixed already in master (but not release-0.2.x, which is why you're … |
anselina | |
Needs a docstring. |
chipx86 | |
Col: 21 E127 continuation line over-indented for visual indent |
reviewbot | |
Col: 14 E251 unexpected spaces around keyword / parameter equals |
reviewbot | |
Col: 12 E251 unexpected spaces around keyword / parameter equals |
reviewbot | |
Col: 5 E128 continuation line under-indented for visual indent |
reviewbot | |
Col: 5 E122 continuation line missing indentation or outdented |
reviewbot | |
I believe the executable is actually just infer, instead of fbinfer. |
anselina | |
Col: 5 E122 continuation line missing indentation or outdented |
reviewbot | |
endswith can take a tuple of strings to check. I suggest defining a tuple of allowed file types on the … |
chipx86 | |
Col: 13 E131 continuation line unaligned for hanging indent |
reviewbot | |
Blank line between these. |
chipx86 | |
Col: 15 E251 unexpected spaces around keyword / parameter equals |
reviewbot | |
Col: 13 E251 unexpected spaces around keyword / parameter equals |
reviewbot | |
Col: 17 E251 unexpected spaces around keyword / parameter equals |
reviewbot | |
Col: 15 E251 unexpected spaces around keyword / parameter equals |
reviewbot | |
infer instead of fbinfer. |
anselina | |
Col: 9 E123 closing bracket does not match indentation of opening bracket's line |
reviewbot | |
Col: 1 W391 blank line at end of file |
reviewbot | |
Col: 1 W391 blank line at end of file |
reviewbot | |
The PyCharm-specific files should not be included in this review request. To remove the .idea/* files from this RR, you … |
anselina | |
Can you remove the extra space between """ and Performs...? |
anselina | |
"Perform" (imperitive mood) Also, this should read something like: """A ReviewBot tool for FBInfer. FBInfer is a static analysis tool … |
brennie | |
Blank line between these. |
brennie | |
Add a period at the end of this sentence. |
anselina | |
... for mobile apps. |
brennie | |
Col: 21 E127 continuation line over-indented for visual indent |
reviewbot | |
Until you implement options for the infer executable, let's get rid of this variable altogether? |
anselina | |
We don't wan't this running on all java, [obj]c[++] files, so there should probably be per-repository settings for the tool … |
brennie | |
You can lose the outer parentheses here. |
david | |
This can all be on one line. |
david | |
This can be condensed down to a single statement: line_num, col, msg = line.split(':', 3)[1:] |
david | |
We don't really need to coerce these to integers because we're not doing any processing with them. |
brennie | |
Col: 1 W391 blank line at end of file |
reviewbot | |
This should not be in the project's .gitignore. This should be in your ~/.gitignore_global. |
brennie | |
Remove this file. |
brennie | |
"This tool performs..." |
brennie | |
I would put this all on the next line. |
brennie | |
Col: 21 E127 continuation line over-indented for visual indent |
reviewbot | |
Perhaps to avoid having to do all these repeated endswith() checks, we could instead get the extension and look it … |
AD adriano | |
This should be infer -- javac path |
brennie | |
This should be infer -- gcc -c path |
brennie | |
This should be infer -- clang path |
brennie | |
Col: 1 W391 blank line at end of file |
reviewbot | |
Col: 21 E127 continuation line over-indented for visual indent |
reviewbot | |
Col: 1 W391 blank line at end of file |
reviewbot | |
'logging' imported but unused |
reviewbot | |
Col: 21 E127 continuation line over-indented for visual indent |
reviewbot | |
Col: 13 E265 block comment should start with '# ' |
reviewbot | |
Col: 13 E265 block comment should start with '# ' |
reviewbot | |
Col: 13 E265 block comment should start with '# ' |
reviewbot | |
Col: 1 W391 blank line at end of file |
reviewbot | |
I think the addition of .idea to your .gitignore file shouldn't be commited to the repository and should instead remain … |
AH ahache | |
Col: 20 W292 no newline at end of file |
reviewbot | |
'logging' imported but unused |
reviewbot | |
Col: 17 E265 block comment should start with '# ' |
reviewbot | |
Col: 80 E501 line too long (80 > 79 characters) |
reviewbot | |
Col: 17 E265 block comment should start with '# ' |
reviewbot |
-
Unfortunately, this summary and description is difficult for us to work with, since we have to then look up or remember what your project is, and other students or contributors to Review Board will have no idea.
You should make sure that you have a detailed, informative review request. See https://www.reviewboard.org/docs/codebase/dev/writing-good-descriptions/
-
This shouldn't include any of the files under
.idea
. -
-
endswith
can take a tuple of strings to check. I suggest defining a tuple of allowed file types on the class and passing that in. For example:class FBINferTool(Tool): ... ALLOWED_EXTENSIONS = ('.java', '.c', '.h', '.m', '.mm') ... def handle_file(self, f): if not (f.dest_file.endswith(self.ALLOWED_EXTENSIONS)): ...
-
-
Looks like you're on the right path! The workers find installed tools through entry points, so you'll need to add a new entry-point for Infer in bot/setup.py before you can test it.
-
Can you revert this change? This typo is actually fixed already in master (but not release-0.2.x, which is why you're seeing this).
-
-
- Change Summary:
-
Fixed a couple issues (Barret, Christian, Anselina) and implemented almost everything for FBInfer tool in ReviewBot.
- Summary:
-
First project, first code drop (WIP)Fixed a couple issues (Barret, Christian, Anselina) and implemented almost everything for FBInfer tool in ReviewBot.
- Description:
-
~ First project, first code drop (WIP)
~ I fixed issues regarding many different things, such as adding the .idea file to .gitignore.
+ + Code-wise, I feel that I have completed majority of the code for the tool to be tested, which is the next step. To be more specific, I still need to implement the call to "execute" function. I have asked Anselina regarding confusion I have with this, in terms of the argument passing.
- Testing Done:
-
~ This is my first project, my first code drop. I have begun to implement the FBInfer plugin for ReviewBot.
~ Have not tested this feature so far.
-
Tool: PEP8 Style Checker Processed Files: bot/reviewbot/tools/fbinfer.py Ignored Files: .idea/.name .gitignore .idea/misc.xml .idea/ReviewBot.iml .idea/modules.xml .idea/vcs.xml .idea/workspace.xml Tool: Pyflakes Processed Files: bot/reviewbot/tools/fbinfer.py Ignored Files: .idea/.name .gitignore .idea/misc.xml .idea/ReviewBot.iml .idea/modules.xml .idea/vcs.xml .idea/workspace.xml
-
-
-
The summary and description are going into the commit message, so they need to be self-describing and make sense independently of any code or other discussions taking place. You can reference this guide for some examples: https://www.reviewboard.org/docs/codebase/dev/writing-good-descriptions/
- Summary:
-
Fixed a couple issues (Barret, Christian, Anselina) and implemented almost everything for FBInfer tool in ReviewBot (WIP)Implement FBInfer tool in ReviewBot (WIP)
- Description:
-
~ I fixed issues regarding many different things, such as adding the .idea file to .gitignore.
~ Add a new static analysis tool for Android/iOS code in ReviewBot.
~ Code-wise, I feel that I have completed majority of the code for the tool to be tested, which is the next step. To be more specific, I still need to implement the call to "execute" function. I have asked Anselina regarding confusion I have with this, in terms of the argument passing.
~ FBInfer is essentially another static analysis tool, like pep8 or pyflakes, that provides automatic feedback on bugs in Android/iOS apps.
+ + This feature will add support for code written in Java, Objective-C, and C, so that Review Bot can automatically provide bug feedback regarding a review request in these languages. This is a useful tool for Review Bot to have because as of now, there are only tools for code written in Python and C++. Because a lot of programmers use Java, Objective-C, and C, especially for mobile development, it would be helpful for Review Bot to provide support for such languages.
-
-
"Perform" (imperitive mood)
Also, this should read something like:
"""A ReviewBot tool for FBInfer. FBInfer is a static analysis tool for mobile apps written in ObjC, Java, and C. """
-
-
-
We don't wan't this running on all java, [obj]c[++] files, so there should probably be per-repository settings for the tool
(Forgive me if this is already a thing Review Bot does -- I'm not super familiar with it.)
-
- Change Summary:
-
Added/Changed the logic of executing different compilers according to the different file types.
- Testing Done:
-
~ Have not tested this feature so far.
~ I have tested using a local server and instance of ReviewBoard. From the testing I did, FBInfer didn't seem to be working at all to compile and provide feedback of the files.
-
Tool: Pyflakes Processed Files: bot/setup.py bot/reviewbot/tools/fbinfer.py Ignored Files: .idea/.name .gitignore Tool: PEP8 Style Checker Processed Files: bot/setup.py bot/reviewbot/tools/fbinfer.py Ignored Files: .idea/.name .gitignore
-
-
-
-
Perhaps to avoid having to do all these repeated
endswith()
checks, we could instead get the extension and look it up in a precomputed dictionary. For example, something like:import os COMPILER_MAP = { '.java': 'javac', '.h': 'gcc', '.c': 'gcc', '.m': 'clang', '.mm': 'clang', } # ... other code goes here ... def handle_file(self, f): extension = os.path.splitext(f.dest_file)[1] compiler = COMPILER_MAP.get(extension, None) if not compiler: return False path = f.get_patched_file_path() if not path: return False output = execute( [compiler, path], split_lines=True, ignore_errors=True ) # ... rest of code goes here ...
-
Tool: Pyflakes Processed Files: bot/setup.py bot/reviewbot/tools/fbinfer.py Ignored Files: .idea/.name .gitignore Tool: PEP8 Style Checker Processed Files: bot/setup.py bot/reviewbot/tools/fbinfer.py Ignored Files: .idea/.name .gitignore
-
-
-
Tool: PEP8 Style Checker Processed Files: bot/setup.py bot/reviewbot/tools/fbinfer.py Ignored Files: .idea/.name .gitignore Tool: Pyflakes Processed Files: bot/setup.py bot/reviewbot/tools/fbinfer.py Ignored Files: .idea/.name .gitignore
-
-
-
-
-
-
-
-
I think the addition of
.idea
to your.gitignore
file shouldn't be commited to the repository and should instead remain only on your local setup.
One approach to doing this would be to revert this change, and once it's resolved, you can add both.idea
to your ignore file, as well as.gitignore
, that way changes done to it won't be tracked.
There may be a better way of doing this, but this is how I've done it before.