[Misc] Add rubocop and solargraph config

A bunch of rules are disabled or tweaked for the current style
This commit is contained in:
Earlopain 2021-07-05 13:21:49 +02:00
parent a73b357b7b
commit 6910369e2a
No known key found for this signature in database
GPG Key ID: 6CFB948E15246897
3 changed files with 178 additions and 0 deletions

116
.rubocop.yml Normal file
View File

@ -0,0 +1,116 @@
require:
- rubocop-rails
AllCops:
NewCops: enable
Exclude:
- "bin/*"
- "node_modules/**/*"
Bundler/OrderedGems:
Enabled: false
Layout/EmptyLineAfterGuardClause:
Enabled: false
Layout/EmptyLineBetweenDefs:
Enabled: false
Layout/LineLength:
Enabled: false
Lint/InheritException:
Enabled: false
Lint/RescueException:
Enabled: false
Metrics/AbcSize:
Enabled: false
Metrics/BlockLength:
Enabled: false
Metrics/ClassLength:
Enabled: false
Metrics/CyclomaticComplexity:
Enabled: false
Metrics/MethodLength:
Enabled: false
Metrics/ModuleLength:
Enabled: false
Metrics/PerceivedComplexity:
Enabled: false
Naming/PredicateName:
Enabled: false
Rails/HasManyOrHasOneDependent:
Enabled: false
Rails/HttpStatus:
EnforcedStyle: numeric
Rails/InverseOf:
Enabled: false
Rails/SkipsModelValidations:
Enabled: false
Rails/TimeZone:
Enabled: false
Rails/WhereEquals:
Enabled: false
Rails/WhereExists:
EnforcedStyle: where
Style/ConditionalAssignment:
Enabled: false
Style/Documentation:
Enabled: false
Style/EmptyMethod:
EnforcedStyle: expanded
Style/FloatDivision:
Enabled: false
Style/FrozenStringLiteralComment:
Enabled: false
Style/IfUnlessModifier:
Enabled: false
Style/MutableConstant:
Enabled: false
Style/NumericPredicate:
Enabled: false
Style/PerlBackrefs:
Enabled: false
Style/QuotedSymbols:
Enabled: false
Style/RescueStandardError:
Enabled: false
Style/StringLiterals:
Enabled: false
Style/StringLiteralsInInterpolation:
Enabled: false
Style/SymbolArray:
Enabled: false
Style/WordArray:
Enabled: false

31
.solargraph.yml Normal file
View File

@ -0,0 +1,31 @@
---
include:
- "**/*.rb"
exclude:
- spec/**/*
- test/**/*
- vendor/**/*
- ".bundle/**/*"
require:
- actioncable
- actionmailer
- actionpack
- actionview
- activejob
- activemodel
- activerecord
- activestorage
- activesupport
domains: []
reporters:
- rubocop
- require_not_found
formatter:
rubocop:
cops: safe
except: []
only: []
extra_args: []
require_paths: []
plugins: []
max_files: 5000

31
config/solargraph.rb Normal file
View File

@ -0,0 +1,31 @@
# The following comments fill some of the gaps in Solargraph's understanding of
# Rails apps. Since they're all in YARD, they get mapped in Solargraph but
# ignored at runtime.
#
# You can put this file anywhere in the project, as long as it gets included in
# the workspace maps. It's recommended that you keep it in a standalone file
# instead of pasting it into an existing one.
#
# @!parse
# class ActionController::Base
# include ActionController::MimeResponds
# extend ActiveSupport::Callbacks::ClassMethods
# extend AbstractController::Callbacks::ClassMethods
# end
# class ActiveRecord::Base
# extend ActiveRecord::QueryMethods
# extend ActiveRecord::FinderMethods
# extend ActiveRecord::Associations::ClassMethods
# extend ActiveRecord::Inheritance::ClassMethods
# include ActiveRecord::Persistence
# end
# @!override ActiveRecord::FinderMethods#find
# @overload find(id)
# @param id [Integer]
# @return [self]
# @overload find(list)
# @param list [Array]
# @return [Array<self>]
# @overload find(*args)
# @return [Array<self>]
# @return [self, Array<self>]