Skip to content

Commit 2fa5c4c

Browse files
committed
Add example file demonstrating whitespace issues
While at it, fix samples file count for cli_spec.lua accordingly.
1 parent 6dd3b2c commit 2fa5c4c

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

spec/cli_spec.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -934,7 +934,7 @@ spec/samples/python_code.lua:1:6: (E011) expected '=' near '__future__'
934934
end)
935935

936936
it("expands folders", function()
937-
assert.matches("^Total: %d+ warnings / %d+ errors in 20 files\n$", get_output "spec/samples -qqq --no-config")
937+
assert.matches("^Total: %d+ warnings / %d+ errors in 21 files\n$", get_output "spec/samples -qqq --no-config")
938938
end)
939939

940940
it("uses --include-files when expanding folders", function()

spec/samples/bad_whitespace.lua

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
-- Examples of whitespace formatting violations
2+
3+
local function trailing_whitespace_in_code()
4+
return "This is awful"
5+
end
6+
7+
local function trailing_whitespace_in_comment()
8+
-- Less awful, but...
9+
return "Still bad"
10+
end
11+
12+
local function trailing_whitespace_mixed()
13+
return "Not much better" -- You bet!
14+
end
15+
16+
local function whitespace_only_lines()
17+
18+
19+
20+
21+
return "Lost in space"
22+
end
23+
24+
local function inconsistent_indentation()
25+
return "Don't do this"
26+
end
27+
28+
return { -- fake "module" table
29+
trailing_whitespace_in_code,
30+
trailing_whitespace_in_comment,
31+
trailing_whitespace_mixed,
32+
whitespace_only_lines,
33+
inconsistent_indentation,
34+
}

0 commit comments

Comments
 (0)