Skip to content
Eko Widianto edited this page May 11, 2022 · 14 revisions

Getting Started

Welcome to the Coursemology2 wiki! This wiki is intended help contributors get started to contributing on Coursemology. Coursemology is built on Ruby on Rails, with some of the front-end elements written in React.

Please take a look at the Getting Started to understand a little more about Coursemology2.

Contributing Guidelines

Where do I start?

  • You can find things to work on in on our issues page. If you wish to pick up an existing issue, do sound off (as other members might be working on that issue).
  • If you are unsure of your proposed implementation, clarifications can be done there (or by adding a Pull Request for opinions).

How do I submit my Contribution?

We adopt a pull request model for Coursemology2. Please adhere to the following best practices:

  • Smaller PRs are preferred, for easier reviewing (~3 min, ~300 lines excluding specs)
  • For new features, split into smaller PRs (eg. split via models, controllers and views). You can implement it in logical blocks. State what else is to be done in subsequent pull requests so that the reviewer is aware when reviewing.
  • Follow the commit guideline.
  • Fixes to pull requests should be in the original commit (instead of a separate commit).

Before you make that Pull Request

To make pull requests easier to review, it is a good idea to resolve some of the common issues / conventions before you submit the pull request.

Write Tests and Prevent Regressions

  • Tests must be written for all new code. This will minimise regressions and ensure better code structure.
  • Unit Tests are written for reusable React Components - run yarn jest within the client folder to run these tests.
  • Otherwise, all other tests (Models, Controller, Views, Feature or Integration tests) are written in rspec with capybara. You will need Chrome headless to run the test suite. There are two ways to run these tests (ensure that you have built the react elements with yarn):
    • bundle exec rspec - To run entire test suite
    • bundle exec rake parallel:spec[x], where x is the number of cores - To run test suite in parallel (recommended and much faster)
  • More details can be found in the 'Contributing on ____' pages

Code Style

  • Code styles are predefined in the RubyMine/IntelliJ project files. Also, the Rails Community Style Guide covers majority of the styles that we use.
  • Our frontend code style follows Airbnb's JavaScript and React style guide. Run yarn lint in the client folder and fix all issues before making a pull request.

Documentation

Write Yardoc when implementing classes. Yardoc is preferred because RubyMine is able to infer parameter and return types when annotated using it.

Run yard stats --list-undoc to find which methods need documenting.

Contributing Guides and Conventions

If you are working on Rails and/or React parts of the codebase, it is suggested that you read this first:

Clone this wiki locally