Skip to content

Commit 9c1b3dd

Browse files
committed
Updated run rule logic for pk check
1 parent db0e785 commit 9c1b3dd

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

linter/rules/view_with_dimensions_and_measures_has_one_primary_key.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@ def applies_to():
88
def run(self, view):
99
dimensions, measures = [
1010
view.get(key, []) for key in ['dimensions', 'measures']]
11+
has_primary_key = True
1112
if len(measures) > 0 and len(dimensions) > 0:
12-
primary_key_count = 0
13+
has_primary_key = False
1314
for dimension in dimensions:
1415
if 'primary_key' in dimension:
15-
primary_key_count += 1
16-
if primary_key_count != 1:
17-
return False
18-
return True
16+
if has_primary_key:
17+
return False
18+
has_primary_key = True
19+
return has_primary_key

0 commit comments

Comments
 (0)