Google Summer of Code 2017 Work Product Submission



coala

Adhika Setya Pramudita

Hi! I am Dhika, a 3rd Information Technology student in University of Gadjah Mada, Indonesia. I like coding and play video games in not only my freetime. I choose coala as my GSoC project because I think it’s very cool, and it can stop me from annoying my friends because their code style is horrible different than me, instead coala will do it for me.


Patches Tarball


SHA-256:

c3b80d5e1dcc5d30ca2409267d56d978abfb0ccb7f1d05abb77b208cda1ab2b9

Bonding

Phase 1

Phase 2

Phase 3


Links to commits and repositories I've worked on:

Repository Link to Commit/s Description
c  coala View

aspectModule: Add get() method

c  coala View

aspect test: Add SubSubAspect fixture

c  coala View

aspectbase: Add get() method

c  coala View

AspectList: Add get() method

c  coala View

AspectTypeError: Move and rename class

c  coala View

Aspects: Create exception for aspects lookup

c  coala View

AspectList: Overload init to accept strings

a  autoflake View

Add option to expand single star import

a  autoflake View

Bump Pyflakes to 1.1.0

c  coala View

aspectbase: Recursively instance aspect children

c  coala View

aspectbase: Implement get from instance

c  coala View

AspectList: Add exclude attribute

c  coala View

Aspect: Include AspectList in __all__

c  coala View

Extract and initialize aspects in section

c  coala View

Make Language pickle-able

c  coala View

meta: Add Languages to bears

c  coala View

AspectList: Connect with holder bear

c  coala View

Test: Add AspectTestBear

c  coala View

aspects: Create get_leaf_aspects method

c  coala View

Collectors: Create basic bear collector by aspect

c  coala View

Bear.py: Make languages JSON compliant

c  coala View

coalaJSONTest: Revert wrong variable usage

a  autoflake View

Add exclude parameter

c  coala View

Collectors: Warn unfulfilled aspects

c  coala View

Aspect: Create map_setting_to_aspect decorator

c  coala View

AspectTestBear: Fix return result

c  coala View

BearTest: Make check_message could check regex

c  coala View

coalaTest: Add running with aspect test

c  coala View

Setting: Create language type hint

c  coala View

ConfigurationGathering: Refactor aspect validation

c  coala View

Validate and cache language setting into Section

c  coala View

Section: Add aspects attribute

c  coala View

Section: Rename aspect to aspects

c  coala View

Result.py: Fill additional_message from aspect.docs

c  coala View

extract_aspects_from_section: Change key delimiter

c  coala View

Bear: Add language for non_optional params

c  coala View

Language: Add various language definition stub

c  coala View

Language: Add PHP and Fortran language stub

c  coala View

Language: Fix missing or wrong aliases

c  coala View

Language: Add definition into default import

c  coala-bears View

TextLintBearTest: Modify bad_alex_no_dead_link

c  coala-bears View

MypyBear: Use language correctly

c  coala-bears View

CPDBear: Use language correctly

c  coala-bears View

PyUnusedCodeBear: Aspectization

c  coala-bears View

PyUnusedCodeBear: Bump autoflake to v0.7

d  demo-aspect View

Repo for the showcase that aspect configuration works.


Implement Aspect

This project is about implementing aspect feature into coala. coala, for those unfamiliar with it, is a linter/fixer tools for dozens of language, providing unified API to over 100 different linters.

Aspect itself is a category of analysis that should be run over a code. Each aspect have a taste, which is a measurable metric on how a “correct” code should look like.

The main goal of aspect is providing abstraction for users (especially new users) by avoiding getting overwhelmed of trying to pick and configure some of over 100 tools provided by coala. Instead the coala will intelligently pick and configure those tools according to aspects and taste choosen by users. This also make configuration more language agnostic and could easily used by project written in different programming language.

Work Done

This GSoC project implement a working aspect framework and its already possible to run a analysis on a project with aspect configuration (see showcase project at https://github.com/adhikasp/demo-aspect).

The works consist of: expanding aspects library on coala/coala to have a sufficient API to make the core aspects class usable for the use case in coala, patching a bear in coala/coala-bears to use the aspects feature, creating new feature in autoflake to expand bear capabilities, and update the relevant documentation.

Challenges

The challenges of this project is designing aspect configuration behaviour and the final integration process of exposing the coala aspect API to the coala-bears. Because of the experimental nature of aspect, it may still have some unintuitive behaviour and not tested in real world yet. Thus the configuration behaviour could change according to use case response. In the final integration process, we broke coala-bears because of introduced changes on how coala setting works, especially related to language setting. Fortunately all of this has been fixed.

Work to be done

Lack of aspect definition and aspectized bear. The root problem, lack of aspect defintion is very crucial. Current aspect definition only support 1-3 small bear to almost be migrated and even that still lack some detail. This will became the main hindrance of using aspect as the main configuration method for coala.

Beside that, the current bear collection by aspect strategy is very basic. This could be improved by implementing some kind of prioritazion for choosing the bear like choosing bear that could fix problem rather than only detect, minimalizing number of individual bear (1 super bear is more efficient to run rather than 10 smallish bear, with the same feature set) or choosing bear based on the runtime similiarity (like nodejs, python, or ruby).