-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Dmitry Stoletov <[email protected]>
- Loading branch information
Showing
2 changed files
with
126 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
local function brew_coffee(machine) | ||
return (machine and machine.is_loaded) and "coffee brewing" or "fill your water" | ||
end | ||
|
||
-- good | ||
if test then break end | ||
|
||
-- good | ||
if not ok then return nil, "this failed for this reason: " .. reason end | ||
|
||
-- good | ||
use_callback(x, function(k) return k.last end) | ||
|
||
-- good | ||
if test then | ||
return false | ||
end | ||
|
||
-- bad | ||
if test < 1 and do_complicated_function(test) == false or seven == 8 and nine == 10 then do_other_complicated_function() end | ||
|
||
-- good | ||
if test < 1 and do_complicated_function(test) == false or seven == 8 and nine == 10 then | ||
do_other_complicated_function() | ||
return false | ||
end | ||
|
||
-- bad | ||
local whatever = "sure"; | ||
a = 1; b = 2 | ||
|
||
-- good | ||
local whatever = "sure" | ||
a = 1 | ||
b = 2 | ||
|
||
--bad | ||
-- good | ||
|
||
-- bad | ||
local x = y*9 | ||
local numbers={1,2,3} | ||
numbers={1 , 2 , 3} | ||
numbers={1 ,2 ,3} | ||
local strings = { "hello" | ||
, "Lua" | ||
, "world" | ||
} | ||
dog.set( "attr",{ | ||
age="1 year", | ||
breed="Bernese Mountain Dog" | ||
}) | ||
|
||
-- good | ||
local x = y * 9 | ||
local numbers = {1, 2, 3} | ||
local strings = { | ||
"hello", | ||
"Lua", | ||
"world", | ||
} | ||
dog.set("attr", { | ||
age = "1 year", | ||
breed = "Bernese Mountain Dog", | ||
}) |
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,61 @@ | ||
local function brew_coffee(machine) | ||
return (machine and machine.is_loaded) and "coffee brewing" or "fill your water" | ||
end | ||
|
||
-- good | ||
if test then | ||
break | ||
end | ||
|
||
-- good | ||
if not ok then | ||
return nil, "this failed for this reason: " .. reason | ||
end | ||
|
||
-- good | ||
use_callback(x, function(k) | ||
return k.last | ||
end) | ||
|
||
-- good | ||
if test then | ||
return false | ||
end | ||
|
||
-- bad | ||
if test < 1 and do_complicated_function(test) == false or seven == 8 and nine == 10 then | ||
do_other_complicated_function() | ||
end | ||
|
||
-- good | ||
if test < 1 and do_complicated_function(test) == false or seven == 8 and nine == 10 then | ||
do_other_complicated_function() | ||
return false | ||
end | ||
|
||
-- bad | ||
local whatever = "sure" | ||
a = 1 | ||
b = 2 | ||
|
||
-- good | ||
local whatever = "sure" | ||
a = 1 | ||
b = 2 | ||
|
||
-- bad | ||
-- good | ||
|
||
-- bad | ||
local x = y * 9 | ||
local numbers = {1, 2, 3} | ||
numbers = {1, 2, 3} | ||
numbers = {1, 2, 3} | ||
local strings = {"hello", "Lua", "world"} | ||
dog.set("attr", {age = "1 year", breed = "Bernese Mountain Dog"}) | ||
|
||
-- good | ||
local x = y * 9 | ||
local numbers = {1, 2, 3} | ||
local strings = {"hello", "Lua", "world"} | ||
dog.set("attr", {age = "1 year", breed = "Bernese Mountain Dog"}) |