Skip to content

Commit

Permalink
Fix (mostly trailing) white spaces, and attempt to repair the script.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alberth289346 committed Jan 19, 2015
1 parent daf8d07 commit 4802e64
Show file tree
Hide file tree
Showing 17 changed files with 52 additions and 50 deletions.
35 changes: 17 additions & 18 deletions CONTRIBUTING.txt
@@ -1,8 +1,8 @@
TELL OTHER DEVS WHAT YOUR WORKING ON

When you start working on a fix/enhancement for an open issue please always
post a comment in this issue's discussion to tell other devs that you have
started working on it so that they won't waste any of their free time by
post a comment in this issue's discussion to tell other devs that you have
started working on it so that they won't waste any of their free time by
working on their own fix/enhancement for it.

If there isn't an open issue discussion for a bug fix/enhancement you want
Expand Down Expand Up @@ -85,35 +85,34 @@ First Time
3. Ensure you have a git client. (http://windows.github.com or
http://mac.github.com)
4. Clone your fork to your computer
- If using github client, run Git Shell
- git clone https://github.com/mygithubuser/CorsixTH.git
- If using github client, run Git Shell
- git clone https://github.com/mygithubuser/CorsixTH.git
5. Add upstream remote
- git remote add upstream https://github.com/CorsixTH/CorsixTH.git
- git remote add upstream https://github.com/CorsixTH/CorsixTH.git

Every Time
6. Sync your master branch with the CorisxTH repository's master branch
- git fetch upstream
- git rebase upstream/master
7. Makesure no one is already working on the issue you
want to work on.
7. Make sure no one is already working on the issue you want to work on.
8. Tell other developers that you've started/will start working on this issue
by posting a comment in its existing issue discussion or if there's no existing
discussion for it then please open a new issue discussion for it and tell other
devs here that your working on it.
9. Create feature branch
- git branch myfeature upstream/master
- git branch myfeature upstream/master
10. Checkout your feature branch
- git checkout myfeature
- git checkout myfeature
11. Make your changes
12. Review your changes
- git diff
(each file) - git add
- git diff --check
Check there's no white spaces.
- git commit
Write an informative commit message and save
- git diff
(each file) - git add
- git diff --check
Check there's no white spaces.
- git commit
Write an informative commit message and save
13. Push your changes to your fork
- git push origin myfeature
- git push origin myfeature
14. Create a pull request
(https://github.com/mygithubuser/CorsixTH/compare/CorsixTH:master...myfeature)

Expand All @@ -130,8 +129,8 @@ If it takes a long time between when you start your feature and when you finish
there might be other important changes other people are making to CorsixTH. It
is a good idea to make sure your code will still operate correctly with the
latest changes. To do this:
- git fetch upstream
- git rebase upstream/master
- git fetch upstream
- git rebase upstream/master
What this does is downloads all the changes from CorsixTH\CorsixTH since you
started, and pretends that all your changes were made after them. If there are
conflicts, for example if someone else changed the same line in the same file
Expand Down
4 changes: 2 additions & 2 deletions CorsixTH/Lua/calls_dispatcher.lua
Expand Up @@ -334,8 +334,8 @@ function CallsDispatcher:answerCall(staff)
local min_call = nil
local min_key = nil
assert(not staff.on_call, "Staff should be idea before he can answer another call")
assert(staff.hospital, "Staff should still be a member of the hospital to answer a call");
assert(staff.hospital, "Staff should still be a member of the hospital to answer a call");

if staff.humanoid_class == "Handyman" then
staff:searchForHandymanTask()
return true
Expand Down
2 changes: 1 addition & 1 deletion CorsixTH/Lua/class.lua
Expand Up @@ -23,7 +23,7 @@ SOFTWARE. --]]
-- class "Name"
-- OR
-- class "Name" (SuperclassName)
--
--
-- ---@type Name
-- local Name = _G["Name"]
--
Expand Down
8 changes: 4 additions & 4 deletions CorsixTH/Lua/config_finder.lua
Expand Up @@ -220,13 +220,13 @@ if needs_rewrite then
----------------------------------------------- OPTIONS MENU ---------------------------------------------------
--These settings can also be changed from within the game from the options menu
-------------------------------------------------------------------------------------------------------------------------
-- Sounds: By default enabled and set at level 0.5
-- ]=] .. '\n' ..
-- Sounds: By default enabled and set at level 0.5
-- ]=] .. '\n' ..
'play_sounds = ' .. tostring(config_values.play_sounds) .. '\n' ..
'sound_volume = ' .. tostring(config_values.sound_volume) .. '\n' .. [=[
-------------------------------------------------------------------------------------------------------------------------
-- Announcements: By default set at level 0.5
-- Announcements: By default set at level 0.5
-- ]=] .. '\n' ..
'play_announcements = ' .. tostring(config_values.play_announcements) .. '\n' ..
'announcement_volume = ' .. tostring(config_values.announcement_volume) .. '\n' .. [=[
Expand All @@ -251,7 +251,7 @@ if needs_rewrite then
-------------------------------------------------------------------------------------------------------------------------
-- Scrolling Momentum.
-- Determines the amount of momentum when scrolling the map with the mouse.
-- This should be a value between 0 and 1 where 0 is no momentum
-- This should be a value between 0 and 1 where 0 is no momentum
-- ]=] .. '\n' ..
'scrolling_momentum = ' .. tostring(config_values.scrolling_momentum) .. '\n' .. [=[
Expand Down
6 changes: 3 additions & 3 deletions CorsixTH/Lua/debug_script.lua
@@ -1,10 +1,10 @@
---
---
-- Calling "execute script" while CorsixTH is running will execute the latest
-- code in this script so you don't need to restart CorsixTH.
--
--
-- Like with the console you can reference clicked humanoids with the underscore
-- global variable so for example: _:die() will make a clicked patient die.
--
--
-- The run time App class instance can be referenced with its global variable
-- "TheApp", with it you can reference other run time class instances like:
-- TheApp.world
Expand Down
2 changes: 1 addition & 1 deletion CorsixTH/Lua/dialogs/place_objects.lua
Expand Up @@ -655,7 +655,7 @@ function UIPlaceObjects:setBlueprintCell(x, y)
is_object_allowed = map:getCellFlags(x, y, flags)[flag]
end

-- Having checked if the tile is good set its blueprint appearance flag:
-- Having checked if the tile is good set its blueprint appearance flag:
if is_object_allowed then
if not tile.invisible then
map:setCell(x, y, 4, good_tile)
Expand Down
2 changes: 1 addition & 1 deletion CorsixTH/Lua/dialogs/resizables/main_menu.lua
Expand Up @@ -103,7 +103,7 @@ function UIMainMenu:buttonContinueGame()
else
local error = _S.errors.load_prefix .. _S.errors.no_games_to_contine
print(error)
self.ui.app.ui:addWindow(UIInformation(self.ui, {error}))
self.ui.app.ui:addWindow(UIInformation(self.ui, {error}))
end
end
Expand Down
2 changes: 1 addition & 1 deletion CorsixTH/Lua/entities/staff.lua
Expand Up @@ -386,7 +386,7 @@ end
function Staff:die()
self:setHospital(nil)
if self.task then
-- If the staff member had a task outstanding, unassigning them from that task.
-- If the staff member had a task outstanding, unassigning them from that task.
-- Tasks with no handyman assigned will be eligable for reassignment by the hospital.
self.task.assignedHandyman = nil
self.task = nil
Expand Down
2 changes: 1 addition & 1 deletion CorsixTH/Lua/game_ui.lua
Expand Up @@ -254,7 +254,7 @@ function GameUI:onKeyUp(rawchar)
return
end
-- Guess that the "Speed Up" key was released because the
-- Guess that the "Speed Up" key was released because the
-- code parameter can't provide UTF-8 key codes:
self.speed_up_key_pressed = false
if self.app.world:isCurrentSpeed("Speed Up") then
Expand Down
2 changes: 1 addition & 1 deletion CorsixTH/Lua/humanoid_actions/die.lua
Expand Up @@ -304,7 +304,7 @@ local function action_die_start(action, humanoid)
--so this animation is ended early, action_die_tick will then use the standard male fall animation:
fall_anim_duration = 21
end
-- Bloaty head patients can't go to hell because they don't have a
-- Bloaty head patients can't go to hell because they don't have a
-- "transform to standard male"/"fall into lava hole" animation.
if humanoid:isMalePatient() and humanoid.disease.id ~= "bloaty_head" then
if math.random(1, 100) <= 65 then
Expand Down
2 changes: 1 addition & 1 deletion CorsixTH/Lua/objects/gates_to_hell.lua
Expand Up @@ -24,7 +24,7 @@ object.id = "gates_to_hell"
object.name = "Gates to Hell"
object.thob = 48
object.ticks = true
object.walk_in_to_use = true
object.walk_in_to_use = true
object.idle_animations = {
south = 1602,
Expand Down
12 changes: 6 additions & 6 deletions CorsixTH/Lua/rooms/operating_theatre.lua
Expand Up @@ -120,7 +120,7 @@ function OperatingTheatreRoom:commandEnteringStaff(staff)
-- Resume operation if already ongoing
if self:isOperating() then
local surgeon1 = next(self.staff_member_set)
local surgeon1 = next(self.staff_member_set)
local ongoing_action = surgeon1.action_queue[1]
assert(ongoing_action.name == "multi_use_object")
Expand Down Expand Up @@ -208,8 +208,8 @@ function OperatingTheatreRoom:buildTableAction1(surgeon1, patient, operation_tab
}
end
--! Builds the second operation action (i.e. with the surgeon whose we
--! see the back). Called either when the operation starts or when the
--! Builds the second operation action (i.e. with the surgeon whose we
--! see the back). Called either when the operation starts or when the
--! operation is resumed after interruption caused by the picking up of
--! the second surgeon.
--!param multi_use (action): the first operation action (built with via buildTableAction1()).
Expand All @@ -234,8 +234,8 @@ function OperatingTheatreRoom:buildTableAction2(multi_use, operation_table_b)
}
end
--! Sends the surgeon to the nearest operation sink ("op_sink1")
--! and makes him wash his hands
--! Sends the surgeon to the nearest operation sink ("op_sink1")
--! and makes him wash his hands
--!param at_front (boolean): If true, add the actions at the front the action queue.
--! Add the actions at the end of the queue otherwise.
--! Default value is true.
Expand Down Expand Up @@ -363,7 +363,7 @@ function OperatingTheatreRoom:onHumanoidLeave(humanoid)
if class.is(humanoid, Patient) then
-- Turn off x-ray viewer
-- (FIXME: would be better when patient dress back?)
-- (FIXME: would be better when patient dress back?)
self:setXRayOn(false)
local surgeon1 = next(self.staff_member_set)
Expand Down
2 changes: 1 addition & 1 deletion CorsixTH/Lua/rooms/scanner_room.lua
Expand Up @@ -133,7 +133,7 @@ end
function ScannerRoom:makeHumanoidLeave(humanoid)
if humanoid.action_queue[1].name == "use_object" and humanoid.action_queue[1].object == self.world:findObjectNear(humanoid, "scanner") then
humanoid.action_queue[1].after_use = nil
end
end
self:makeHumanoidDressIfNecessaryAndThenLeave(humanoid)
end
Expand Down
4 changes: 2 additions & 2 deletions CorsixTH/Lua/ui.lua
Expand Up @@ -217,7 +217,7 @@ function UI:UI(app, minimal)
end
function UI:runDebugScript()
print("Executing Debug Script...")
print("Executing Debug Script...")
local path_sep = package.config:sub(1, 1)
local lua_dir = debug.getinfo(1, "S").source:sub(2, -8)
_ = TheApp.ui and TheApp.ui.debug_cursor_entity
Expand Down Expand Up @@ -798,7 +798,7 @@ function UI:afterLoad(old, new)
self:removeKeyHandler({"alt", "f4"}, self, self.quit)
self:addKeyHandler({"alt", "f4"}, self, self.exitApplication)
end

if old < 100 then
self:removeKeyHandler({"alt", "enter"}, self)
self:addKeyHandler({"alt", "Return"}, self, self.toggleFullscreen)
Expand Down
4 changes: 2 additions & 2 deletions CorsixTH/Lua/world.lua
Expand Up @@ -981,7 +981,7 @@ function World:setSpeed(speed)
local numerator, denominator = unpack(tick_rates[speed])
self.hours_per_tick = numerator
self.tick_rate = denominator

if was_paused then
TheApp.audio:onEndPause()
end
Expand Down Expand Up @@ -2010,7 +2010,7 @@ function World:isFootprintTileBuildableOrPassable(x, y, tile, footprint, require
end
end
---
---
-- Check that pathfinding still works, i.e. that placing the object
-- wouldn't disconnect one part of the hospital from another. To do
-- this, we provisionally mark the footprint as unpassable (as it will
Expand Down
4 changes: 2 additions & 2 deletions scripts/check_lua_classes.py
Expand Up @@ -9,7 +9,7 @@
#Regex: ^class "(.+)".*\n\n(?!---@type \1\nlocal \1 = _G\["\1"])
regex = r"^class \"(.+)\".*\n\n(?!---@type \1\nlocal \1 = _G\[\"\1\"])"

print_root_regex = re.compile("Lua.*")
print_root_regex = re.compile("Lua.*")
script_dir = os.getcwd() + "/../CorsixTH/Lua"
ignored = os.listdir(script_dir + "/languages")
problem_found = False
Expand All @@ -33,5 +33,5 @@
print("local Name = _G[\"Name\"]")
print("-----------------------------------------\n")
sys.exit(1)

sys.exit(0)
9 changes: 6 additions & 3 deletions scripts/check_trailing_whitespaces.py
Expand Up @@ -15,13 +15,16 @@

def has_trailing_whitespaces(path):
""" Returns whether |path| has trailing whitespaces. """
for line in open(path, 'r'):
handle = open(path, 'r')
for line in handle:
for idx in range(-1, -len(line) - 1, -1):
if line[idx] == '\n' or line[idx] == '\r':
if line[idx] in ('\n', '\r'):
continue
if line[idx] == ' ':
if line[idx] in (' ', '\t'):
handle.close()
return True
break
handle.close()
return False

if (len(sys.argv) > 2):
Expand Down

0 comments on commit 4802e64

Please sign in to comment.