forked from troessner/reek
/
yaml.feature
85 lines (80 loc) · 2.22 KB
/
yaml.feature
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
@yaml
Feature: Report smells using simple YAML layout
In order to parse reek's output simply and consistently, simply
output a list of smells in Yaml.
Scenario: output is empty when there are no smells
When I run reek --yaml spec/samples/three_clean_files
Then it succeeds
And stdout equals ""
@masking
Scenario: masked smells always appear
When I run reek --yaml spec/samples/masked/dirty.rb
Then the exit status indicates smells
And it reports this yaml:
"""
---
- !ruby/object:Reek::SmellWarning
location:
lines:
- 4
- 6
context: Dirty#a
source: spec/samples/masked/dirty.rb
smell:
class: Duplication
occurrences: 2
subclass: DuplicateMethodCall
call: "@s.title"
message: calls @s.title twice
status:
is_active: true
- !ruby/object:Reek::SmellWarning
location:
lines:
- 5
- 7
context: Dirty#a
source: spec/samples/masked/dirty.rb
smell:
class: Duplication
occurrences: 2
subclass: DuplicateMethodCall
call: puts(@s.title)
message: calls puts(@s.title) twice
status:
is_active: true
- !ruby/object:Reek::SmellWarning
location:
lines:
- 5
context: Dirty#a
source: spec/samples/masked/dirty.rb
smell:
class: NestedIterators
depth: 2
subclass: NestedIterators
message: contains iterators nested 2 deep
status:
is_active: true
"""
@stdin
Scenario: return non-zero status when there are smells
When I pass "class Turn; end" to reek --yaml
Then the exit status indicates smells
And it reports this yaml:
"""
---
- !ruby/object:Reek::SmellWarning
location:
lines:
- 1
context: Turn
source: $stdin
smell:
class: IrresponsibleModule
subclass: IrresponsibleModule
module_name: Turn
message: has no descriptive comment
status:
is_active: true
"""