Skip to content

Commit 3c5df3e

Browse files
committed
Fix code style
1 parent 5add84c commit 3c5df3e

File tree

197 files changed

+7041
-6299
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

197 files changed

+7041
-6299
lines changed

.rubocop.yml

Lines changed: 81 additions & 202 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,40 @@
1-
Encoding:
1+
# This file shows examples on how to instantiate a document in multiple ways,
2+
# it does not actually do the instantiation and isn't actually shadowing any
3+
# variables.
4+
Lint/ShadowingOuterLocalVariable:
5+
Exclude:
6+
- manual/basic_concepts/creation.rb
7+
8+
Metrics/AbcSize:
9+
Enabled: false
10+
Metrics/ClassLength:
11+
Enabled: false
12+
Metrics/CyclomaticComplexity:
13+
Enabled: false
14+
Metrics/MethodLength:
15+
Enabled: false
16+
Metrics/ModuleLength:
17+
Enabled: false
18+
Metrics/PerceivedComplexity:
19+
Enabled: false
20+
21+
Style/AccessorMethodName:
22+
Exclude:
23+
- lib/prawn/graphics/color.rb
24+
25+
Style/AlignParameters:
26+
EnforcedStyle: with_fixed_indentation
27+
28+
# We need to reference non-ascii characters when testing and explaining
29+
# behavior related to win-1252, UTF-8 and UTF-16 encodings for example.
30+
Style/AsciiComments:
31+
Enabled: false
32+
33+
Style/Documentation:
34+
Enabled: false
35+
36+
Style/Encoding:
37+
EnforcedStyle: never
238
# To be safe we are leaving these files encoded ASCII-8BIT as
339
# discussed at https://github.com/prawnpdf/prawn/pull/705
440
Exclude:
@@ -7,223 +43,66 @@ Encoding:
743
- lib/prawn/images.rb
844
- spec/png_spec.rb
945

10-
# These cops need to remain disabled for valid reasons on this code base
46+
Style/FirstArrayElementLineBreak:
47+
Enabled: true
1148

12-
# We need to reference non-ascii characters when testing and explaining
13-
# behavior related to win-1252, UTF-8 and UTF-16 encodings for example.
14-
AsciiComments:
15-
Enabled: false
49+
Style/FirstHashElementLineBreak:
50+
Enabled: true
1651

17-
# We don't always prefer modified if statements even if they do fit on
18-
# a line.
19-
IfUnlessModifier:
52+
Style/FirstMethodArgumentLineBreak:
53+
Enabled: true
54+
55+
Style/FirstParameterIndentation:
56+
EnforcedStyle: consistent
57+
58+
Style/GuardClause:
2059
Enabled: false
2160

2261
# In this case we supress Prawn::Errors::CannotFit while trying to scale
2362
# text down to fit.
24-
HandleExceptions:
63+
Lint/HandleExceptions:
2564
Exclude:
2665
- lib/prawn/text/formatted/box.rb
2766

28-
# %w() style arrays don't always look better.
29-
WordArray:
67+
# We don't always prefer modified if statements even if they do fit on
68+
# a line.
69+
Style/IfUnlessModifier:
3070
Enabled: false
3171

32-
# Due to some layout constraints in our examples we want to allow these rule to
33-
# be ignored in the manual.
34-
Style/ClosingParenthesisIndentation:
35-
Exclude:
36-
- manual/**/*
37-
LineEndConcatenation:
38-
Exclude:
39-
- manual/**/*
40-
MultilineOperationIndentation:
72+
Style/IndentArray:
73+
EnforcedStyle: consistent
74+
75+
Style/IndentHash:
76+
EnforcedStyle: consistent
77+
78+
Style/MultilineMethodCallIndentation:
79+
EnforcedStyle: indented
80+
81+
Style/MultilineOperationIndentation:
82+
EnforcedStyle: indented
4183
Exclude:
42-
- manual/**/*
4384
- prawn.gemspec
44-
Style/SpaceInsideParens:
45-
Exclude:
46-
- manual/**/*
47-
Style/SpaceBeforeFirstArg:
48-
Exclude:
49-
- manual/**/*
5085

51-
# This file shows examples on how to instantiate a document in multiple ways,
52-
# it does not actually do the instantiation and isn't actually shadowing any
53-
# variables.
54-
ShadowingOuterLocalVariable:
55-
Exclude:
56-
- manual/basic_concepts/creation.rb
86+
Style/PercentLiteralDelimiters:
87+
PreferredDelimiters:
88+
'%': '()'
89+
'%i': '[]'
90+
'%I': '[]'
91+
'%q': '()'
92+
'%Q': '()'
93+
'%r': '{}'
94+
'%s': '()'
95+
'%w': '[]'
96+
'%W': '[]'
97+
'%x': '()'
5798

58-
# We currently ignore usage of semicolons on this page of the manual so we
59-
# don't have to worry about changing the content of the manual for now.
60-
Semicolon:
99+
Style/PredicateName:
61100
Exclude:
62-
- manual/bounding_box/nesting.rb
101+
- lib/prawn/font/ttf.rb
102+
- lib/prawn/font/afm.rb
63103

64-
65-
# This cops are candidates for enabling and doing the related cleanup and/or
66-
# refactoring
67-
Style/BlockDelimiters:
68-
Enabled: false
69-
EnforcedStyle: semantic
70-
Void:
71-
Enabled: false
72-
StringLiterals:
73-
Enabled: false
74-
HashSyntax:
75-
Enabled: false
76-
UselessAssignment:
77-
Enabled: false
78-
Lambda:
79-
Enabled: false
80-
LineLength:
81-
Enabled: false
82-
SpaceBeforeBlockBraces:
83-
Enabled: false
84-
SpaceInsideBrackets:
85-
Enabled: false
86-
FormatString:
87-
Enabled: false
88-
CollectionMethods:
89-
Enabled: false
90-
DotPosition:
91-
Enabled: false
92-
SingleLineBlockParams:
93-
Enabled: false
94-
PercentLiteralDelimiters:
95-
Enabled: false
96-
Documentation:
97-
Enabled: false
98-
RegexpLiteral:
99-
Enabled: false
100-
MethodLength:
101-
Enabled: false
102-
VariableInterpolation:
103-
Enabled: false
104-
AndOr:
105-
Enabled: false
106-
AssignmentInCondition:
107-
Enabled: false
108-
ClassAndModuleChildren:
109-
Enabled: false
110-
NumericLiterals:
111-
Enabled: false
112-
DoubleNegation:
113-
Enabled: false
114-
SelfAssignment:
115-
Enabled: false
116-
ClassLength:
117-
Enabled: false
118-
CaseEquality:
119-
Enabled: false
120-
RedundantSelf:
121-
Enabled: false
122-
BlockNesting:
123-
Enabled: false
124-
NegatedWhile:
125-
Enabled: false
126-
MultilineIfThen:
127-
Enabled: false
128-
ModuleFunction:
129-
Enabled: false
130-
CyclomaticComplexity:
131-
Enabled: false
132-
UnreachableCode:
133-
Enabled: false
134-
AccessorMethodName:
135-
Enabled: false
136-
Style/SpaceAroundKeyword:
137-
Enabled: false
138-
PredicateName:
139-
Enabled: false
140-
ConstantName:
141-
Enabled: false
142-
MethodName:
143-
Enabled: false
144-
Alias:
145-
Enabled: false
146-
RedundantReturn:
147-
Enabled: false
148-
WhileUntilModifier:
149-
Enabled: false
150-
StringConversionInInterpolation:
151-
Enabled: false
152-
RedundantBegin:
153-
Enabled: false
154-
PerlBackrefs:
155-
Enabled: false
156-
ClassVars:
157-
Enabled: false
158-
ParameterLists:
159-
Enabled: false
160-
AbcSize:
161-
Enabled: false
162-
PerceivedComplexity:
163-
Enabled: false
164-
UnusedBlockArgument:
165-
Enabled: false
166-
UnusedMethodArgument:
167-
Enabled: false
168-
Next:
169-
Enabled: false
170-
ClassCheck:
171-
Enabled: false
172-
SpaceBeforeComma:
173-
Enabled: false
174-
StringLiteralsInInterpolation:
175-
Enabled: false
176-
GuardClause:
177-
Enabled: false
178-
BlockEndNewline:
179-
Enabled: false
180-
Style/MultilineMethodCallBraceLayout:
181-
Enabled: false
182-
Performance/StringReplacement:
183-
Enabled: false
184-
Style/SymbolProc:
185-
Enabled: false
186-
Style/ExtraSpacing:
187-
Enabled: false
188104
Style/SpaceAroundOperators:
189-
Enabled: false
190-
Style/ParallelAssignment:
191-
Enabled: false
192-
Style/IndentArray:
193-
Enabled: false
194-
Style/SignalException:
195-
Enabled: false
196-
Style/MultilineArrayBraceLayout:
197-
Enabled: false
198-
Style/MutableConstant:
199-
Enabled: false
200-
Style/ConditionalAssignment:
201-
Enabled: false
202-
Style/ZeroLengthPredicate:
203-
Enabled: false
204-
Metrics/ModuleLength:
205-
Enabled: false
206-
Style/MultilineTernaryOperator:
207-
Enabled: false
208-
Style/UnneededInterpolation:
209-
Enabled: false
210-
Style/IfInsideElse:
211-
Enabled: false
212-
Style/IdenticalConditionalBranches:
213-
Enabled: false
214-
Performance/RedundantBlockCall:
215-
Enabled: false
216-
Performance/RedundantMerge:
217-
Enabled: false
218-
Style/RedundantParentheses:
219-
Enabled: false
220-
Performance/RangeInclude:
221-
Enabled: false
222-
Lint/UselessAccessModifier:
223-
Enabled: false
224-
Lint/LiteralInCondition:
225-
Enabled: false
226-
Performance/TimesMap:
227-
Enabled: false
228-
Lint/LiteralInCondition:
105+
AllowForAlignment: false
106+
107+
Style/WhileUntilModifier:
229108
Enabled: false

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
source "https://rubygems.org"
1+
source 'https://rubygems.org'
22

33
gemspec

Rakefile

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require "bundler"
1+
require 'bundler'
22
Bundler.setup
33

44
require 'rake'
@@ -7,43 +7,43 @@ require 'yard'
77
require 'rubygems/package_task'
88
require 'rubocop/rake_task'
99

10-
task :default => [:spec, :rubocop]
10+
task default: [:spec, :rubocop]
1111

12-
desc "Run all rspec files"
13-
RSpec::Core::RakeTask.new("spec") do |c|
14-
c.rspec_opts = "-t ~unresolved"
12+
desc 'Run all rspec files'
13+
RSpec::Core::RakeTask.new('spec') do |c|
14+
c.rspec_opts = '-t ~unresolved'
1515
end
1616

1717
desc "Show library's code statistics"
1818
task :stats do
1919
require 'code_statistics/code_statistics'
2020
puts CodeStatistics::CodeStatistics.new(
2121
[
22-
["Prawn", "lib"],
23-
["Specs", "spec"]
22+
%w[Prawn lib],
23+
%w[Specs spec]
2424
]
2525
).to_s
2626
end
2727

2828
YARD::Rake::YardocTask.new do |t|
2929
t.options = ['--output-dir', 'doc/html']
3030
end
31-
task :docs => :yard
31+
task docs: :yard
3232

3333
desc "Generate the 'Prawn by Example' manual"
3434
task :manual do
35-
puts "Building manual..."
36-
require File.expand_path(File.join(File.dirname(__FILE__), %w[manual contents]))
37-
puts "The Prawn manual is available at manual.pdf. Happy Prawning!"
35+
puts 'Building manual...'
36+
require File.expand_path(File.join(__dir__, %w[manual contents]))
37+
puts 'The Prawn manual is available at manual.pdf. Happy Prawning!'
3838
end
3939

40-
spec = Gem::Specification.load "prawn.gemspec"
40+
spec = Gem::Specification.load 'prawn.gemspec'
4141
Gem::PackageTask.new(spec) do |pkg|
4242
pkg.need_zip = true
4343
pkg.need_tar = true
4444
end
4545

46-
desc "Run a console with Prawn loaded"
46+
desc 'Run a console with Prawn loaded'
4747
task :console do
4848
require 'irb'
4949
require 'irb/completion'

0 commit comments

Comments
 (0)