Skip to content

Google Code In Task Simple asciinema

sangamcse edited this page Oct 29, 2018 · 13 revisions

Create a simple asciinema

This is a coala GCI repeatable "easy" task.

If you use windows, this task may get very complicated. We recommend to start with something else or to get a Linux system for this task if possible.

Task

Create an asciinema for a coala bear using the example code in the bear's unit test.

You will have to setup and install coala so that you can run code analysis with coala. You will pick a coala bear (a "bear" is a code analysis routine in coala), run it on sample code and publish an asciinema.

This activity requires submitting a small change to the coala/coala-bears repository as a Pull Request, and fixing the code until it is merged by the coala developers.

Here's an example of a bear that already has an asciinema: https://github.com/coala/bear-docs/blob/master/docs/CSecurityBear.rst#demo.

Note:

Submitting your change as a Pull Request(PR) requires a GitHub account. If you have not created one yet, follow the Google Code-In username guide.

Objective

This task assists participants to learn about running code analysis and making an asciinema, thus documenting how it works.

They will also learn about working with issues and pull requests in an open source project.

Background

coala provides a lot of static analysis functionality.

It is very useful if users can see it in action before having to install coala on their own.

Selecting a Bear

If you task has a bear already selected for you, skip this section, and continue at "Installation".

You can select any bear which is missing an asciinema. You will find all the bears in the coala-bears repository. If you want to know if a bear has an asciinema or not, search for ASCIINEMA_URL in the bear's source code. For example, Vulture bear has an asciinema while Radon bear does not have an asciinema.

Search for an existing issue in the coala-bears repository

https://github.com/coala/coala-bears/search?q=asciinema+[lintername]

If you can find an asciinema issue or pull request for the bear that you have found that is missing an asciinema, check if someone is already working on that asciinema.

If someone is working on it, go back to the previous section.

If nobody is working on it, skip the next section.

GitHub issue assignment

Follow the newcomer's guide to Step 3 to be assigned the issue you have created.

Installation

Installing coala and coala-bears

Follow our guide on Installing coala.

Installing asciinema

Follow asciinema's Installation Guide to install asciinema on your operating system. Create your asciinema profile.

After successful installation and creating your profile, run following command on your terminal:

$ asciinema auth

It will generate a unique URL; for example,

$ asciinema auth

Open the following URL in a web browser to link your install ID with your asciinema.org user account:

https://asciinema.org/connect/75630f03-6715-408x-xxxx-xxxxxxxxxxxx

This will associate all recordings uploaded from this machine (past and future ones) to your account, and allow you to manage them (change title/theme, delete) at asciinema.org.

Go to the generated URL and it will connect your computer with your asciinema profile. That's it. 😄

Installing bear dependencies

Few of the bears need additional dependencies to be installed. For example, CSecurityBear needs flawfinder. Try searching on how to install these dependencies on your operating system. There will be installation guides available online.

If you have any trouble while installing these dependencies, please contact us at coala.io/chat.

Making the asciinema

Check out asciinema's guide on Getting started and Usage. Follow their guides to record an asciinema for the coala bears missing an asciinema.

Source code to analyse

In the asciinema, create a source code file using any erroneous code from the bear unit tests.

The erroneous source code is often in a variable called bad_file, such as here.

Note:

The python file with the Bear's tests contains code samples. For a proper asciinema you'll have to create the code samples for that language for which the Bear is written and put them in their respective language extension files, and run the Bear on those.

For example, if the Bear is written for C-language, you have to create samples for C language and put them into .c file and then run the Bear on that file.

Adding the asciinema to the bear

Edit the coala bear source code and add ...

Use the commit message template:

Bear: add asciinema

Closes: https://github.com/coala/coala-bears/issues/[123]

Submit Pull Request

Submit a Pull Request to the master branch of coala/coala-bears.

This will trigger builds on Appveyor CI and Circle CI.

A coala developer will review your patch to check that your asciinema covers the following criteria:

  • Should show the file on which the bear is run
  • Should show the results of running the bear on the test file

Assessment

The mentors will check that your Pull Request was merged, and verify that you followed the steps above.

You may be asked to redo the process if you deviated from the steps above.

Next task

After satisfactorily completing this task, the next task in this series is Advanced asciinema.

StackExchange

Related StackOverflow tags

coala | bash | lint | static-analysis | github | circleci | appveyorci | continuous-integration |

Clone this wiki locally