Refining Code Critics; my first month on the GSoC’21

Alejandra Cossío Chavalier
4 min readJul 11, 2021

--

It’s been a month since I started coding my project Refining Code Critics at Google Summer of Code with Pharo Consortium. Time has passed so quickly! I will limit my experience until now in three words:

  • Challenging: understanding the rules engine, learning about Spec, CriticBrowser migration, and looking for the best way to refactor code were some of the challenges that I encountered at the time; And I am sure, I will find more. Although, the best part of the day is when you overcome these challenges!
  • Amazing: everything I’ve learned, the people I’ve met, the powerful programming language Pharo, and last but not least my precious debugger.
  • Funny: I really believe that issues and bugs are alive. I solve one of them, and then it appears in a new section during migration. As well, challenging is also part of having fun, right?

To my great fortune, the community and my mentors have been on my side along the way; Well, let’s get to the most interesting part: coding!

Work package 1 — Improving Descriptions

The goal of this work package was to review and improve all the code critiques and rules descriptions. There were cases where meaningful descriptions were not provided or updated, according to the logic of the rule issue#9450 issue#9308 ; As well as others, they didn’t need it issue#9312, issue#9310, issue#9309.

Table 1. Rule’s groups with their respective amount of rules that were verified for this work package

This first work package let me:

  • Identify critiques that apply transformation and provide refactoring.
Image 1. Example of a broken rule offering automatic fix to critique using Changes Browser
  • Apply CriticBrowser to check every rule and critiques. This allowed me to identify some improvements to the CriticBrowser’s UI.
  • Learn about Renraku (framework for defining and processing quality rules) and understand broadly rules engine.
Image 2. Understanding in broad terms how a broken rule acts to generate a critique

Work package 2— Critic Browser migration

CriticBrowser uses a deprecated version of SpecCore (framework in Pharo for describing user interfaces). As a result, implementing the new improvements in work package 3 directly was not feasible, due to the fact that it will implement widgets from the new Spec2. Thus, I created my own repository named Tool-CritiqueBrowser to do migration, working about work package 3 on it.

Image 3. Example of one of the class in the package Tool-CriticBrowser witch inherits from the deprecated ComposablePresenter

Do you want to try the CritiqueBrowser running on Spec2?

You can install the tool by going to my repo and following the steps in the Readme; Once you install it, you can start:

GIF 1. A quick look at the CritiqueBrowser running with Spec2

Work package 3— Enhancing Code critiques global browser

Another objective was to enhance the CriticBrowser. It is a graphical tool that shows all code critiques existing in the system. With this browser developers will be able to search all the instances of a given code critic in their package or the system, so they can address them; I am currently working on this work package. The most notable enhancements to this package are:

  • Replacing old code comparison tool Image1 to the latest and more advanced code comparison tool that Pharo provides (split code difference view) using SpDiffPresenter:
Image 4. Split code difference view for Image 1
  • Replacing old select view for packages and rules (e.g. select packages, classes of RewriteToolsSet).
Image 5. Current select software packages and a quality rules-group view for Critic Browser
Image 6. Select packages, classes, methods view of RewriteToolsSet to apply on CritiqueBrowser

That’s all so far! The main aim of this post is to arouse your curiosity on what you can do with Renraku and Spec. Of course, I hope to have encouraged you to join the Pharo community and start programming cool stuff like I’m doing!

Let me know, if you would like more details or making examples about Renraku and Spec in next blogs to help you gain confidence :) Thank you for reading, any comment or suggestion is welcome.

-Ale

--

--

Alejandra Cossío Chavalier
Alejandra Cossío Chavalier

Written by Alejandra Cossío Chavalier

My biggest passion is teaching and contribute I love coding I consider myself a curious person, researcher and Open Source enthusiastic!

No responses yet