A long-lived project that still receives updates
Custom rubocop cops used by Discourse
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 13.1.0
~> 3.12.0

Runtime

 Project Readme

rubocop-discourse

Custom Discourse RuboCop cops plus our shared project configuration (RSpec, Rails, Capybara, FactoryBot). Most Discourse projects use Syntax Tree for formatting, so we recommend the Syntax Tree-compatible config by default.

Installation

Add the gem to your development group:

group :development, :test do
  gem "rubocop-discourse"
end

Configuration

Recommended (Syntax Tree-friendly, omits Layout cops so it can be used with the formatter):

inherit_gem:
  rubocop-discourse: stree-compat.yml

stree-compat.yml includes Discourse cops plus core/RSpec/Rails/Capybara/FactoryBot, but leaves layout to Syntax Tree.

Base config with layout cops (for projects not using Syntax Tree):

inherit_gem:
  rubocop-discourse: default.yml

default.yml is kept for backwards compatibility and pulls in stree-compat.yml plus rubocop-layout.yml.

Then run bundle exec rubocop as usual.

Switching an existing project to Syntax Tree:

 inherit_gem:
-  rubocop-discourse: default.yml # includes layout cops
+  rubocop-discourse: stree-compat.yml # defers layout to Syntax Tree