Google Summer of Code 2017 Work Product Submission



coala

Rahul Jha

I’m a sophomore year student studying Electronics Engineering at Zakir Hussain College of Engineering and Technology, Aligarh Muslim University. For GSoC, I worked on coala, vulture and VultureBear. The main task of this project was to let VultureBear remove dead code automatically.


Patches Tarball


SHA-256:

7190862f40822b83b020c5db2d3d6db6b065829c90171710bf48cd5112cdeb6a

Bonding

Phase 1

Phase 2

Phase 3

Mentors


Links to commits and repositories I've worked on:

Repository Link to Commit/s Description
v  vulture View

Add –version flag for vulture.

v  vulture View

Add tests for version.

v  vulture View

Add appveyor CI.

v  vulture View

Ship vulture as a package.

v  vulture View

Use stdlib.py as a default whitelist.

v  vulture View

Allow vulture to be executed as python -m vulture.

v  vulture View

Choose whitelists based on imports.

v  vulture View

Differentiate between functions and classes.

v  vulture View

Add utils.py module.

v  vulture View

Add count_lines function.

v  vulture View

Let item inherit from object.

v  vulture View

Add whitelist for unittest module.

v  vulture View

Adapt ignore functions for unittest module.

v  vulture View

.travis.yml: Change pypy2-5.8.0 to pypy2.7-5.8.0

v  vulture View

Distribute and test vulture as a wheel file.

v  vulture View

Detect unreachable code after return statements.

v  vulture View

Detect unreachable code after break, continue and raise.

v  vulture View

Add –min-confidence flag.

v  vulture View

Detect unsatisfiable while conditions.

v  vulture View

Detect unsatisfiable ‘if’ conditions.

v  vulture View

Detect async function definitions.

c  coala-bears View

VultureBear: Add SEE_MORE attribute

c  coala-bears View

VultureBear: Use the Vulture API instead of the Vulture script.

c  coala-bears View

VultureBear: Report confidence values

c  coala-bears View

VultureBear: Use the updated Vulture API


Remove dead code with Vulture automatically

Work Done

vulture


1.) In addition to the first line of unused code, Vulture now reports the last line of unused code. The results can now also be sorted according to their size.


2.) Other than the conventional dead code (defined but not used), vulture now also finds unsatisfiable conditions in if/while statements. Also, any code appearing after return, break, continue and raise statements is also reported as dead code.


3.) Confidence values are now reported with every result. Also, a min_confidence parameter can be passed to Vulture. It then only reports results for which confidence > min_confidence.


4.) The Vulture API has been extended and it now exhibits all characteristics of dead code, like confidence, first_lineno, last_lineno, message, etc. It provides user with much more flexibility for automating tests with Vulture.


5.) Improved whitelist handling process: Every import is now checked against a corresponding whitelist file (both files must have the same names), which makes it very easy to add support for new whitelists.


6.) Vulture is now distributed as a Python wheel.


7.) Allow Vulture to be executed as a package (python -m vulture).


8.) A lot of work was done upstream on Vulture. Afterwards, VultureBear was refactored to use the new Vulture API. This increased the efficiency of the Bear. It is now completely tested and documented in-place.