-
Notifications
You must be signed in to change notification settings - Fork 276
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
Showing
5 changed files
with
41 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# encoding: utf-8 | ||
module CodeAnalyzer | ||
# Warning is the violation. | ||
# | ||
# it indicates the filenname, line number and error message for the violation. | ||
class Warning | ||
attr_reader :filename, :line_number, :message | ||
|
||
def initialize(options={}) | ||
@filename = options[:filename] | ||
@line_number = options[:line_number].to_s | ||
@message = options[:message] | ||
end | ||
|
||
def to_s | ||
"#{@filename}:#{@line_number} - #{@message}" | ||
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
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,12 @@ | ||
require 'spec_helper' | ||
|
||
module CodeAnalyzer | ||
describe Warning do | ||
it "should return error with filename, line number and message" do | ||
Warning.new( | ||
filename: "app/models/user.rb", | ||
line_number: "100", | ||
message: "not good").to_s.should == "app/models/user.rb:100 - not good" | ||
end | ||
end | ||
end |