Skip to content

Commit

Permalink
Fix removal of leading ./
Browse files Browse the repository at this point in the history
Don't remove `a/`. Remove `.\`. Fixes #59.
  • Loading branch information
mpeterv committed Apr 17, 2016
1 parent 070cdb9 commit 4a9ebd9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions spec/cli_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -353,12 +353,12 @@ Checking spec/samples/python_code.lua 1 error
spec/samples/python_code.lua:1:6: expected '=' near '__future__'
Checking spec/samples/absent_code.lua I/O error
Checking s/samples/absent_code.lua I/O error
spec/samples/absent_code.lua: couldn't read: No such file or directory
s/samples/absent_code.lua: couldn't read: No such file or directory
Total: 0 warnings / 1 error in 1 file, couldn't check 1 file
]], get_output "spec/samples/python_code.lua spec/samples/absent_code.lua --no-config")
]], get_output "spec/samples/python_code.lua s/samples/absent_code.lua --no-config")
assert.equal(2, get_exitcode "spec/samples/python_code.lua spec/samples/absent_code.lua --no-config")
end)

Expand Down
2 changes: 1 addition & 1 deletion src/luacheck/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ patterns.]])

local function add(file)
if type(file) == "string" then
file = file:gsub("^./([^/])", "%1")
file = file:gsub("^%.[/\\]([^/])", "%1")
end

local name = args.filename or file
Expand Down

0 comments on commit 4a9ebd9

Please sign in to comment.