pierrejeambrun commented on code in PR #26605:
URL: https://github.com/apache/airflow/pull/26605#discussion_r990368133


##########
dev/stats/get_important_pr_candidates.py:
##########
@@ -71,32 +71,46 @@ def __init__(self, g, pull_request: PullRequest):
         self.len_issue_comments = 0
         self.num_issue_comments = 0
         self.num_issue_reactions = 0
+        self.protm_score = 0
 
     @property
     def label_score(self) -> float:
         """assigns label score"""
-        for label in self.pull_request.labels:
+        labels = self.pull_request.labels
+        for label in labels:
             if "provider" in label.name:
                 return PrStat.PROVIDER_SCORE
         return PrStat.REGULAR_SCORE
 
     @cached_property
     def num_comments(self):
-        """counts reviewer comments"""
-        comments = 0
+        """counts reviewer comments & checks for #protm tag"""
+        num_comments = 0
+        num_protm = 0
         for comment in self.pull_request.get_comments():
             self._users.add(comment.user.login)
-            comments += 1
-        return comments
+            if ('protm' in comment.body) or ('PROTM' in comment.body) or 
('PRotM' in comment.body):

Review Comment:
   Same we could avoid checks:
   ```
   if 'protm' in comment.body.lower()
   ```



##########
dev/stats/get_important_pr_candidates.py:
##########
@@ -71,32 +71,46 @@ def __init__(self, g, pull_request: PullRequest):
         self.len_issue_comments = 0
         self.num_issue_comments = 0
         self.num_issue_reactions = 0
+        self.protm_score = 0
 
     @property
     def label_score(self) -> float:
         """assigns label score"""
-        for label in self.pull_request.labels:
+        labels = self.pull_request.labels
+        for label in labels:
             if "provider" in label.name:
                 return PrStat.PROVIDER_SCORE
         return PrStat.REGULAR_SCORE
 
     @cached_property
     def num_comments(self):
-        """counts reviewer comments"""
-        comments = 0
+        """counts reviewer comments & checks for #protm tag"""
+        num_comments = 0
+        num_protm = 0
         for comment in self.pull_request.get_comments():
             self._users.add(comment.user.login)
-            comments += 1
-        return comments
+            if ('protm' in comment.body) or ('PROTM' in comment.body) or 
('PRotM' in comment.body):
+                num_protm += 1
+            num_comments += 1
+        self.protm_score = num_protm
+        return num_comments
 
     @cached_property
     def num_conv_comments(self) -> int:
-        """counts conversational comments"""
-        conv_comments = 0
+        """counts conversational comments & checks for #protm tag"""
+        num_conv_comments = 0
+        num_protm = 0
         for conv_comment in self.pull_request.get_issue_comments():
             self._users.add(conv_comment.user.login)
-            conv_comments += 1
-        return conv_comments
+            if (
+                ('protm' in conv_comment.body)

Review Comment:
   I think this can be simplified by converting the body to lower case and only 
checking once:
   ```
   if 'protm' in conv_comment.body.lower()
   ```



##########
dev/stats/get_important_pr_candidates.py:
##########
@@ -267,9 +281,13 @@ def score(self):
         # If the body contains over 2000 characters, the PR should matter 40% 
more.
         # If the body contains fewer than 1000 characters, the PR should 
matter 20% less.
         #
+        if self.protm_score > 0:
+            interaction_score = self.interaction_score * 2

Review Comment:
   I feel like having multiple #protm should weight more than having only one, 
maybe this can be linear with the number of #protm tags until a certain cap ? 
(just an idea)
   ```
   interaction_score = self.interaction_score * min(self.protm_score + 1, 3)
   ```
   
   If we do this, we should pay attention to not counting twice if the same 
person put two comments with #protm. (maintaining a set of people for instance) 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to