Skip to content

Commit 8d7e066

Browse files
Adds OpenDream as a CI lint (ParadiseSS13#21099)
* Initial Commit * Makes the CI work (maybe) * Of course CI has a hissy fit * Actually fixes the codebase * Oops 1 * Tweaks * oops
1 parent e1f530f commit 8d7e066

File tree

31 files changed

+116
-66
lines changed

31 files changed

+116
-66
lines changed

.github/workflows/ci.yml

+12
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,18 @@ jobs:
3737
with:
3838
outputFile: output-annotations.txt
3939

40+
odlint:
41+
name: Lint with OpenDream
42+
runs-on: ubuntu-20.04
43+
steps:
44+
- uses: actions/checkout@v3
45+
- name: Setup OD
46+
run: |
47+
bash tools/ci/setup_od.sh
48+
- name: Run OD
49+
run: |
50+
bash tools/ci/run_od.sh
51+
4052
compile_all_maps:
4153
name: Compile All Maps
4254
runs-on: ubuntu-20.04

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,5 @@ __pycache__/
5555

5656
# Tools some of us like to keep in the repo
5757
dmm-tools.exe
58+
OpenDream
59+
paradise.json

__odlint.dm

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// This file is included right at the start of the DME.
2+
// Its purpose is to enable multiple lints (pragmas) that are supported by OpenDream to better validate the codebase
3+
// These are essentially nitpicks the DM compiler should pick up on but doesnt
4+
5+
#ifndef SPACEMAN_DMM
6+
#ifdef OPENDREAM
7+
/*
8+
For the person who asks
9+
"AA, why are these in their own file?"
10+
Quite simple
11+
1. I can codeown that file
12+
2. You need to do it with an include as a hack to avoid SpacemanDMM evaluating the #pragma lines, even if its outside a block it cares about
13+
*/
14+
#include "tools/ci/lints.dm"
15+
#endif
16+
#endif

code/__HELPERS/type2type.dm

+1-5
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
var/char = copytext(hex, i, i + 1)
2222
switch(char)
2323
if("0")
24-
//Apparently, switch works with empty statements, yay! If that doesn't work, blame me, though. -- Urist
24+
pass() // Do nothing
2525
if("9", "8", "7", "6", "5", "4", "3", "2", "1")
2626
num += text2num(char) * 16 ** power
2727
if("a", "A")
@@ -103,8 +103,6 @@
103103
return "northwest"
104104
if(10.0)
105105
return "southwest"
106-
else
107-
return
108106

109107
//Turns text into proper directions
110108
/proc/text2dir(direction)
@@ -125,8 +123,6 @@
125123
return 6
126124
if("SOUTHWEST")
127125
return 10
128-
else
129-
return
130126

131127
//Converts an angle (degrees) into an ss13 direction
132128
/proc/angle2dir(degree)

code/controllers/subsystem/SSacid.dm

+1-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ SUBSYSTEM_DEF(acid)
3434
return
3535
continue
3636

37-
if(O.acid_level && O.acid_processing())
38-
else
37+
if(!(O.acid_level && O.acid_processing()))
3938
O.cut_overlay(GLOB.acid_overlay, TRUE)
4039
processing -= O
4140

code/game/gamemodes/revolution/revolution.dm

+1-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@
177177
/datum/game_mode/revolution/latespawn(mob/living/carbon/human/player)
178178
..()
179179
var/datum/mind/player_mind = player.mind
180-
var/static/list/real_command_positions = GLOB.command_positions.Copy() - "Nanotrasen Representative"
180+
var/list/real_command_positions = GLOB.command_positions.Copy() - "Nanotrasen Representative"
181181
if(player_mind && (player_mind.assigned_role in real_command_positions))
182182
for(var/datum/mind/rev_mind in head_revolutionaries)
183183
mark_for_death(rev_mind, player_mind)

code/game/machinery/doors/airlock.dm

-1
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,6 @@ GLOBAL_LIST_EMPTY(airlock_emissive_underlays)
390390
state = AIRLOCK_CLOSED
391391
else
392392
state = AIRLOCK_OPEN
393-
if(AIRLOCK_OPEN, AIRLOCK_CLOSED)
394393
if(AIRLOCK_DENY, AIRLOCK_OPENING, AIRLOCK_CLOSING, AIRLOCK_EMAG)
395394
icon_state = "nonexistenticonstate" //MADNESS
396395

code/game/objects/effects/spawners/random_spawners.dm

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
var/thing_to_place = pickweight(result)
2424
if(ispath(thing_to_place, /datum/nothing))
2525
// Nothing.
26+
qdel(src) // See line 13, this needs moving to /Initialize() so we can use the qdel hint already
27+
return
2628
else if(ispath(thing_to_place, /turf))
2729
T.ChangeTurf(thing_to_place)
2830
else

code/game/objects/items/blueprints.dm

-2
Original file line numberDiff line numberDiff line change
@@ -327,8 +327,6 @@
327327
switch(check_tile_is_border(NT,dir))
328328
if(BORDER_NONE)
329329
pending+=NT
330-
if(BORDER_BETWEEN)
331-
//do nothing, may be later i'll add 'rejected' list as optimization
332330
if(BORDER_2NDTILE)
333331
found+=NT //tile included to new area, but we dont seek more
334332
if(BORDER_SPACE)

code/game/objects/obj_defense.dm

+2-5
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,8 @@
2323
/obj/proc/run_obj_armor(damage_amount, damage_type, damage_flag = 0, attack_dir, armour_penetration_flat = 0, armour_penetration_percentage = 0)
2424
if(damage_flag == MELEE && damage_amount < damage_deflection)
2525
return 0
26-
switch(damage_type)
27-
if(BRUTE)
28-
if(BURN)
29-
else
30-
return 0
26+
if(damage_type != BRUTE && damage_type != BURN)
27+
return 0
3128
var/armor_protection = 0
3229
if(damage_flag)
3330
armor_protection = armor.getRating(damage_flag)

code/game/objects/structures/crates_lockers/closets/utility_closets.dm

+1-3
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,10 @@
4343
new /obj/item/tank/internals/emergency_oxygen/engi(src)
4444
new /obj/item/clothing/mask/breath(src)
4545
new /obj/item/storage/firstaid/o2(src)
46-
if("nothing")
47-
// doot
4846

4947
// teehee - Ah, tg coders...
5048
if("delete")
51-
qdel(src)
49+
qdel(src) // Please make this use init hints its called from Initialize() I beg
5250

5351

5452
/obj/structure/closet/emcloset/legacy/populate_contents()

code/game/objects/structures/transit_tubes/transit_tube.dm

+1-4
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,6 @@
286286
return 6
287287
if("SOUTHWEST", "SW")
288288
return 10
289-
else
290-
return 0
291289

292290

293291

@@ -311,5 +309,4 @@
311309
return "NW"
312310
if(10)
313311
return "SW"
314-
else
315-
return
312+

code/game/turfs/simulated/walls.dm

-3
Original file line numberDiff line numberDiff line change
@@ -187,16 +187,13 @@
187187
switch(severity)
188188
if(1.0)
189189
ChangeTurf(baseturf)
190-
return
191190
if(2.0)
192191
if(prob(50))
193192
take_damage(rand(150, 250))
194193
else
195194
dismantle_wall(1, 1)
196195
if(3.0)
197196
take_damage(rand(0, 250))
198-
else
199-
return
200197

201198
/turf/simulated/wall/blob_act(obj/structure/blob/B)
202199
if(prob(50))

code/game/turfs/turf.dm

-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@
3434

3535
var/blocks_air = FALSE
3636

37-
var/datum/pathnode/PNode = null //associated PathNode in the A* algorithm
38-
3937
flags = 0
4038

4139
var/image/obscured //camerachunks

code/modules/admin/topic.dm

-1
Original file line numberDiff line numberDiff line change
@@ -3227,7 +3227,6 @@
32273227
SSnightshift.can_fire = FALSE
32283228
SSnightshift.update_nightshift(FALSE, FALSE)
32293229
to_chat(usr, "<span class='notice'>Night shift forced off.</span>")
3230-
else
32313230
if(usr)
32323231
log_admin("[key_name(usr)] used secret [href_list["secretsadmin"]]")
32333232
if(ok)

code/modules/awaymissions/maploader/reader.dm

+4-3
Original file line numberDiff line numberDiff line change
@@ -312,13 +312,14 @@ GLOBAL_DATUM_INIT(_preloader, /datum/dmm_suite/preloader, new())
312312

313313
var/turf/T = locate(x, y, z)
314314
if(T)
315+
// Turfs need special attention
315316
if(ispath(path, /turf))
316317
T.ChangeTurf(path, defer_change = TRUE, keep_icon = FALSE, copy_existing_baseturf = FALSE)
317318
instance = T
318-
else if(ispath(path, /area))
319-
320319
else
321-
instance = new path(T) // first preloader pass
320+
// Anything that isnt an area, init!
321+
if(!ispath(path, /area))
322+
instance = new path(T) // first preloader pass
322323

323324
if(GLOB.use_preloader && instance) // second preloader pass, for those atoms that don't ..() in New()
324325
GLOB._preloader.load(instance)

code/modules/events/blob/theblob.dm

-1
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,6 @@ GLOBAL_LIST_EMPTY(blob_nodes)
220220
damage_amount *= brute_resist
221221
if(BURN)
222222
damage_amount *= fire_resist
223-
if(CLONE)
224223
else
225224
return 0
226225
var/armor_protection = 0

code/modules/events/false_alarm.dm

+4-2
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
var/list/event
77
var/list/minor_fake_events = list(
88
list("A solar flare has been detected on collision course with the station. Do not conduct space walks or approach windows until the flare has passed!", "Incoming Solar Flare", 'sound/AI/flare.ogg'),
9-
list("Ionospheric anomalies detected. Temporary telecommunication failure imminent. Please contact you*%fj00)`5vc-BZZT"),
9+
list("Ionospheric anomalies detected. Temporary telecommunication failure imminent. Please contact you*%fj00`5vc-BZZT"),
1010
list("Overload detected in [station_name()]'s powernet. Engineering, please repair shorted APCs.", "Systems Power Failure", 'sound/AI/power_overload.ogg'),
1111
list("Localized hyper-energetic flux wave detected on long range scanners. Expected location of impact: Kitchen.", "Anomaly Alert", 'sound/AI/anomaly_flux.ogg'),
1212
list("Overload detected in [station_name()]'s powernet. Engineering, please check all underfloor APC terminals.", "Critical Power Failure", 'sound/AI/power_overload.ogg'),
1313
list("Hostile runtime detected in door controllers. Isolation lockdown protocols are now in effect. Please remain calm.", "Network Alert", 'sound/AI/door_runtimes.ogg'),
14-
list("Rampant brand intelligence has been detected aboard [station_name()], please stand-by. The origin is believed to be \a vendomat.", "Machine Learning Alert", 'sound/AI/brand_intelligence.ogg'),
14+
list("Rampant brand intelligence has been detected aboard [station_name()], please stand-by. The origin is believed to be a vendomat.", "Machine Learning Alert", 'sound/AI/brand_intelligence.ogg'),
1515
list("Massive migration of unknown biological entities has been detected near [station_name()], please stand-by.", "Lifesign Alert"),
1616
list("An electrical storm has been detected in your area, please repair potential electronic overloads.", "Electrical Storm Alert", 'sound/AI/elec_storm.ogg'),
1717
list("What the fuck was that?!", "General Alert"),
@@ -29,11 +29,13 @@
2929
list("The scrubbers network is experiencing a backpressure surge. Some ejection of contents may occur.", "Atmospherics alert", 'sound/AI/scrubbers.ogg'),
3030
list("Space-time anomalies detected on the station. There is no additional data.", "Anomaly Alert", 'sound/AI/spanomalies.ogg')
3131
)
32+
3233
var/list/major_fake_events = list(
3334
list("Confirmed outbreak of level 3-X biohazard aboard [station_name()]. All personnel must contain the outbreak.", "Biohazard Alert", 'sound/AI/outbreak3.ogg'),
3435
list("Confirmed outbreak of level 3-S biohazard aboard [station_name()]. All personnel must contain the outbreak.", "Biohazard Alert", 'sound/AI/outbreak3.ogg'),
3536
list("Confirmed outbreak of level 5 biohazard aboard [station_name()]. All personnel must contain the outbreak.", "Biohazard Alert", 'sound/AI/outbreak5.ogg')
3637
)
38+
3739
if(prob(90))
3840
event = pick_n_take(minor_fake_events)
3941
GLOB.minor_announcement.Announce(event[1], listgetindex(event, 2), listgetindex(event, 3))

code/modules/mining/lavaland/necropolis_chests.dm

+8-5
Original file line numberDiff line numberDiff line change
@@ -510,18 +510,21 @@
510510
var/timerid
511511
var/list/input_list = list()
512512
var/list/combo_strings = list()
513-
var/static/list/combo_list = list(
513+
var/list/combo_list = list()
514+
515+
516+
/obj/item/cursed_katana/Initialize(mapload)
517+
. = ..()
518+
AddComponent(/datum/component/parry, _stamina_constant = 2, _stamina_coefficient = 0.5, _parryable_attack_types = NON_PROJECTILE_ATTACKS)
519+
combo_list = list(
514520
ATTACK_STRIKE = list(COMBO_STEPS = list(LEFT_SLASH, LEFT_SLASH, RIGHT_SLASH), COMBO_PROC = TYPE_PROC_REF(/obj/item/cursed_katana, strike)),
515521
ATTACK_SLICE = list(COMBO_STEPS = list(RIGHT_SLASH, LEFT_SLASH, LEFT_SLASH), COMBO_PROC = TYPE_PROC_REF(/obj/item/cursed_katana, slice)),
516522
ATTACK_DASH = list(COMBO_STEPS = list(LEFT_SLASH, RIGHT_SLASH, RIGHT_SLASH), COMBO_PROC = TYPE_PROC_REF(/obj/item/cursed_katana, dash)),
517523
ATTACK_CUT = list(COMBO_STEPS = list(RIGHT_SLASH, RIGHT_SLASH, LEFT_SLASH), COMBO_PROC = TYPE_PROC_REF(/obj/item/cursed_katana, cut)),
518524
ATTACK_HEAL = list(COMBO_STEPS = list(LEFT_SLASH, RIGHT_SLASH, LEFT_SLASH, RIGHT_SLASH), COMBO_PROC = TYPE_PROC_REF(/obj/item/cursed_katana, heal)),
519525
ATTACK_SHATTER = list(COMBO_STEPS = list(RIGHT_SLASH, LEFT_SLASH, RIGHT_SLASH, LEFT_SLASH), COMBO_PROC = TYPE_PROC_REF(/obj/item/cursed_katana, shatter)),
520-
)
526+
)
521527

522-
/obj/item/cursed_katana/Initialize(mapload)
523-
. = ..()
524-
AddComponent(/datum/component/parry, _stamina_constant = 2, _stamina_coefficient = 0.5, _parryable_attack_types = NON_PROJECTILE_ATTACKS)
525528
for(var/combo in combo_list)
526529
var/list/combo_specifics = combo_list[combo]
527530
var/step_string = english_list(combo_specifics[COMBO_STEPS])

code/modules/mob/living/carbon/human/human_update_icons.dm

-5
Original file line numberDiff line numberDiff line change
@@ -350,8 +350,6 @@ GLOBAL_LIST_EMPTY(damage_icon_parts)
350350
else
351351
overlays_standing[HEAD_ACCESSORY_LAYER] = mutable_appearance(head_accessory_standing, layer = -HEAD_ACCESSORY_LAYER)
352352
apply_overlay(HEAD_ACCESSORY_LAYER)
353-
else
354-
//warning("Invalid ha_style for [species.name]: [ha_style]")
355353

356354
/**
357355
* Generates overlays for the hair layer.
@@ -478,9 +476,6 @@ GLOBAL_LIST_EMPTY(damage_icon_parts)
478476
else
479477
overlays_standing[FHAIR_LAYER] = mutable_appearance(face_standing, layer = -FHAIR_LAYER)
480478
apply_overlay(FHAIR_LAYER)
481-
else
482-
//warning("Invalid f_style for [species.name]: [f_style]")
483-
484479

485480

486481
/mob/living/carbon/human/update_mutations()

code/modules/mob/living/simple_animal/bot/bot.dm

+1
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,7 @@ Pass a positive integer as an argument to override a bot's default speed.
719719
if("home")
720720
to_chat(src, "<span class='warning big'>RETURN HOME!</span>")
721721
if("ejectpai")
722+
return // Do nothing for this
722723
else
723724
to_chat(src, "<span class='warning'>Unidentified control sequence received: [command]</span>")
724725

code/modules/mob/mob_misc_procs.dm

+8-3
Original file line numberDiff line numberDiff line change
@@ -358,13 +358,18 @@
358358
while(counter>=1)
359359
newletter=copytext(phrase,(leng-counter)+1,(leng-counter)+2)
360360
if(newletter in list(" ", "!", "?", ".", ","))
361-
//do nothing
361+
// Skip these
362+
counter -= 1
363+
continue
364+
362365
else if(lowertext(newletter) in list("a", "e", "i", "o", "u", "y"))
363366
newletter = "ph"
367+
364368
else
365369
newletter = "m"
366-
newphrase+="[newletter]"
367-
counter-=1
370+
371+
newphrase += "[newletter]"
372+
counter -= 1
368373
return newphrase
369374

370375
/proc/muffledspeech_all(list/message_pieces)

code/modules/mob/mob_say_base.dm

+1-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@
167167
prefixes[++prefixes.len] = list(L, i, i + length(selection))
168168
else if(!L && i == 1)
169169
prefixes[++prefixes.len] = list(get_default_language(), i, i)
170-
else
170+
171171
return prefixes
172172

173173
/proc/strip_prefixes(message)

code/modules/reagents/chemistry/reagents/drinks_reagents.dm

+2-6
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,8 @@
7070
var/update_flags = STATUS_UPDATE_NONE
7171
M.AdjustEyeBlurry(-2 SECONDS)
7272
M.AdjustEyeBlind(-2 SECONDS)
73-
switch(current_cycle)
74-
if(1 to 20)
75-
//nothing
76-
if(21 to INFINITY)
77-
if(prob(current_cycle - 10))
78-
update_flags |= M.cure_nearsighted(EYE_DAMAGE, FALSE)
73+
if(current_cycle > 20 && prob(current_cycle - 10))
74+
update_flags |= M.cure_nearsighted(EYE_DAMAGE, FALSE)
7975
return ..() | update_flags
8076

8177
/datum/reagent/consumable/drink/doctor_delight

code/modules/shuttle/shuttle.dm

+1-2
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,7 @@
195195
/obj/docking_port/stationary/transit
196196
name = "In transit"
197197
turf_type = /turf/space/transit
198-
var/area/shuttle/transit/assigned_area
199-
lock_shuttle_doors = 1
198+
lock_shuttle_doors = TRUE
200199

201200
/obj/docking_port/stationary/transit/register()
202201
if(!..())

code/modules/telesci/telesci_computer.dm

+6-8
Original file line numberDiff line numberDiff line change
@@ -279,14 +279,12 @@
279279
telefail()
280280
temp_msg = "ERROR!<BR>Elevation is less than 1 or greater than 90."
281281
return
282-
if(z_co == 2 || z_co < 1 || z_co > 6)
283-
if(z_co == 7 & emagged)
284-
// This should be empty, allows for it to continue if the z-level is 7 and the machine is emagged.
285-
else
286-
telefail()
287-
temp_msg = "ERROR! Sector is less than 1, <BR>greater than [src.emagged ? "7" : "6"], or equal to 2."
288-
return
289-
282+
// THIS FUCKING THING USES ZLEVEL NUMBERS WHY
283+
var/cc_z = level_name_to_num(CENTCOMM)
284+
if(z_co == cc_z || z_co < cc_z + 1 || cc_z > world.maxz)
285+
telefail()
286+
temp_msg = "ERROR! Sector must be greater than or equal to 2, and less than or equal to [world.maxz]."
287+
return
290288

291289
var/truePower = clamp(power + power_off, 1, 1000)
292290
var/trueRotation = rotation + rotation_off

paradise.dme

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#define DEBUG
1111
// END_PREFERENCES
1212
// BEGIN_INCLUDE
13+
#include "__odlint.dm"
1314
#include "_maps\__MAP_DEFINES.dm"
1415
#include "_maps\base_map.dm"
1516
#include "_maps\map_datums.dm"

0 commit comments

Comments
 (0)