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();
}
}

View File

@ -45,4 +45,3 @@ public static ComputerState valueOf( int 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;
}
}

View File

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

View File

@ -6,4 +6,3 @@
"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.
Thanks to nitrogenfingers, GopherATL and RamiLego for program contributions.
Thanks to Mojang, the Forge team, and the MCP team.

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -10,8 +10,13 @@ for path in pathlib.Path("src").glob("**/*"):
continue
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):
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:
print("%s has contains '\\r\\n' on line %d" % (path, i + 1))
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))
problems = has_trailing = True
if line is not None and len(line) >= 1 and line[-1] != "\n":
print("%s should end with '\\n'" % path)
if len(line) == 0 or line[-1] != "\n":
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
if problems: