Hi Guys!! Its been a long since my last post. This blog post is intended for all newcomer’s who would like to contribute to coala. So, I will give you an insight into coala’s Structure in a bit detail to actually get you started.
coala’s code base can be found here at github. It’s directory tree looks like:
You can see, this tree has 3 major parts.
tests are established over
coalib is the star directory. And hence, I would be only explaining about it.
coalib is the collection of various subpackages regarding writing, executing, editing bears, formatting, settings and much more. So let’s dig in boys!!
coalib is further divided into 11 parts:
abstractionslike linter bears and also
languageswhich contains various language definitions(such as identifying different languages with their versions) to provide unified language experience to coala.
GlobalBear. Without which bears that exists in coala-bears repo wouldn’t exist.
coremodule contains the chronological order about what coala has to do with a bear. It takes care of all the step’s involved(like having a complete schedule), when a bear runs over a given file.
Shellmodule is the important aspect here, as it helps coala to run in an interactive shell mode.
ConsoleInteractionmodule provides the utilities about user provided
Ignore_Patch..etc. It acts as a mediator between coala and the user, helps coala in providing the user important information by printing generated diff’s, messages, list of bears..etc.
parsingmodule. It contains all the routines about parsing important information from a string of characters. Most of them support regex pattern matching. For example: Parsing
CLIarguments and creating sections out of it.
resultsprovides routines like
ApplyAction’s module(user defined actions like ApplyPatch, IgnorePatch, ResultAction and ShowPatchAction).
LineDiffmodules are similar, they both generates a unified diff corresponding to a generated patch by coala. The only difference between them is
LineDiffgenerates diffs over two strings wheareas
Diffgenerates it over two files. When a
Diffis being generated or we have a yielded
Result, it is supplied to the
outputsection, which in turn is being commuted to the user.
settingin coala consists of a key and a value. It mainly offers many conversions into common data types. It provides important modules like
Sectionmodule which holds all the set of settings and
ConfigurationGatheringmodule which plays two important roles:
testing, which contains the API for bear testing. It provides
LocalBearTestHelpermodule which contains routines like
verify_local_bear. These basically test a bear by doing a simple assertion test, between the given result and to the actual yielded result from the bear over a given file.
If you will dive deep enough, it’s working is even more interesting. If it sounds interesting to you as well, you can start contributing right away by following our newcomer’s guide.
Till next time see ya!!Written on May 28th, 2017 by Saurav Singh