This guide reflects our current development practices we have adopted for all of our open source projects. This is the Ribose fork of the thoughtbot guide. It is mostly similar with some minor adjustments.
If you are contributing to any of our open source projects then it’s highly expected that you follow this guidelines, but if you have some different opinion about any of the rules then please open an Issue for detailed discussion.
High level guidelines:
-
Be consistent.
-
Don’t rewrite existing code to follow this guide.
-
Don’t violate a guideline without a good reason.
-
A reason is good when you can convince a teammate.
For Ruby-based projects, we use ruby-style-guide, which is based on the bbatsov-guide with some customized preferences.
Once you start a new project, please copy the contents of for_new_projects/ruby directory to your project root. Particularly, this directory contains:
Once everything is setup, Hound CI should comment on each of the Pull Requests whenever there is a violations, and please do not merge it until you resolve those.
Source guides are kept in src/rubocop
. Whenever you update any of those,
please run rake build:rubocop
and commit generated changes.
We use several tools to measure code quality in our projects. The typical setup is:
- Code Climate
-
Performs additional code quality analysis (complexity etc). Optionally, Code Climate is capable of running Rubocop too, however it is strongly discouraged to enable that. Due to frequent breaking changes, style guide must be written for specific Rubocop version, and our style guide is meant to be compatible with Hound. See this for respective discussion. Moreover, Code Climate is capable of measuring test coverage, however we prefer CodeCov for that.
- CodeCov
-
Measures test coverage.
- Hound CI
-
Runs Rubocop, that is validates code against our style guide.
- Travis CI
-
Continuous integration.
This repository is mirrored in every GitHub organization that Ribose Inc.
manages in order to workaround Hound CI limitation that organization-wide style
guide must be kept in a repository within that organization.
Mirrors are synchronized via GitHub Actions, specifically propagate
workflow
defined in this very repository.
In order to set up another mirror, following steps should be performed:
-
Create a mirror repository on Github, e.g.
new_organization/oss-guides
. -
Add the mirror repository to the
matrix:
key in thepropagate.yml
workflow. -
Add the "ribose-ci" user to the
new_organization/oss-guides
repository with write access.
This guide is maintained by Ribose Inc.