Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ jobs:
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Lint
run: bundle exec rubocop
- name: Bundle install
if: matrix.container != null
run: bundle install --jobs=4 --retry=3
Expand Down
206 changes: 141 additions & 65 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,112 +1,188 @@
#inherit_from:
# - .rubocop_todo.yml

Metrics:
---
AllCops:
Exclude:
- vendor/**/*
- lib/yard/parser/ruby/legacy/irb/slex.rb
- lib/yard/parser/ruby/legacy/ruby_lex.rb
- lib/yard/server/http_utils.rb
NewCops: enable
SuggestExtensions: false
TargetRubyVersion: 2
Bundler/GemFilename:
Enabled: false
Layout/LineLength:
AutoCorrect: true
Max: 100
Style/Semicolon:
AllowAsExpressionSeparator: true
Style/Documentation:
Gemspec/RequireMFA:
Enabled: false
Style/ClassVars:
Layout/ArrayAlignment:
Enabled: false
Style/HashSyntax:
EnforcedStyle: hash_rockets
Layout/SpaceInsideHashLiteralBraces:
EnforcedStyle: no_space
Layout/SpaceInsideBlockBraces:
SpaceBeforeBlockParameters: false
Style/NumericPredicate: # ruby 1.8/1.9 do not have positive?/negative?
EnforcedStyle: comparison
Layout/MultilineMethodCallIndentation:
EnforcedStyle: indented
Layout/DotPosition:
EnforcedStyle: trailing
Style/FormatString:
EnforcedStyle: percent
Layout/EmptyLineAfterGuardClause:
Enabled: false
Layout/EmptyLineAfterMagicComment:
Enabled: false
Layout/EmptyLineBetweenDefs:
AllowAdjacentOneLineDefs: true
Layout/EmptyLinesAroundAttributeAccessor:
Enabled: false
Layout/EndOfLine:
Enabled: false
Layout/FirstArrayElementIndentation:
EnforcedStyle: consistent
Layout/FirstHashElementIndentation:
EnforcedStyle: consistent

# Disable these until we know what to do with them
Style/SafeNavigation:
Enabled: false # not supported in 1.8...2.1
Style/GuardClause: # does not provide much value
Layout/HashAlignment:
Enabled: false
Naming/VariableNumber:
Layout/LineLength:
AutoCorrect: true
Exclude:
- spec/**/*.rb
Max: 120
Layout/MultilineMethodCallIndentation:
EnforcedStyle: indented
Layout/ParameterAlignment:
Enabled: false
Layout/SpaceAroundMethodCallOperator:
Enabled: false
Layout/SpaceInsideBlockBraces:
SpaceBeforeBlockParameters: false
Layout/SpaceInsideHashLiteralBraces:
EnforcedStyle: no_space
Lint/ConstantDefinitionInBlock:
Exclude:
- benchmarks/**/*.rb
- docs/**/*.rb
- spec/**/*.rb
Lint/DuplicateMethods:
Enabled: false
Naming/AccessorMethodName: # this creates breaking changes in the API
Lint/MissingSuper:
Enabled: false
Naming/PredicateName: # this creates breaking changes in the API
Lint/RaiseException:
Enabled: false
Style/MethodMissingSuper: # this doesn't exist in 1.8/1.9
Lint/RedundantSplatExpansion:
Enabled: false
Style/MissingRespondToMissing: # this doesn't exist in 1.8/1.9
Lint/StructNewOverride:
Enabled: false
Style/Lambda: # not supported in 1.8
Lint/SuppressedException:
Enabled: false
Style/EachWithObject: # not supported in 1.8
Lint/UselessConstantScoping:
Enabled: false
Layout/ParameterAlignment: # does not work correctly with subsequent block
Metrics:
Enabled: false
Layout/ArrayAlignment: # does not support indentation
Naming/AccessorMethodName:
Enabled: false
Layout/HashAlignment: # does not support indentation
Naming/HeredocDelimiterNaming:
Enabled: false
Style/MultilineTernaryOperator:
Naming/MethodParameterName:
Enabled: false
Naming/PredicateName:
Enabled: false
Naming/VariableNumber:
Enabled: false
Performance:
Exclude:
- spec/**/*.rb
Security/Eval:
Exclude:
- benchmarks/**/*.rb
- spec/**/*.rb
Security/MarshalLoad:
Enabled: false
Style/BlockComments:
Exclude:
- benchmarks/*.rb
Style/CaseEquality:
Enabled: false
Style/ClassAndModuleChildren:
Enabled: false
Layout/EmptyLineBetweenDefs:
AllowAdjacentOneLineDefs: true
Style/SingleLineMethods:
Style/ClassVars:
Enabled: false
Style/SingleLineBlockParams:
Style/DocumentDynamicEvalDefinition:
Enabled: false
Style/NestedTernaryOperator:
Style/Documentation:
Enabled: false
Style/MutableConstant:
Style/EachWithObject:
Enabled: false
Style/WhenThen:
Style/EvalWithLocation:
Enabled: false
Style/StringLiterals:
Style/ExponentialNotation:
Enabled: false
Style/StringLiteralsInInterpolation:
Style/FetchEnvVar:
Enabled: false
Style/PerlBackrefs:
Style/FileRead:
Enabled: false
Style/BlockComments:
Exclude:
- benchmarks/*.rb
Style/CaseEquality:
Style/FileWrite:
Enabled: false
Style/WordArray:
Style/FormatString:
EnforcedStyle: percent
Style/FormatStringToken:
Enabled: false
Style/GlobalVars:
Exclude:
- benchmarks/**/*.rb
- spec/**/*.rb
Lint/RedundantSplatExpansion:
Style/GuardClause:
Enabled: false
Security/Eval:
Style/HashEachMethods:
Enabled: false
Style/HashSyntax:
EnforcedStyle: hash_rockets
Style/HashTransformKeys:
Enabled: false
Style/HashTransformValues:
Enabled: false
Style/IfWithBooleanLiteralBranches:
Enabled: false
Style/Lambda:
Enabled: false
Style/MissingRespondToMissing:
Enabled: false
Style/MixinUsage:
Exclude:
- docs/**/*.rb
- benchmarks/**/*.rb
- spec/**/*.rb

Layout/SpaceAroundMethodCallOperator:
- spec/**/*
- templates/**/*
- lib/yard/templates/**/*
Style/MultilineIfModifier:
Enabled: false
Lint/RaiseException:
Style/MultilineTernaryOperator:
Enabled: false
Lint/StructNewOverride:
Style/MutableConstant:
Enabled: false
Style/ExponentialNotation:
Style/NestedTernaryOperator:
Enabled: false
Style/HashEachMethods:
Style/NumericPredicate:
EnforcedStyle: comparison
Style/OpenStructUse:
Enabled: false
Style/HashTransformKeys:
Style/OptionalBooleanParameter:
Enabled: false
Style/HashTransformValues:
Style/PercentLiteralDelimiters:
PreferredDelimiters:
'%I': ()
'%W': ()
'%i': ()
'%w': ()
Style/PerlBackrefs:
Enabled: false
Style/SafeNavigation:
Enabled: false
Style/Semicolon:
AllowAsExpressionSeparator: true
Style/SingleLineBlockParams:
Enabled: false
Style/SingleLineMethods:
Enabled: false
Style/StderrPuts:
Enabled: false
Style/StringLiterals:
Enabled: false
Style/StringLiteralsInInterpolation:
Enabled: false
Style/WhenThen:
Enabled: false
Style/WordArray:
Enabled: false
plugins:
- rubocop-rake
- rubocop-performance
17 changes: 12 additions & 5 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,30 @@
source 'https://rubygems.org'

group :development do
gem 'rspec', '>= 3.11.0'
gem 'coveralls_reborn', :require => false
gem 'json'
gem 'rake'
gem 'rdoc', '= 6.1.2.1'
gem 'json'
gem 'simplecov'
gem 'rspec', '>= 3.11.0'
gem 'samus', '~> 3.0.9', :require => false
gem 'coveralls_reborn', :require => false
gem 'simplecov'
gem 'webrick'
end

group :lint do
gem 'rubocop'
gem 'rubocop-performance'
gem 'rubocop-rake'
end

group :asciidoc do
gem 'asciidoctor'
gem 'logger' # needed for asciidoctor
end

group :markdown do
gem 'commonmarker', '~> 0.x'
gem 'redcarpet'
gem 'commonmarker'
end

group :textile do
Expand Down
8 changes: 4 additions & 4 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# frozen_string_literal: true
require File.dirname(__FILE__) + '/lib/yard'
require File.dirname(__FILE__) + '/lib/yard/rubygems/specification'
require "#{File.dirname(__FILE__)}/lib/yard"
require "#{File.dirname(__FILE__)}/lib/yard/rubygems/specification"
require 'rbconfig'

YARD::VERSION.replace(ENV['YARD_VERSION']) if ENV['YARD_VERSION']

Dir['tasks/**/*.rake'].each { |task_file| load task_file }
Dir['tasks/**/*.rake'].each {|task_file| load task_file }

desc "Builds the gem"
task :gem do
Expand All @@ -29,7 +29,7 @@ task :test_doc do
sh "ruby bin/yard --fail-on-warning #{"--no-progress" if ENV["CI"]}"
end

task :default => [:spec, :test_doc]
task :default => %i(spec test_doc)

YARD::Rake::YardocTask.new do |t|
t.options += ['--title', "YARD #{YARD::VERSION} Documentation"]
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/builtins_vs_eval.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def bench_builtins(name)

def bench_eval(name)
eval(name).is_a?(Class)
rescue
rescue StandardError
false
end

Expand Down
16 changes: 8 additions & 8 deletions benchmarks/erb_vs_erubis.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,41 +13,41 @@ def rungen

Benchmark.bmbm do |x|
x.report("erubis") do
eval <<-eof
eval <<-EOF
module YARD; module Templates; module Template
def erb_with(str, x) Erubis::Eruby.new(str) end
end end end
eof
EOF

rungen
end

x.report("fast-erubis") do
eval <<-eof
eval <<-EOF
module YARD; module Templates; module Template
def erb_with(str, x) Erubis::FastEruby.new(str) end
end end end
eof
EOF

rungen
end

x.report("tiny-erubis") do
eval <<-eof
eval <<-EOF
module YARD; module Templates; module Template
def erb_with(str, x) Erubis::TinyEruby.new(str) end
end end end
eof
EOF

rungen
end

x.report("erb") do
eval <<-eof
eval <<-EOF
module YARD; module Templates; module Template
def erb_with(str, x) ERB.new(str) end
end end end
eof
EOF

rungen
end
Expand Down
Loading
Loading