Week 5 - CircuitVerse@GSOC'23

Week 5 - CircuitVerse@GSOC'23

This week was more on learning rather than coding.

The main objectives of this week were

  • Learn RBS to start working on it

  • Generate code coverage report and write the missing unit-tests

  • Split Solargraph PR to small PRs for better review


Learn RBS to start working on it

At first, I thought RBS was pretty straightforward, and I needed to write the type signature of defined functions. But that's not enough.

We know Rails use the metaprogramming concept hugely. So it's essential to have some extra type signatures in ActiveModel, ApplicationRecord, and Controllers.

But, I found a much easier way for this at last.

We can generate an untyped version of the *.rbs file for an *rb file

bundle exec rbs prototype rb <ruby_file_path> > <output_rbs_file_path>

After the *rbs file is generated, we can edit the argument type and return type to make it works.

In the coming weeks, I think to complete writing rbs annotations for the codebase.


Generate code coverage report and write the missing unit-tests

As I was learning RBS, I focused on making some active contributions. So picked the next task -> writing unit test for missing code coverage.

I need first to analyze which unit-test cases are missing. I use simplecov with HTMLFormatter which generates coverage reports as HTML.

From the report, It's nice that most of the code has unit tests, and a few codes have only missing tests.

Created this issue to have a track -> CircuitVerse/CircuitVerse#3817

This issue has all the linked PRs

This rspec-rails gem has this great documentation https://rspec.info/features/6-0/rspec-rails/controller-specs/, and it makes the task easier.


Split Solargraph PR to small PRs for better review

Last week, I finalized solargraph-integration PR CircuitVerse/CircuitVerse#3766

See the changes in the PR, it's hard to review this large PR.

So my mentor suggested splitting this PR into smaller PRs. The main problem with smaller PRs was - We usually do a checkout from the master/main branch to do the changes. But in this case, I need the previous PR's file merged before moving. It's not practical as maintainers will do reviews in their free time and there will be a long waiting time. So found a better way.

  • Checkout from master/main branch to branch_A

  • Do the changes in branch_A and raise Pull Request for changes in branch_A

  • Now, Checkout from branch_A to branch_B

  • Do the changes in branch_B and raise Pull Request for changes in branch_B

  • Do this as many times as we need .......

  • After merging PR_A, we need to update branch_B against the master/main branch, which will make PR_B small. Do this until all PRs merge is completed.

We need to make sure that the PR's merged in the same order at the time of raising PR, else merge conflict can be arised

Here is the Issue, where I have listed all the PRs - CircuitVerse/CircuitVerse#3761


That's all for this week. Subscribe to the newsletter for more updates.