Skip to content

Commit

Permalink
Use AST::Node's own stored source as a base for formatting
Browse files Browse the repository at this point in the history
AST::Node stores the parsed source so we can use that directly. As a
result, some smell masking may have to be adjusted.

Since SexpFormatter is no longer needed, it is removed, as is its
dependency, Unparser.

Since Parser 2.3.0 behaves differently on certain syntax errors and support
for it is part of an upcomping change, the allowed versions of Parser
are limited, as Unparser did in the past.
  • Loading branch information
mvz committed Jan 19, 2016
1 parent f019eb2 commit 66be5f2
Show file tree
Hide file tree
Showing 20 changed files with 118 additions and 122 deletions.
2 changes: 1 addition & 1 deletion features/command_line_interface/smells_count.feature
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Feature: Reports total number of code smells
"""
smelly.rb -- 3 warnings:
[4, 5]:DuplicateMethodCall: Smelly#m calls @foo.bar 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
[4, 5]:DuplicateMethodCall: Smelly#m calls puts(@foo.bar) 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
[4, 5]:DuplicateMethodCall: Smelly#m calls puts @foo.bar 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
[3]:UncommunicativeMethodName: Smelly#m has the name 'm' [https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Method-Name.md]
"""

Expand Down
4 changes: 2 additions & 2 deletions features/configuration_loading.feature
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Feature: Offer different ways how to load configuration
"""
smelly.rb -- 3 warnings:
[4, 5]:DuplicateMethodCall: Smelly#m calls @foo.bar 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
[4, 5]:DuplicateMethodCall: Smelly#m calls puts(@foo.bar) 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
[4, 5]:DuplicateMethodCall: Smelly#m calls puts @foo.bar 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
[3]:UncommunicativeMethodName: Smelly#m has the name 'm' [https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Method-Name.md]
"""

Expand Down Expand Up @@ -46,6 +46,6 @@ Feature: Offer different ways how to load configuration
"""
smelly.rb -- 3 warnings:
[4, 5]:DuplicateMethodCall: Smelly#m calls @foo.bar 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
[4, 5]:DuplicateMethodCall: Smelly#m calls puts(@foo.bar) 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
[4, 5]:DuplicateMethodCall: Smelly#m calls puts @foo.bar 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
[3]:UncommunicativeMethodName: Smelly#m has the name 'm' [https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Method-Name.md]
"""
4 changes: 2 additions & 2 deletions features/programmatic_access.feature
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Feature: Using Reek programmatically
And it reports:
"""
calls @foo.bar 2 times
calls puts(@foo.bar) 2 times
calls puts @foo.bar 2 times
has the name 'm'
"""

Expand All @@ -38,6 +38,6 @@ Feature: Using Reek programmatically
"""
smelly.rb -- 3 warnings:
DuplicateMethodCall: Smelly#m calls @foo.bar 2 times
DuplicateMethodCall: Smelly#m calls puts(@foo.bar) 2 times
DuplicateMethodCall: Smelly#m calls puts @foo.bar 2 times
UncommunicativeMethodName: Smelly#m has the name 'm'
"""
8 changes: 4 additions & 4 deletions features/rake_task/rake_task.feature
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Feature: Reek can be driven through its Task
"""
smelly.rb -- 3 warnings:
[4, 5]:DuplicateMethodCall: Smelly#m calls @foo.bar 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
[4, 5]:DuplicateMethodCall: Smelly#m calls puts(@foo.bar) 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
[4, 5]:DuplicateMethodCall: Smelly#m calls puts @foo.bar 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
[3]:UncommunicativeMethodName: Smelly#m has the name 'm' [https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Method-Name.md]
"""

Expand All @@ -34,7 +34,7 @@ Feature: Reek can be driven through its Task
"""
smelly.rb -- 3 warnings:
[4, 5]:DuplicateMethodCall: Smelly#m calls @foo.bar 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
[4, 5]:DuplicateMethodCall: Smelly#m calls puts(@foo.bar) 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
[4, 5]:DuplicateMethodCall: Smelly#m calls puts @foo.bar 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
[3]:UncommunicativeMethodName: Smelly#m has the name 'm' [https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Method-Name.md]
"""

Expand All @@ -52,7 +52,7 @@ Feature: Reek can be driven through its Task
"""
smelly.rb -- 3 warnings:
[4, 5]:DuplicateMethodCall: Smelly#m calls @foo.bar 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
[4, 5]:DuplicateMethodCall: Smelly#m calls puts(@foo.bar) 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
[4, 5]:DuplicateMethodCall: Smelly#m calls puts @foo.bar 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
[3]:UncommunicativeMethodName: Smelly#m has the name 'm' [https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Method-Name.md]
"""

Expand Down Expand Up @@ -84,7 +84,7 @@ Feature: Reek can be driven through its Task
"""
smelly.rb -- 3 warnings:
[4, 5]:DuplicateMethodCall: Smelly#m calls @foo.bar 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
[4, 5]:DuplicateMethodCall: Smelly#m calls puts(@foo.bar) 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
[4, 5]:DuplicateMethodCall: Smelly#m calls puts @foo.bar 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
[3]:UncommunicativeMethodName: Smelly#m has the name 'm' [https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Method-Name.md]
"""

Expand Down
4 changes: 2 additions & 2 deletions features/reports/json.feature
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ Feature: Report smells using simple JSON layout
"source": "smelly.rb",
"context": "Smelly#m",
"lines": [ 4, 5 ],
"message": "calls puts(@foo.bar) 2 times",
"name": "puts(@foo.bar)",
"message": "calls puts @foo.bar 2 times",
"name": "puts @foo.bar",
"wiki_link": "https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md",
"count": 2
},
Expand Down
12 changes: 6 additions & 6 deletions features/reports/reports.feature
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ Feature: Correctly formatted reports
"""
smelly.rb -- 3 warnings:
DuplicateMethodCall: Smelly#m calls @foo.bar 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
DuplicateMethodCall: Smelly#m calls puts(@foo.bar) 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
DuplicateMethodCall: Smelly#m calls puts @foo.bar 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
UncommunicativeMethodName: Smelly#m has the name 'm' [https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Method-Name.md]
"""

Expand All @@ -133,7 +133,7 @@ Feature: Correctly formatted reports
"""
smelly.rb -- 3 warnings:
[4, 5]:DuplicateMethodCall: Smelly#m calls @foo.bar 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
[4, 5]:DuplicateMethodCall: Smelly#m calls puts(@foo.bar) 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
[4, 5]:DuplicateMethodCall: Smelly#m calls puts @foo.bar 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
[3]:UncommunicativeMethodName: Smelly#m has the name 'm' [https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Method-Name.md]
"""

Expand All @@ -151,7 +151,7 @@ Feature: Correctly formatted reports
"""
smelly.rb -- 3 warnings:
smelly.rb:4: DuplicateMethodCall: Smelly#m calls @foo.bar 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
smelly.rb:4: DuplicateMethodCall: Smelly#m calls puts(@foo.bar) 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
smelly.rb:4: DuplicateMethodCall: Smelly#m calls puts @foo.bar 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
smelly.rb:3: UncommunicativeMethodName: Smelly#m has the name 'm' [https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Method-Name.md]
"""

Expand Down Expand Up @@ -191,7 +191,7 @@ Feature: Correctly formatted reports
"""
smelly.rb -- 3 warnings:
[4, 5]:DuplicateMethodCall: Smelly#m calls @foo.bar 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
[4, 5]:DuplicateMethodCall: Smelly#m calls puts(@foo.bar) 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
[4, 5]:DuplicateMethodCall: Smelly#m calls puts @foo.bar 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
[3]:UncommunicativeMethodName: Smelly#m has the name 'm' [https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Method-Name.md]
"""

Expand All @@ -208,7 +208,7 @@ Feature: Correctly formatted reports
"""
smelly.rb -- 3 warnings:
[4, 5]:DuplicateMethodCall: Smelly#m calls @foo.bar 2 times
[4, 5]:DuplicateMethodCall: Smelly#m calls puts(@foo.bar) 2 times
[4, 5]:DuplicateMethodCall: Smelly#m calls puts @foo.bar 2 times
[3]:UncommunicativeMethodName: Smelly#m has the name 'm'
"""

Expand All @@ -220,7 +220,7 @@ Feature: Correctly formatted reports
"""
smelly.rb -- 3 warnings:
DuplicateMethodCall: Smelly#m calls @foo.bar 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
DuplicateMethodCall: Smelly#m calls puts(@foo.bar) 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
DuplicateMethodCall: Smelly#m calls puts @foo.bar 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
UncommunicativeMethodName: Smelly#m has the name 'm' [https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Method-Name.md]
"""

Expand Down
4 changes: 2 additions & 2 deletions features/reports/yaml.feature
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ Feature: Report smells using simple YAML layout
lines:
- 4
- 5
message: calls puts(@foo.bar) 2 times
name: puts(@foo.bar)
message: calls puts @foo.bar 2 times
name: puts @foo.bar
count: 2
wiki_link: https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md
- smell_category: UncommunicativeName
Expand Down
Loading

0 comments on commit 66be5f2

Please sign in to comment.