Google Summer of Code 2018 Work Product Submission



coala

Pareksha Manchanda

I am Pareksha Manchanda, currently a 2nd year Computer Science student in University Institute of Engineering and Technology, Panjab University, Chandigarh. My GSoC journey with coala has taught me the importance of keeping code neat and clean. I worked on aspects which is more or less the future of coala.


Patches Tarball


SHA-256:

ed967dcd98bfcd617e2a3238025b622e12665789e4d707e5b7c4bcf97ebcdf25

Bonding

Phase 1

Phase 2

Phase 3


Links to commits and repositories I've worked on:

Repository Link to Commit/s Description
c  cEPs View

cEP-0010.md: Update to match existing aspects

c  coala View

Formatting: Describe preferred_quotation

c  coala View

aspects.root: Override Formatting aspect

c  coala View

aspects: Create map_ambiguous_setting_to_aspect

c  coala View

Language: Change TrumpScript aliases

c  coala View

Tcl: Create basic language file for tcl

c  coala View

m4: Create basic language file for m4

c  coala View

VisualBasic: Create language file for Visual Basic

c  coala View

PowerShell: Create language file for PowerShell

c  coala View

.gitlab-ci.yml: Add Python 3.6 to GitLab CI

c  coala View

.gitlab-ci.yml: Add Python 3.7 to GitLab CI

c  coala View

languages: Allow more than one comment delimiter

c  coala-utils View

setup.py: Sync moban, replace " with '

c  coala-utils View

position_is_escaped: Let escape char other than \

c  coala-bears View

ClangComplexityBear: Fix AttributeError

c  coala View

aspects: Rename class docs to follow CapWords

c  coala View

VisualBasic: Add max_line_length

c  coala View

languages: Add missing language imports

c  coala View

languages: Implement get_all_languages()

c  coala View

aspects: Default languages=all when using aspects

c  coala View

LocalBearTestHelper: Modify for aspects testing

c  coala-bears View

LineLengthBear: Migrate to aspects

c  coala-bears View

PycodestyleBear: Migrate bear to aspects

c  coala View

language: Add string_delimiter_escape to lang

c  cEPs View

cEP-0010.md: Add min_file_length in cEP

c  coala View

Formatting: Add taste min_file_length


Convert Bears To Aspects

coala provides coala-bears as a tool for linting and fixing code. These bears are nothing but tools for cleaning code, serving different purposes.

For now coala-bears are run on code by name of bears. This project is part of adding the aspect functionality to some of these coala-bears. Through this functionality coala users will no longer have to worry about searching for the bear or remembering the name of the bear appropriate for their work. They will be able to fix their code by running coala by the name of an aspect, which is nothing but a keyword that relates to the action they want the bear to perform on their code.

Work Done

This GSoC project led to the migration of two bears, LineLengthBear and PycodestyleBear into their respective aspects along with implementation of tests for the same. Apart from this, aspects core is enhanced with bug fixes and some of the feature limitations have been overcome.

Project work consists of adding bug fixes and enhancements to aspects library and adding support for aspect testing in VerifyLocalBearTestHelper on coala/coala. Two bears, namely LineLengthBear and PycodestyleBear have been migrated to their respective aspects along with tests, ensuring their proper functionality in coala/coala-bears.

Work done also includes an attempt to migrate QuotesBear to it’s respective aspects. In the process, it was found that it needed new aspects to be defined and enhancements to be made in the coala Language library for working on these aspects. Work for adding new aspects for the QuotesBear has been going on in aspects cEP but it’s progress had been slow due to limitations in the Language library. To overcome these limitations, work has been going on for enhancing Language library. It includes converting comment_delimiter to comment_delimiters so that it supports a tuple allowing multiple escape characters and the same enhancement of allowing escape character to be other than \ was made in coala/coala-utils as well. Another enhancement was letting the string_delimiter_escape add on to the language definitions. New language files of Tcl, m4, Visual Basic and PowerShell were also added in the coala Language library along with their respective delimiter escapes for strings.

Adding to the PR’s merged in this project, some unseen bugs and feature limitations were found and issues for the same were created. These issues include -

  1. Support Tcl comment_delimiters
  2. Modify Linter module for aspects support
  3. Rename the Formatting aspect of the doctest
  4. Implement suggested_values or replace it with allowed_values
  5. Let unescape support escape_char other than \
  6. Allow unescaped_search_for to pass escape char to position_is_escaped
  7. Allow unescaped_strip and unescaped_rstrip to pass escape char to position_is_escaped

Challenges

There are areas in coala core which are alien to aspects. For example, there’s @linter which is totally alien to aspects. During the migration of PycodestyleBear into aspects, we realised we needed aspect support in Linter module so that it passes the related aspect with the result. But thankfully at the last moment, we figured another way out and successfully migrated the bear.

Another challange was dealing with the QuotesBear and overcoming the limitations of Languages library. But thanks to the combined efforts of me and my mentors, we were able to get into the root problems, file issues for these and even successfully solve some of these.

Work to be done

Work to be done includes working on the new issues filed and the bugs found during this project, including defining new aspects and tastes, starting with the idea of aspects defined in cEP itself. These issues, PRs’ and the QuotesBear migration attempt would definitely become the foundation of the next aspects project.

Adding to already filed issues, there may be feature limitations in aspects core and lack of support of aspects in some areas of coala core. These limitations/bugs can only be found and thus fixed if we migrate more and more coala bears to aspects. The need of every bear to be migrated will lead to enhancement of aspect core and addition of new aspect definitions. Thus, more migration work is required along with side-by-side enhancements in aspects library.

In this project, migration of PEP8Bear was also scheduled but due to some line length bug in the PEP8 tool itself, the migration was blocked. As soon as the bug gets resolved, PEP8Bear PR can be resumed.