Coala Tutorial: Correct your codes easily with Coala !!
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 !
Coala comes with a set of plugins called coala bears which perform different checks. Coala supports carious languages like C/C++, Python, JavaScript, CSS, Java and more.
Installation.
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...
Conclusion
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:
Connect on github
Connect on gitter
Posted on Utopian.io - Rewarding Open Source Contributors
Hey @shreyasgune I am @utopian-io. I have just upvoted you at 7% Power!
Achievements
Suggestions
Human Curation
Community-Driven Witness!
I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!
Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x
Thank you for the contribution. It has been approved.
You can contact us on Discord.
[utopian-moderator]