-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #207 from crystal-ameba/release/0.14.0
Release 0.14.0
- Loading branch information
Showing
106 changed files
with
2,045 additions
and
448 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
name: ameba | ||
version: 0.13.4 | ||
version: 0.14.0 | ||
|
||
authors: | ||
- Vitalii Elenhaupt <[email protected]> | ||
|
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,17 @@ | ||
require "../../../spec_helper" | ||
|
||
module Ameba::AST | ||
describe TopLevelNodesVisitor do | ||
describe "#require_nodes" do | ||
it "returns require node" do | ||
source = Source.new %( | ||
require "foo" | ||
def bar; end | ||
) | ||
visitor = TopLevelNodesVisitor.new(source.ast) | ||
visitor.require_nodes.size.should eq 1 | ||
visitor.require_nodes.first.to_s.should eq %q(require "foo") | ||
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
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,48 @@ | ||
require "../../../spec_helper" | ||
|
||
module Ameba::Rule::Lint | ||
subject = DuplicatedRequire.new | ||
|
||
describe DuplicatedRequire do | ||
it "passes if there are no duplicated requires" do | ||
source = Source.new %( | ||
require "math" | ||
require "big" | ||
require "big/big_decimal" | ||
) | ||
subject.catch(source).should be_valid | ||
end | ||
|
||
it "reports if there are a duplicated requires" do | ||
source = Source.new %( | ||
require "big" | ||
require "math" | ||
require "big" | ||
) | ||
subject.catch(source).should_not be_valid | ||
end | ||
|
||
it "reports rule, pos and message" do | ||
source = Source.new %( | ||
require "./thing" | ||
require "./thing" | ||
require "./another_thing" | ||
require "./another_thing" | ||
), "source.cr" | ||
|
||
subject.catch(source).should_not be_valid | ||
|
||
issue = source.issues.first | ||
issue.rule.should_not be_nil | ||
issue.location.to_s.should eq "source.cr:2:1" | ||
issue.end_location.to_s.should eq "" | ||
issue.message.should eq "Duplicated require of `./thing`" | ||
|
||
issue = source.issues.last | ||
issue.rule.should_not be_nil | ||
issue.location.to_s.should eq "source.cr:4:1" | ||
issue.end_location.to_s.should eq "" | ||
issue.message.should eq "Duplicated require of `./another_thing`" | ||
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
Oops, something went wrong.