Skip to content

Commit

Permalink
makes these lints better
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkSuckerberg committed Jan 7, 2024
1 parent 5288987 commit 737170c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion tools/maplint/lints/multiple_cables.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/obj/structure/cable:
banned_neighbors:
/obj/structure/cable:
matching_vars: [dir]
matching_vars: [icon_state]
6 changes: 3 additions & 3 deletions tools/maplint/source/lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def __init__(self, typepath, data = {}):
expect(isinstance(self.identical, bool), "identical must be a boolean.")

if "matching_vars" in data:
self.same_dir = data.pop("matching_vars")
self.matching_vars = data.pop("matching_vars")
expect(isinstance(self.matching_vars, list), "matching_vars must be a list of variables.")

if "pattern" in data:
Expand All @@ -71,11 +71,11 @@ def __init__(self, typepath, data = {}):

def matches(self, identified: Content, neighbor: Content):
if len(self.matching_vars) > 0:
if not self.typepath.matches_path(neighbor.path):
if self.typepath is not None and not self.typepath.matches_path(neighbor.path):
return False

for variable in self.matching_vars:
if identified.var_edits[variable] != neighbor.var_edits[variable]:
if identified.var_edits.get(variable) != neighbor.var_edits.get(variable):
return False

return True
Expand Down

0 comments on commit 737170c

Please sign in to comment.