-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Shujon Mollah
committed
Jun 30, 2015
1 parent
289e4b2
commit e666625
Showing
22 changed files
with
351 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
Feature: (formatter) progress | ||
|
||
Scenario: happy path | ||
Given a file named "foo/good.feature" with: | ||
""" | ||
Feature: good | ||
Scenario: correctly indented | ||
Scenario: correctly indented | ||
Then boom | ||
""" | ||
Given a file named "foo/good_too.feature" with: | ||
""" | ||
Feature: good too | ||
Scenario: correctly indented | ||
Scenario: correctly indented | ||
Then boom | ||
""" | ||
And a file named "config/good.yml" with: | ||
""" | ||
AllCheckers: | ||
Formatters: | ||
- Progress | ||
""" | ||
When I run `greener --config config/good.yml` | ||
Then the output should contain: | ||
""" | ||
.. | ||
2 file(s) inspected, no offenses detected | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module Greener | ||
module Error | ||
class Standard < StandardError; end | ||
|
||
class LintFailed < Standard; end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
module Greener | ||
module Formatter | ||
# Abstract base class for formatter, implements all public API methods. | ||
# | ||
# ## Method Invocation Order | ||
# | ||
# For example, when Greener inspects 2 files, | ||
# the invocation order should be like this: | ||
# | ||
# * `#initialize` | ||
# * `#started` | ||
# * `#file_started` | ||
# * `#file_finished` | ||
# * `#file_started` | ||
# * `#file_finished` | ||
# * `#finished` | ||
class BaseFormatter | ||
def initialize(files) | ||
@files = files | ||
end | ||
|
||
def started | ||
end | ||
|
||
def file_started | ||
end | ||
|
||
def file_finished(_violations) | ||
end | ||
|
||
def finished(_violations) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
require "greener/formatter/base_formatter" | ||
|
||
module Greener | ||
module Formatter | ||
# Print progress in real-time | ||
class Progress < BaseFormatter | ||
def file_finished(violations) | ||
if violations.empty? | ||
print "." | ||
else | ||
print "F" | ||
end | ||
end | ||
|
||
def finished(_violations) | ||
puts "" | ||
puts "" | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
require "greener/formatter/base_formatter" | ||
|
||
module Greener | ||
module Formatter | ||
# Prints violation info that includes file, line number, text of the line, and message | ||
class SimpleText < BaseFormatter | ||
def finished(violations) | ||
violations.each do |violation| | ||
puts "#{violation[:file]}:#{violation[:line]}" | ||
puts "#{violation[:text_of_line]}" | ||
puts "#{' ' * (violation[:column] - 1)}^^^ #{violation[:message]}" | ||
puts "" | ||
end | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.