What is Coala?
It is an open source software that helps you to check your program for errors and even correct them. As per its official documentation: "coala provides a unified command-line interface for linting and fixing all your code, regardless of the programming languages you use."
Coala plugins: Coala Bears !
Prior to learning "How to use Coala to correct your code", you need to have coala installed first. Follow this guide to install coala in your system.
Let's start with correcting some code.
Step 1: Reaching the folder
Open command prompt/PowerShell on Windows or Terminal on Mac and reach the directory where the code is present using cd command. You can then use dir command to see what is inside the folder (in windows). For Mac or Linux, the command for checking files inside a folder is ls
Step 2: Carrying out the Check:
In order to specify which file to analyze we will use --files argument of coala. As already discussed above, we have something called coala bears in coala. these can be thought of as plugins or analysis routines. Coala bears can do things like checking your code for probloems and even offer fixes. In order to specify which bears to use, we specify the argument --bears. To instruct coala to save the changes, we will use the argument --save. Hence the code that we will use is:
coala --files=setupTests.js --bears=SpaceConsistencyBear --save
Step 3: Final
Coala then asks Please enter a value for the setting "use_spaces" (True if spaces are to be used instead of tabs.) needed by SpaceConsistencyBear for section "cli":
Enter true. However, you can also enter any other value.
Then it shows the message : Executing section CLI...
Coala can be used very easily. Also since it is an open source project where begginers can colaborate, I recommend everyone to get involved with this communtiy.
To reach out the coala community:
Posted on Utopian.io - Rewarding Open Source Contributors