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:25 +01:00
parent 6b3773a862
commit 156023b154
34 changed files with 15 additions and 37 deletions
@@ -117,4 +117,3 @@ public interface TableFormatter
return rowId - table.getId();
}
}
@@ -45,4 +45,3 @@ public enum ComputerState implements IStringSerializable
return ordinal < 0 || ordinal >= VALUES.length ? ComputerState.Off : VALUES[ordinal];
}
}
@@ -148,4 +148,3 @@ public abstract class SpeakerPeripheral implements IPeripheral
return true;
}
}
@@ -88,4 +88,3 @@ public class ItemTurtleLegacy extends ItemTurtleBase
return 0;
}
}
@@ -6,4 +6,3 @@
"modem=true,peripheral=true": { "model": "computercraft:wired_modem_full_on_peripheral" }
}
}
@@ -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.
@@ -1,4 +1,3 @@
if not shell.openTab then
printError("Requires multishell")
return
@@ -1,4 +1,3 @@
if not shell.openTab then
printError("Requires multishell")
return
@@ -1,4 +1,3 @@
local tArgs = { ... }
if #tArgs > 2 then
print("Usage: alias <alias> <program>")
@@ -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
@@ -1,4 +1,3 @@
local tArgs = { ... }
if #tArgs < 1 then
print("Usage: cd <path>")
@@ -1,4 +1,3 @@
if not commands then
printError("Requires a Command Computer.")
return
@@ -1,4 +1,3 @@
local tArgs = { ... }
if not commands then
printError("Requires a Command Computer.")
@@ -1,4 +1,3 @@
local tArgs = { ... }
if #tArgs < 2 then
print("Usage: cp <source> <destination>")
@@ -1,4 +1,3 @@
-- Get arguments
local tArgs = { ... }
if #tArgs == 0 then
@@ -1,4 +1,3 @@
local tBiomes = {
"in a forest",
"in a pine forest",
@@ -1,4 +1,3 @@
-- Display the start screen
local w, h = term.getSize()
@@ -1,4 +1,3 @@
local function printUsage()
print("Usages:")
print("gps host")
@@ -1,4 +1,3 @@
local function printUsage()
print("Usages:")
print("pastebin put <filename>")
@@ -1,4 +1,3 @@
local function printUsage()
print("Usage:")
print("wget <url> [filename]")
@@ -1,4 +1,3 @@
local sDrive = nil
local tArgs = { ... }
if #tArgs > 0 then
@@ -1,4 +1,3 @@
local function printUsage()
print("Usages:")
print("label get")
@@ -1,4 +1,3 @@
local tArgs = { ... }
-- Get all the files in the directory
@@ -1,4 +1,3 @@
local tArgs = { ... }
if #tArgs > 0 then
print("This is an interactive Lua prompt.")
@@ -1,4 +1,3 @@
local tArgs = { ... }
if #tArgs < 2 then
print("Usage: mv <source> <destination>")
@@ -1,4 +1,3 @@
local bAll = false
local tArgs = { ... }
if #tArgs > 0 and tArgs[1] == "all" then
@@ -1,4 +1,3 @@
local tArgs = { ... }
local function printUsage()
@@ -1,4 +1,3 @@
-- Find modems
local tModems = {}
for _, sModem in ipairs(peripheral.getNames()) do
@@ -1,4 +1,3 @@
local tArgs = { ... }
local function printUsage()
@@ -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
@@ -1,4 +1,3 @@
--
-- Lua IDE
-- Made by GravityScore
File diff suppressed because one or more lines are too long
@@ -23,4 +23,3 @@ describe("The type program", function()
end)
end)
+15 -3
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: