Skip to content
Phillmont Muktar edited this page Aug 7, 2023 · 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.
  • Rails tests (Models, Controller, and Views) are written in RSpec.
  • As of #6287, new end-to-end tests are written with Playwright in tests/tests. To run these tests, in tests/,
    • Install Playwright dependencies with yarn prepare.
    • Run the tests with yarn test.
  • Legacy end-to-end tests in spec/features written in RSpec and Capybara should only be modified for bug fixes or extensions. 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: