-
Notifications
You must be signed in to change notification settings - Fork 203
/
autocorrectable-bad.rb
105 lines (83 loc) 路 1.8 KB
/
autocorrectable-bad.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#Some code that violates lots of rules
STUFF = [
1,
3,
4,
5,
]
THINGS = {
:oh => :io,
:hi => 'neat',
}
class Something
alias do_more_stuff do_stuff
attr_reader :foo,
def do_stuff( a,b,c )
maths_and_stuff = 4 +
5 +
6
plus_stuff = STUFF.map do |e|
e+1+ maths_and_stuff
end
STUFF.tap { |arr| arr.delete(0) }
STUFF.each do |e| e.succ end
THINGS.tap { |things|
if THINGS.kind_of?(Hash)
42 + 8
end
}
test = 'hi'
test2 = 'hi'
test3 = test.object_id == test2.object_id
if test3
32 + 3
end
THINGS.keys.each { |key|
if ( plus_stuff.reduce(:+) > 1 )
THINGS[key] = plus_stuff[i]
end
}
end
def do_even_more_stuff
foo = begin
do_stuff(1,2,3)
rescue StandardError
nil
end
foo
end
end
# some alignment opinions
class AlignyStuff
def self.enum(options)
a = 3
a + 4
end
enum event_type: {
thing_1: 0,
thing_2: 1,
longer_thing: 2,
even_longer_thing: 3,
}
def setup_fog_credentials(config)
config.fog_credentials = {
provider: 'AWS',
aws_access_key_id: ENV['S3_ACCESS_KEY'],
aws_secret_access_key: ENV['S3_SECRET'],
region: ENV['S3_REGION'],
}
config.fog_credentials_as_kwargs(
provider: 'AWS',
aws_access_key_id: ENV['S3_ACCESS_KEY'],
aws_secret_access_key: ENV['S3_SECRET'],
region: ENV['S3_REGION'],
)
end
end
def bad_function(test: true, a:, b:)
if test
a
else
b
end
end