Skip to content

Commit fd471f2

Browse files
francinumMrMelbert
andauthored
OpenDream Linting (#930)
* OpenDream Linting Co-authored-by: MrMelbert <[email protected]> * pish * patchover * Push updated pragmas * fuck * Guh:tm: --------- Co-authored-by: MrMelbert <[email protected]>
1 parent 1d46d73 commit fd471f2

File tree

7 files changed

+101
-8
lines changed

7 files changed

+101
-8
lines changed

.github/workflows/ci_suite.yml

+19
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,25 @@ jobs:
6767
if: steps.linter-setup.conclusion == 'success' && !cancelled()
6868
run: tools/build/build --ci lint tgui-test
6969

70+
odlint:
71+
if: ( !contains(github.event.head_commit.message, '[ci skip]') )
72+
name: "Lint with OpenDream"
73+
runs-on: ubuntu-22.04
74+
concurrency:
75+
group: odlint-${{ github.head_ref || github.run_id }}
76+
cancel-in-progress: true
77+
steps:
78+
- uses: actions/checkout@v4
79+
- uses: robinraju/[email protected]
80+
with:
81+
repository: "OpenDreamProject/OpenDream"
82+
tag: "latest"
83+
fileName: "DMCompiler_linux-x64.tar.gz"
84+
extract: true
85+
- name: Run OpenDream
86+
run: |
87+
./DMCompiler_linux-x64/DMCompiler daedalus.dme --suppress-unimplemented --define=CIBUILDING
88+
7089
compile_all_maps:
7190
if: ( !contains(github.event.head_commit.message, '[ci skip]') )
7291
name: Compile Maps

.gitignore

+4-1
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,10 @@ libprof.so
208208
# Screenshot tests
209209
/artifacts
210210

211+
# Running OpenDream locally
212+
daedalus.json
213+
211214
# Codex Database
212215
codex.db
213216
codex.db-shm
214-
codex.db-wal
217+
codex.db-wal

.vscode/launch.json

+6
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@
1515
"preLaunchTask": "Build All",
1616
"dmb": "${workspaceFolder}/${command:CurrentDMB}",
1717
"dreamDaemon": true
18+
},{
19+
"type": "opendream",
20+
"request": "launch",
21+
"name": "OpenDream",
22+
"preLaunchTask": "OpenDream: compile ${command:CurrentDME}",
23+
"json_path": "${workspaceFolder}/${command:CurrentJson}"
1824
}
1925
]
2026
}

.vscode/tasks.json

+8
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,14 @@
8989
],
9090
"group": "build",
9191
"label": "tgui: sonar"
92+
},
93+
{
94+
"type": "opendream",
95+
"problemMatcher": [
96+
"$openDreamCompiler"
97+
],
98+
"group": "build",
99+
"label": "OpenDream: compile daedalus.dme"
92100
}
93101
]
94102
}

code/_compile_options.dm

+12-7
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@
187187
#warn compiling in TESTING mode. testing() debug messages will be visible.
188188
#endif
189189

190-
#ifdef CIBUILDING
190+
#if defined(CIBUILDING) && !defined(OPENDREAM)
191191
#define UNIT_TESTS
192192
#endif
193193

@@ -214,12 +214,17 @@
214214
#define CBT
215215
#endif
216216

217-
#if !defined(CBT) && !defined(SPACEMAN_DMM)
218-
#warn Building with Dream Maker is no longer supported and will result in errors.
219-
#warn In order to build, run BUILD.bat in the root directory.
220-
#warn Consider switching to VSCode editor instead, where you can press Ctrl+Shift+B to build.
221-
//Hi, Hijacking this to do DMEd-Specific Icon Overrides
222-
#define SIMPLE_MAPHELPERS
217+
#if defined(OPENDREAM)
218+
#if !defined(CIBUILDING)
219+
#warn You are building with OpenDream. Remember to build TGUI manually.
220+
#warn You can do this by running tgui-build.cmd from the bin directory.
221+
#endif
222+
#else
223+
#if !defined(CBT) && !defined(SPACEMAN_DMM)
224+
#warn Building with Dream Maker is no longer supported and will result in errors.
225+
#warn In order to build, run BUILD.cmd in the root directory.
226+
#warn Consider switching to VSCode editor instead, where you can press Ctrl+Shift+B to build.
227+
#endif
223228
#endif
224229

225230
#ifdef ZASDBG

daedalus.dme

+4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
#define DEBUG
1313
// END_PREFERENCES
1414

15+
#if !defined(SPACEMAN_DMM) && defined(OPENDREAM)
16+
#include "tools/ci/od_lints.dme"
17+
#endif
18+
1519
// BEGIN_INCLUDE
1620
#include "_maps\_basemap.dm"
1721
#include "code\_byond_version_compact.dm"

tools/ci/od_lints.dme

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
//1000-1999
2+
#pragma FileAlreadyIncluded error
3+
#pragma MissingIncludedFile error
4+
#pragma InvalidWarningCode error
5+
#pragma MisplacedDirective error
6+
#pragma UndefineMissingDirective error
7+
#pragma DefinedMissingParen error
8+
#pragma ErrorDirective error
9+
#pragma WarningDirective warning
10+
#pragma MiscapitalizedDirective error
11+
12+
//2000-2999
13+
#pragma SoftReservedKeyword error
14+
#pragma DuplicateVariable error
15+
#pragma DuplicateProcDefinition error
16+
#pragma PointlessParentCall error
17+
#pragma PointlessBuiltinCall error
18+
#pragma SuspiciousMatrixCall error
19+
#pragma FallbackBuiltinArgument error
20+
#pragma PointlessScopeOperator error
21+
#pragma MalformedRange error
22+
#pragma InvalidRange error
23+
#pragma InvalidSetStatement error
24+
#pragma InvalidOverride error
25+
#pragma DanglingVarType error
26+
#pragma MissingInterpolatedExpression error
27+
#pragma AmbiguousResourcePath error
28+
29+
30+
// NOTE: The next few pragmas are for OpenDream's experimental type checker
31+
// This feature is still in development, elevating these pragmas outside of local testing is discouraged
32+
// An RFC to finalize this feature is coming soon(TM)
33+
// BEGIN TYPEMAKER
34+
#pragma UnsupportedTypeCheck disabled
35+
#pragma InvalidReturnType disabled
36+
#pragma InvalidVarType disabled
37+
#pragma ImplicitNullType disabled
38+
#pragma LostTypeInfo disabled
39+
// END TYPEMAKER
40+
41+
//3000-3999
42+
#pragma EmptyBlock disabled
43+
#pragma EmptyProc disabled
44+
// NOTE: Only checks for unsafe accesses like "client.foobar" and doesn't consider if the client was already null-checked earlier in the proc
45+
#pragma UnsafeClientAccess disabled
46+
#pragma SuspiciousSwitchCase error
47+
#pragma AssignmentInConditional error
48+
#pragma PickWeightedSyntax disabled

0 commit comments

Comments
 (0)