# 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

```yaml
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 -&gt; `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.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1688201441617/93587e96-63b0-4f1b-b274-c57134fc251f.png align="center")

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 -&gt; [CircuitVerse/CircuitVerse#3817](https://github.com/CircuitVerse/CircuitVerse/issues/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/](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](https://github.com/CircuitVerse/CircuitVerse/pull/3766)

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1688202195465/cf72e74c-3165-417e-b58a-5d3f94d10bb7.png align="center")

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](https://github.com/CircuitVerse/CircuitVerse/issues/3761)

---

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