Week 4 - CircuitVerse@GSOC'23

I am exploring the world of technology and playing with them. Like a kid, breaking them and modiy them.
Search for a command to run...

I am exploring the world of technology and playing with them. Like a kid, breaking them and modiy them.
No comments yet. Be the first to comment.
This week was a little bit hectic, and the integrations were a little bit error-prone. However, I fixed all the issues by following the GitHub Forum and Github Issues discussion of particular library/software. The main tasks of this week - Integrate...
From last year (July~August), I am working on an open source PaaS to deploy and manage applications easily on any VPS. I have a motive to create a solution which you once setup on your cloud, you will get same kind of experience like other platforms ...

This blog is coming after a long time [almost 3 weeks]. Throughout this week, the main tasks involved were - Update the docker setup to make it more convenient Test the docker setup in all OS [Linux, Mac, Windows] Rewrite Documentation Revamp Do...

Finally, On July 14, I received this email about passing the midterm evaluation 🎉🎉. You can check out the blog on the phase 1 report here: https://blog.circuitverse.org/posts/tanmoy_sarkar_phase_1_report/ You should check other blogs here: https:/...

At the start, this week's main focus was completing the RBS integration. But that does not go well due to having issues with rbs_rails Gem. So I raised PR in rbs_rails the gem repository about the issue to get some hints from the maintainers. You can...

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 RB...

This week was interesting and frustrating at the same time. The maximum time went to explore solutions and resolving the issues with specific library packages. This time everything does not go as planned.
The scheduled task for this week was
What is RBS?
RBS is a type annotation system introduced in the Ruby programming language. Its purpose is to bring static typing capabilities to Ruby code. We can verify the type signature by using various tools like [steep, rbs, etc.]
RBS is released officially by Ruby.
Interesting Features
Type Safety: RBS helps catch type-related errors early, improving code reliability.
Tooling Support: Static type information enables advanced code editors to offer autocompletion and accurate error detection, enhancing developer productivity.
Documentation and Readability: RBS annotations serve as documentation, making code easier to understand and maintain.
Setup
Install rbs_rails gem
gem install rbs_rails
Generate tasks
bin/rails g rbs_rails:install
Run this to generate the rbs collection configuration file
bundle exec rbs collection init
Now simply run this to download the required gem's rbs file
bundle exec rbs collection install
We are going to use steep gem to type checking
So, install steep gem
bundle install steep
Create Steepfile with this configuration
target :app do
signature "sig"
end
As per the configuration, it will check sig folder for our writer rbs annotation files for our codebase
Issues
But one problem with RBS is -> As it's fairly new to the market, there is not much support for RBS in all the libraries. So we face various issues regarding that.
In our case, while using rbs validate it was throwing RBS::DuplicatedMethodDefinitionError due to conflicting rbs code of meta-tags and activesupport gem.
After searching for various solutions and taking suggestions from the maintainer, the final solution to fix the issue was -
Add meta-tags gem to ignore the list of rbs collection configurations like
gems:
# Skip loading rbs gem's RBS.
# It's unnecessary if you don't use rbs as a library.
- name: rbs
ignore: true
- name: steep
ignore: true
Copy the rbs file of meta-tags gem
Modify them to remove duplicate definition issue
And then copy-paste those files in sig/vendor/meta-tags folder
References -
Discussion Thread for the issue - https://github.com/ruby/rbs/issues/1359
PR - https://github.com/CircuitVerse/CircuitVerse/pull/3807/
Undercover is a great tool to analyze untested code of a commit and do PR reviews.
SimpleCov is mainly used to generate the test details and undercover analyze the generated Lcov file.
Setup SimpleCov to generate the Lcov file
Install simplecov and simplecov-lcov gem to :test group
In the config/environments/test.rb file, paste this configuration file at the top
require "simplecov"
require "simplecov-lcov"
SimpleCov::Formatter::LcovFormatter.config.report_with_single_file = true
SimpleCov.formatter = SimpleCov::Formatter::LcovFormatter
SimpleCov.start do
add_filter(/^\/spec\//) # For RSpec, use `test` for MiniTest
enable_coverage(:branch)
end
Now we need to load all the code beforehand for this analysis
So, mark config.eager_load = true in configuration of test environment
Now when we run our test suite, it will generate lcov file under coverage/lcov/<project_name>.lcov file.
Now, We need to setup undercover CI for PR review
The first and easier option is to use https://undercover-ci.com/ which has simple steps for installation. But the issue here is , it's paid for organization
So,we keep searching and found a opensource project undercover-checkstyle which can review the PR by using undercover CLI tool and use reviewdog to do the PR Review
For this, add undercover-checkstyle gem under :test group in Gemfile
In the CI workflow add this configuration
- uses: aki77/delete-pr-comments-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
bodyContains: "[undercover]"
noReply: "true"
- name: Run reviewdog
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.github_token }}
run: |
git fetch --no-tags
reviewdog -reporter=github-pr-review -runners=undercover --fail-on-error
After the setup, it will provide a review of any PR.
Just for example, the github-actions bot will give a review like this. This will also delete previous comments to make the PR Review clean.

PR - CircuitVerse/CircuitVerse#3812 CircuitVerse/CircuitVerse#3818
That's all for this week. Subscribe to the newsletter for more updates.