Skip to content
This repository has been archived by the owner on Jul 21, 2020. It is now read-only.

OLD - Basic RoR project to implement linting in CircleCi with reviewdog

Notifications You must be signed in to change notification settings

rjherrera/rails-linting-ci-dep

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rails Linting CI

This is a Rails application, initially generated using Potassium by Platanus.

The idea of this project is to try different approaches to the linting phase of the development process. This repository showcases 2 main alternatives:

  1. Use CircleCI workflows, adding another job alongside the original for testing. This lint job runs parallel, and uses reviewdog to format error messages from linters, and comment pull requests.
  2. Use GitHub Actions, adding a new CI build just for the linting purpose. It also uses reviewdog.

Both approaches work fine, but CircleCI provides some perks, like shared secrets between the whole organization through contexts, so that the token for reviewdog is not needed in each repository's secrets.

The linters being used in both CI alternatives are rubocop, eslint and stylelint. Every linter is installed in the CI machine with the version locked in either the Gemfile.lock or yarn.lock. They also use local rules hosted in the repo.

Local installation

Assuming you've just cloned the repo, run this script to setup the project in your machine:

$ ./bin/setup

It assumes you have a machine equipped with Ruby, Node.js, Docker and make.

The script will do the following among other things:

  • Install the dependecies
  • Create a docker container for your database
  • Prepare your database
  • Adds heroku remotes

After the app setup is done you can run it with Heroku Local

$ heroku local

Continuous Integrations

The project is setup to run tests in CircleCI

You can also run the test locally simulating the production environment using docker. Just make sure you have docker installed and run:

bin/cibuild

Style Guides

The style guides are enforced through a self hosted version of Hound CI. The style configuration can also be used locally in development runing rubocop or just using the rubocop integration for your text editor of choice.

You can add custom rules to this project just adding them to the .ruby-style.yml file.

Internal dependencies

Authentication

We are using the great Devise library by PlataformaTec

Rails pattern enforcing types

This projects uses Power-Types to generate Services, Commands, Utils and Values.

Error Reporting

To report our errors we use Sentry

Scheduled Tasks

To schedule recurring work at particular times or dates, this project uses Sidekiq Scheduler

Queue System

For managing tasks in the background, this project uses Sidekiq

Seeds

To populate your database with initial data you can add, inside the /db/seeds.rb file, the code to generate only the necessary data to run the application. If you need to generate data with development purposes, you can customize the lib/fake_data_loader.rb module and then to run the rake load_fake_data task from your terminal.

About

OLD - Basic RoR project to implement linting in CircleCi with reviewdog

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published