Create more work for myself

This ensures no lines start with an empty line, and all files finish
with exactly one "\n".
This commit is contained in:
SquidDev 2020-05-11 16:08:23 +01:00
parent 6b3773a862
commit 156023b154
34 changed files with 15 additions and 37 deletions

View File

@ -117,4 +117,3 @@ default int display( TableBuilder table )
return rowId - table.getId(); return rowId - table.getId();
} }
} }

View File

@ -45,4 +45,3 @@ public static ComputerState valueOf( int ordinal )
return ordinal < 0 || ordinal >= VALUES.length ? ComputerState.Off : VALUES[ordinal]; return ordinal < 0 || ordinal >= VALUES.length ? ComputerState.Off : VALUES[ordinal];
} }
} }

View File

@ -148,4 +148,3 @@ private synchronized boolean playSound( ILuaContext context, String name, float
return true; return true;
} }
} }

View File

@ -88,4 +88,3 @@ public int getFuelLevel( @Nonnull ItemStack stack )
return 0; return 0;
} }
} }

View File

@ -6,4 +6,3 @@
"modem=true,peripheral=true": { "model": "computercraft:wired_modem_full_on_peripheral" } "modem=true,peripheral=true": { "model": "computercraft:wired_modem_full_on_peripheral" }
} }
} }

View File

@ -1,4 +1,3 @@
ComputerCraft was created by Daniel "dan200" Ratcliffe, with additional code by Aaron "Cloudy" Mills. ComputerCraft was created by Daniel "dan200" Ratcliffe, with additional code by Aaron "Cloudy" Mills.
Thanks to nitrogenfingers, GopherATL and RamiLego for program contributions. Thanks to nitrogenfingers, GopherATL and RamiLego for program contributions.
Thanks to Mojang, the Forge team, and the MCP team. Thanks to Mojang, the Forge team, and the MCP team.

View File

@ -1,4 +1,3 @@
if not shell.openTab then if not shell.openTab then
printError("Requires multishell") printError("Requires multishell")
return return

View File

@ -1,4 +1,3 @@
if not shell.openTab then if not shell.openTab then
printError("Requires multishell") printError("Requires multishell")
return return

View File

@ -1,4 +1,3 @@
local tArgs = { ... } local tArgs = { ... }
if #tArgs > 2 then if #tArgs > 2 then
print("Usage: alias <alias> <program>") print("Usage: alias <alias> <program>")

View File

@ -1,4 +1,3 @@
local tApis = {} local tApis = {}
for k, v in pairs(_G) do for k, v in pairs(_G) do
if type(k) == "string" and type(v) == "table" and k ~= "_G" then if type(k) == "string" and type(v) == "table" and k ~= "_G" then

View File

@ -1,4 +1,3 @@
local tArgs = { ... } local tArgs = { ... }
if #tArgs < 1 then if #tArgs < 1 then
print("Usage: cd <path>") print("Usage: cd <path>")

View File

@ -1,4 +1,3 @@
if not commands then if not commands then
printError("Requires a Command Computer.") printError("Requires a Command Computer.")
return return

View File

@ -1,4 +1,3 @@
local tArgs = { ... } local tArgs = { ... }
if not commands then if not commands then
printError("Requires a Command Computer.") printError("Requires a Command Computer.")

View File

@ -1,4 +1,3 @@
local tArgs = { ... } local tArgs = { ... }
if #tArgs < 2 then if #tArgs < 2 then
print("Usage: cp <source> <destination>") print("Usage: cp <source> <destination>")

View File

@ -1,4 +1,3 @@
-- Get arguments -- Get arguments
local tArgs = { ... } local tArgs = { ... }
if #tArgs == 0 then if #tArgs == 0 then

View File

@ -1,4 +1,3 @@
local tBiomes = { local tBiomes = {
"in a forest", "in a forest",
"in a pine forest", "in a pine forest",

View File

@ -1,4 +1,3 @@
-- Display the start screen -- Display the start screen
local w, h = term.getSize() local w, h = term.getSize()

View File

@ -1,4 +1,3 @@
local function printUsage() local function printUsage()
print("Usages:") print("Usages:")
print("gps host") print("gps host")

View File

@ -1,4 +1,3 @@
local function printUsage() local function printUsage()
print("Usages:") print("Usages:")
print("pastebin put <filename>") print("pastebin put <filename>")

View File

@ -1,4 +1,3 @@
local function printUsage() local function printUsage()
print("Usage:") print("Usage:")
print("wget <url> [filename]") print("wget <url> [filename]")

View File

@ -1,4 +1,3 @@
local sDrive = nil local sDrive = nil
local tArgs = { ... } local tArgs = { ... }
if #tArgs > 0 then if #tArgs > 0 then

View File

@ -1,4 +1,3 @@
local function printUsage() local function printUsage()
print("Usages:") print("Usages:")
print("label get") print("label get")

View File

@ -1,4 +1,3 @@
local tArgs = { ... } local tArgs = { ... }
-- Get all the files in the directory -- Get all the files in the directory

View File

@ -1,4 +1,3 @@
local tArgs = { ... } local tArgs = { ... }
if #tArgs > 0 then if #tArgs > 0 then
print("This is an interactive Lua prompt.") print("This is an interactive Lua prompt.")

View File

@ -1,4 +1,3 @@
local tArgs = { ... } local tArgs = { ... }
if #tArgs < 2 then if #tArgs < 2 then
print("Usage: mv <source> <destination>") print("Usage: mv <source> <destination>")

View File

@ -1,4 +1,3 @@
local bAll = false local bAll = false
local tArgs = { ... } local tArgs = { ... }
if #tArgs > 0 and tArgs[1] == "all" then if #tArgs > 0 and tArgs[1] == "all" then

View File

@ -1,4 +1,3 @@
local tArgs = { ... } local tArgs = { ... }
local function printUsage() local function printUsage()

View File

@ -1,4 +1,3 @@
-- Find modems -- Find modems
local tModems = {} local tModems = {}
for _, sModem in ipairs(peripheral.getNames()) do for _, sModem in ipairs(peripheral.getNames()) do

View File

@ -1,4 +1,3 @@
local tArgs = { ... } local tArgs = { ... }
local function printUsage() local function printUsage()

View File

@ -1,4 +1,3 @@
local tArgs = { ... } local tArgs = { ... }
if #tArgs < 1 then if #tArgs < 1 then
print("Usage: type <path>") print("Usage: type <path>")
@ -15,4 +14,3 @@ if fs.exists(sPath) then
else else
print("No such path") print("No such path")
end end

View File

@ -1,4 +1,3 @@
-- --
-- Lua IDE -- Lua IDE
-- Made by GravityScore -- Made by GravityScore

View File

@ -23,4 +23,3 @@ describe("The type program", function()
end) end)
end) end)

View File

@ -10,8 +10,13 @@ for path in pathlib.Path("src").glob("**/*"):
continue continue
with path.open(encoding="utf-8") as file: with path.open(encoding="utf-8") as file:
has_dos, has_trailing, needs_final = False, False, False has_dos, has_trailing, first, count = False, False, 0, True
for i, line in enumerate(file): for i, line in enumerate(file):
if first:
first = False
if line.strip() == "":
print("%s has empty first line" % path)
if len(line) >= 2 and line[-2] == "\r" and line[-1] == "\n" and not has_line: if len(line) >= 2 and line[-2] == "\r" and line[-1] == "\n" and not has_line:
print("%s has contains '\\r\\n' on line %d" % (path, i + 1)) print("%s has contains '\\r\\n' on line %d" % (path, i + 1))
problems = has_dos = True problems = has_dos = True
@ -20,8 +25,15 @@ for path in pathlib.Path("src").glob("**/*"):
print("%s has trailing whitespace on line %d" % (path, i + 1)) print("%s has trailing whitespace on line %d" % (path, i + 1))
problems = has_trailing = True problems = has_trailing = True
if line is not None and len(line) >= 1 and line[-1] != "\n": if len(line) == 0 or line[-1] != "\n":
print("%s should end with '\\n'" % path) count = 0
elif line.strip() == "":
count += 1
else:
count = 1
if count != 1:
print("%s should have 1 trailing lines, but has %d" % (path, count))
problems = True problems = True
if problems: if problems: