Skip to content

Commit

Permalink
Merge pull request #188 from TeroFrondelius/master
Browse files Browse the repository at this point in the history
lintpkgforfile() while loop replaced with for loop to fix #170
  • Loading branch information
Michael-Klassen authored Feb 21, 2017
2 parents f1db4f0 + fe0fbf3 commit 28d02ec
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Lint.jl
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,12 @@ If file is in base lint all files in base dir.
function lintpkgforfile{T<:AbstractString}(path::T, ctx::LintContext=LintContext())
path = abspath(path)
if ispath(ctx.path)
while path != "/"
if is_windows()
len = count(x -> x == '\\', path)
else
len = count(x -> x == '/', path) - 1
end
for i = 1:len
path, folder = splitdir(path)
if folder == "src"
file = joinpath(path, folder, basename(path) * ".jl")
Expand Down
3 changes: 3 additions & 0 deletions test/globals.jl
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,6 @@ msgs = lintfile("FakePackage/test/file2.jl")
# File in base julia
msgs = lintfile("FakeJulia/base/file2.jl")
@test isempty(msgs)

msgs = lintfile("filename","something")
@test msgs[1].code == :E321

0 comments on commit 28d02ec

Please sign in to comment.