asterix314 opened a new issue, #3339:
URL: https://github.com/apache/incubator-devlake/issues/3339

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/incubator-devlake/issues?q=is%3Aissue) and 
found no similar feature requirement.
   
   
   ### Description
   
   Pull requests issued by automated robots do not indicate real development 
activity and distort the metrics. Therefore they should be removed. 
[CNCF/devstats](https://github.com/cncf/devstats) uses pattern-matching to 
detect bots. We can shamelessly snatch their pattern-list (see 
[here](https://github.com/cncf/devstats/blob/master/util_sql/exclude_bots.sql)) 
and use it in something like:
   
   ```sql
   select *
   from pull_requests
   where select *
   from pull_requests
   where --  not the full list but covers 99+% of the cases
       author_name not rlike  '^robot-|-robot$|\\[bot\\]|-bot$|-ci$|-testing$'
   ```
   
   If performance becomes an issue, then a table of robot IDs can be prepared 
beforehand and then joined with the target table.
   
   
   ### Use case
   
   How many PRs are attributable to bots? Apply the filter above to get some 
results.
   
   - For [clickhouse](https://github.com/ClickHouse/ClickHouse), bot activity 
is rampant:
   
   |created_year|PRs|bots contribution|
   |------------|---|----|
   |2020|7161|36.7%|
   |2021|11015|53.3%|
   |2022|4019|19.4%|
   
   - Overall ([oss.demo](https://grafana-oss.demo.devlake.io), 346 repos), not 
so much, but still significant, and rising:
   
   |created_year|PRs   |bots contribution  |
   |------------|------|------|
   2020  |218558|4.0%|
   2021  |215863|6.2%|
   2022  |116016|7.7%|
   
   
   ### Related issues
   
   _No response_
   
   ### Are you willing to submit a PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
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