-
Notifications
You must be signed in to change notification settings - Fork 204
/
autocorrectable-good.rb
83 lines (69 loc) 路 1.29 KB
/
autocorrectable-good.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
# Some code that violates lots of rules
STUFF = [
1,
3,
4,
5
]
THINGS = {
oh: :io,
hi: "neat"
}
class Something
alias_method :do_more_stuff, :do_stuff
attr_reader :foo
def do_stuff(a, b, c)
maths_and_stuff = 4 +
5 +
6
plus_stuff = STUFF.map { |e|
e + 1 + maths_and_stuff
}
STUFF.tap { |arr| arr.delete(0) }
STUFF.each { |e| e.succ }
THINGS.tap do |things|
if THINGS.is_a?(Hash)
42 + 8
end
end
THINGS.keys.each do |key|
if plus_stuff.reduce(:+) > 1
THINGS[key] = plus_stuff[i]
end
end
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(a:, b:, test: true)
if test
a
else
b
end
end