Add RuboCop
This commit is contained in:
parent
89759226d7
commit
bb0e750779
4 changed files with 100 additions and 18 deletions
61
.rubocop.yml
Normal file
61
.rubocop.yml
Normal file
|
@ -0,0 +1,61 @@
|
|||
require:
|
||||
- rubocop-performance
|
||||
- rubocop-rake
|
||||
|
||||
AllCops:
|
||||
TargetRubyVersion: 3.0
|
||||
DisplayCopNames: true
|
||||
NewCops: enable
|
||||
|
||||
Layout/AccessModifierIndentation:
|
||||
EnforcedStyle: outdent
|
||||
|
||||
Layout/LineLength:
|
||||
Max: 80
|
||||
|
||||
Lint/AmbiguousOperatorPrecedence:
|
||||
Enabled: false
|
||||
|
||||
Lint/ReturnInVoidContext:
|
||||
Enabled: false
|
||||
|
||||
Metrics/BlockLength:
|
||||
Exclude:
|
||||
- '*.gemspec'
|
||||
- 'Rakefile'
|
||||
- 'spec/**/*_spec.rb'
|
||||
|
||||
Metrics/MethodLength:
|
||||
CountAsOne: ['array', 'hash', 'heredoc']
|
||||
|
||||
Metrics/ParameterLists:
|
||||
Exclude:
|
||||
- 'lib/diversipub/main.rb'
|
||||
|
||||
Style/AndOr:
|
||||
EnforcedStyle: conditionals
|
||||
|
||||
Style/Documentation:
|
||||
Exclude:
|
||||
- 'Rakefile'
|
||||
|
||||
Style/DoubleNegation:
|
||||
Enabled: false
|
||||
|
||||
Style/HashAsLastArrayItem:
|
||||
Enabled: false
|
||||
|
||||
Style/PerlBackrefs:
|
||||
Enabled: false
|
||||
|
||||
Style/TrailingCommaInArguments:
|
||||
EnforcedStyleForMultiline: comma
|
||||
|
||||
Style/TrailingCommaInArrayLiteral:
|
||||
EnforcedStyleForMultiline: comma
|
||||
|
||||
Style/TrailingCommaInHashLiteral:
|
||||
EnforcedStyleForMultiline: comma
|
||||
|
||||
Style/VariableInterpolation:
|
||||
Enabled: false
|
16
Rakefile
16
Rakefile
|
@ -2,7 +2,21 @@
|
|||
|
||||
require 'bundler/gem_tasks'
|
||||
|
||||
task default: []
|
||||
desc 'Run default checks'
|
||||
task default: %i[lint]
|
||||
|
||||
desc 'Run code analysis tools'
|
||||
task lint: %i[rubocop]
|
||||
|
||||
desc 'Fix code style (rubocop --auto-correct)'
|
||||
task fix: 'rubocop:auto_correct'
|
||||
|
||||
begin
|
||||
require 'rubocop/rake_task'
|
||||
RuboCop::RakeTask.new
|
||||
rescue LoadError
|
||||
nil
|
||||
end
|
||||
|
||||
desc 'Open development console'
|
||||
task :console do
|
||||
|
|
|
@ -19,9 +19,11 @@ Gem::Specification.new do |spec|
|
|||
spec.authors = ['Alex Kotov']
|
||||
spec.email = ['kotovalexarian@gmail.com']
|
||||
|
||||
spec.summary = ''
|
||||
spec.summary =
|
||||
'A publishing platform for HTTP, Gemini, ActivityPub, RSS, Atom, and others'
|
||||
|
||||
spec.description = <<~DESCRIPTION.split("\n").map(&:strip).join ' '
|
||||
A publishing platform for HTTP, Gemini, ActivityPub, RSS, Atom, and others.
|
||||
DESCRIPTION
|
||||
|
||||
spec.metadata['rubygems_mfa_required'] = 'true'
|
||||
|
@ -45,6 +47,9 @@ Gem::Specification.new do |spec|
|
|||
spec.add_runtime_dependency 'rack', '~> 2.2', '>= 2.2.7'
|
||||
spec.add_runtime_dependency 'sinatra', '~> 3.0', '>= 3.0.6'
|
||||
|
||||
spec.add_development_dependency 'pry', '~> 0.14'
|
||||
spec.add_development_dependency 'rake', '~> 13.0'
|
||||
spec.add_development_dependency 'bundler', '~> 2.4'
|
||||
spec.add_development_dependency 'pry', '~> 0.14'
|
||||
spec.add_development_dependency 'rake', '~> 13.0'
|
||||
spec.add_development_dependency 'rubocop-performance', '~> 1.13'
|
||||
spec.add_development_dependency 'rubocop-rake', '~> 0.6'
|
||||
end
|
||||
|
|
|
@ -35,20 +35,22 @@ module Diversipub
|
|||
end
|
||||
|
||||
def puma_config
|
||||
@puma_config ||= Puma::Configuration.new(
|
||||
{
|
||||
app: rack_app,
|
||||
binds: ['tcp://127.0.0.1:9292'].freeze,
|
||||
environment: 'production',
|
||||
log_requests: true,
|
||||
logger: puma_logger,
|
||||
rackup: nil,
|
||||
tag: 'diversipub',
|
||||
tcp_host: '127.0.0.1',
|
||||
tcp_port: 9292,
|
||||
workers: 0,
|
||||
},
|
||||
)
|
||||
@puma_config ||= Puma::Configuration.new puma_options.dup
|
||||
end
|
||||
|
||||
def puma_options
|
||||
@puma_options ||= {
|
||||
app: rack_app,
|
||||
binds: ['tcp://127.0.0.1:9292'].freeze,
|
||||
environment: 'production',
|
||||
log_requests: true,
|
||||
logger: puma_logger,
|
||||
rackup: nil,
|
||||
tag: 'diversipub',
|
||||
tcp_host: '127.0.0.1',
|
||||
tcp_port: 9292,
|
||||
workers: 0,
|
||||
}.freeze
|
||||
end
|
||||
|
||||
def puma_log_writer
|
||||
|
|
Loading…
Reference in a new issue