This repository has been archived by the owner on Apr 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 472
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rubocop: bring it closer to upstream
After some discussions internally, we decided that it was good to be as close to the default upstream rubocop configuration. For this reasons, I have trimmed down as much as possible our own modifications for the rubocop file, and hence we had to re-adapt a lot of code. There are some things that have been left out: - Some extra cops like rspec-rubocop. - Further trimming down some configuration options that needed some heavy liftings... Signed-off-by: Miquel Sabaté Solà <[email protected]>
- Loading branch information
Showing
349 changed files
with
2,744 additions
and
2,073 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,75 +1,100 @@ | ||
AllCops: | ||
TargetRubyVersion: 2.4 | ||
TargetRailsVersion: 4.2 | ||
|
||
inherit_from: | ||
- ./config/rubocop-suse.yml | ||
DisplayCopNames: true | ||
DisplayStyleGuide: false | ||
|
||
# TODO: (mssola) only the LDAP class and portusctl require this. | ||
Metrics/ClassLength: | ||
Max: 210 | ||
Exclude: | ||
# Files that are out of our control and that are not excluded in the | ||
# default config of rubocop. | ||
- db/schema.rb | ||
- db/migrate/* | ||
- vendor/**/* | ||
|
||
# TODO: (mssola) Some methods are offending this cop. In the SUSE's style guide | ||
# the approach is to use Rubocop's default value. In the near future I will | ||
# fix this. | ||
Metrics/MethodLength: | ||
Max: 252 | ||
# | ||
# Layout | ||
# | ||
|
||
# Of course this will fail in spec blocks... Just skip it. | ||
# This is a remnant of old SUSE-style alignment for hashes, The table format | ||
# looks more human readable. | ||
Layout/AlignHash: | ||
EnforcedHashRocketStyle: table | ||
EnforcedColonStyle: table | ||
|
||
# | ||
# Metrics | ||
# | ||
|
||
# The default is just too small. | ||
Metrics/AbcSize: | ||
Max: 30 | ||
|
||
# We will skip it for tests and the Grape API. | ||
Metrics/BlockLength: | ||
Max: 200 | ||
Exclude: | ||
- spec/**/* | ||
- lib/api/**/* | ||
|
||
# NOTE: this could be further trimmed down but the following refactorings are | ||
# needed: | ||
# 1. The Grape API classes should be further modularized (probably in helper | ||
# modules). | ||
# 2. The models regarding the registry have to be modularized. | ||
# 3. LDAP has to be refactored. | ||
Metrics/ClassLength: | ||
Max: 210 | ||
|
||
# It's convenient to mix both. This is something that SUSE's style guide does | ||
# not specify, so we take the approach that we were following already. | ||
Style/ClassAndModuleChildren: | ||
Enabled: false | ||
# The default is just too small. A limit of 100 looks reasonable and many other | ||
# projects (including inside of SUSE) are also using this value. | ||
Metrics/LineLength: | ||
Max: 100 | ||
|
||
# NOTE: (mssola) This would be nice, but there are too many errors on this for | ||
# now and it's not urgent. I will fix this in the near future. | ||
Style/Documentation: | ||
Enabled: false | ||
# NOTE: this could be further trimmed down but some refactorings will have to be | ||
# done. | ||
Metrics/MethodLength: | ||
Max: 20 | ||
|
||
# This forces us to create a new object for no real reason. | ||
Style/MultipleComparison: | ||
Enabled: false | ||
# | ||
# Rails | ||
# | ||
|
||
# Doesn't feel right ... | ||
Style/NumericPredicate: | ||
Enabled: false | ||
Rails: | ||
Enabled: true | ||
|
||
# TODO: remove this on Rails 5. | ||
Style/InverseMethods: | ||
Rails/SkipsModelValidations: | ||
Enabled: false | ||
|
||
# NOTE: (mssola) In versions of Ruby higher than 2.1.x, we get | ||
# Lint/ShadowedException in some cases where in 2.1.x it complains if we remove | ||
# such guards. Therefore, we have to disable this cop until we update the | ||
# version of Ruby to be officially supported. | ||
Lint/UnneededDisable: | ||
Enabled: false | ||
# | ||
# Style | ||
# | ||
|
||
Style/FrozenStringLiteralComment: | ||
# It's not needed to add documentation for obvious modules or classes. The main | ||
# idea is that documentation will be asked during the review process if needed. | ||
Style/Documentation: | ||
Enabled: false | ||
|
||
# TODO: move to SUSE's style guide ? | ||
Style/SymbolArray: | ||
# NOTE: this is giving false positives because it assumes some Rails 5 methods | ||
# are available. | ||
Style/InverseMethods: | ||
Enabled: false | ||
|
||
Rails: | ||
Enabled: true | ||
|
||
Rails/SkipsModelValidations: | ||
# This forces us to create a new object for no real reason. | ||
Style/MultipleComparison: | ||
Enabled: false | ||
|
||
AllCops: | ||
TargetRubyVersion: 2.4 | ||
TargetRailsVersion: 4.2 | ||
# This is a common SUSE configuration value: the performance difference between | ||
# single and double quotes is no longer there, and so it's better to be | ||
# consistent and force only double quotes. | ||
Style/StringLiterals: | ||
EnforcedStyle: double_quotes | ||
|
||
DisplayCopNames: true | ||
DisplayStyleGuide: false | ||
# Same as Style/StringLiterals. | ||
Style/StringLiteralsInInterpolation: | ||
EnforcedStyle: double_quotes | ||
|
||
Exclude: | ||
# Files that are out of our control and that are not excluded in the | ||
# default config of rubocop. | ||
- db/schema.rb | ||
- db/migrate/* | ||
- vendor/**/* | ||
# There are some false positives (e.g. "module ::Module", in which we want to | ||
# make sure there are no clashes or misunderstandings). Therefore, we just | ||
# disable this cop. | ||
Style/ClassAndModuleChildren: | ||
Enabled: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
source "https://rubygems.org" | ||
|
||
gem "active_record_union" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
require "csv" | ||
|
||
class Admin::ActivitiesController < Admin::BaseController | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
class Admin::BaseController < ApplicationController | ||
before_action :ensure_admin! | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
class Api::V2::PingController < Api::BaseController | ||
def ping | ||
authenticate_user! | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.