Skip to content

Commit

Permalink
Add mapping linter to check for duplicate machinery stacked on same t…
Browse files Browse the repository at this point in the history
…ile (#79394)

This has happened quite a few times in the past and it'd be a good idea
to have a linter catch this common mistake. After digging through the
Python code for the mapping linter, it appears the linter wasn't
correctly identifying two duplicate objects. I tweaked the code to fix
this.
  • Loading branch information
timothymtorres authored and MarkSuckerberg committed Jan 7, 2024
1 parent 58e60c5 commit 3960ce7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions tools/maplint/lints/multiple_machinery.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/obj/machinery:
banned_neighbors:
/obj/machinery:
identical: true
8 changes: 7 additions & 1 deletion tools/maplint/source/lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,13 @@ def __init__(self, typepath, data = {}):

def matches(self, identified: Content, neighbor: Content):
if self.identical:
return neighbor == identified
if identified.path != neighbor.path:
return False

if identified.var_edits != neighbor.var_edits:
return False

return True

if self.typepath is not None:
if self.typepath.matches_path(neighbor.path):
Expand Down

0 comments on commit 3960ce7

Please sign in to comment.