Fix incorrect rubocop settings.

Fix incorrect rubocop settings.

From 74a8bfed06a579db2ba1af9eede2568631a7c366 Mon Sep 17 00:00:00 2001
From: Guo Xiang Tan <tgx_world@hotmail.com>
Date: Thu, 29 Nov 2018 17:22:09 +0800
Subject: [PATCH] Fix incorrect rubocop settings.


diff --git a/.rubocop.yml b/.rubocop.yml
index a529980..c4810e5 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -2,10 +2,10 @@ AllCops:
   TargetRubyVersion: 2.4
   DisabledByDefault: true
   Exclude:
-    - 'db/schema.rb'
-    - 'bundle/**/*'
-    - 'vendor/**/*'
-    - 'node_modules/**/*'
+    - "db/schema.rb"
+    - "bundle/**/*"
+    - "vendor/**/*"
+    - "node_modules/**/*"
 
 # Prefer &&/|| over and/or.
 Style/AndOr:
@@ -52,7 +52,7 @@ Layout/SpaceAroundOperators:
   Enabled: true
 
 Layout/SpaceBeforeFirstArg:
-    Enabled: true
+  Enabled: true
 
 # Defining a method with parameters needs parentheses.
 Style/MethodDefParentheses:
@@ -88,12 +88,12 @@ Layout/TrailingWhitespace:
 Lint/Debugger:
   Enabled: true
 
-Lint/BlockAlignment:
+Layout/BlockAlignment:
   Enabled: true
 
 # Align `end` with the matching keyword or starting expression except for
 # assignments, where it should be aligned with the LHS.
-Lint/EndAlignment:
+Layout/EndAlignment:
   Enabled: true
   EnforcedStyleAlignWith: variable

GitHub

2 Likes

I wonder if we should start inheriting configuration from a remote URL instead of duplicating it in all our repositories. :thinking:

3 Likes

Yes please, assigning this to you to make it happen, feel free to close once you do all the official plugins :slight_smile:

3 Likes

OK, I wrote a small script to add the inherited rubocop config to our public repositories if they already had an existing rubocop config or if they belong to a official plugin. Some files needed fixing, so I applied rubocop’s autofixes.

It seems to work well. The only downside I see is the ugly .rubocop-https---raw-githubusercontent-com-discourse-discourse-master--rubocop-yml file used for caching the inherited config. I added it to .gitignore and I guess a good editor can hide it from you. :slight_smile:

2 Likes