eevanwong commented on pull request #2191:
URL: https://github.com/apache/drill/pull/2191#issuecomment-809546908


   1. According to their website, LGTM takes the codebase, "generates a 
database to represent the codebase", then uses codeQL to run queries on the 
database to generate alerts. They use data science to identify the errors (from 
analyzing a lot of other projects and finding common errors).
   
   2. It depends. Sometimes, alerts are a false-positive (incorrect); however, 
pertaining to drill, most of the alerts were meaningful as they were valid 
issues that needed to be fixed; however, some of them are not. For example, 
   
   
![image](https://user-images.githubusercontent.com/71536798/112870474-4016f680-908c-11eb-8cf4-cc809fa74b6e.png)
   This already has a guard if the counter is greater than the length of the 
data, despite that, it still throws the alert, and so I tried to use a try and 
catch statement.
   
   Also, like I said in my previous comment. Sometimes the value is initialized 
in the null value as an arbitrary value so that it can be used later. Just 
declaring it isn't enough as it causes an error. 
   
   3. For hashcode, it recommends overriding both `hashCode` and `equals` 
methods to ensure they're consistent. The thing is, in most cases, there is no 
hashCode or equals method.
   
   e.g 
   
![image](https://user-images.githubusercontent.com/71536798/112872150-06df8600-908e-11eb-9c6f-8b74c4cf0add.png)
   This results in this hashcode alert
   
   
![image](https://user-images.githubusercontent.com/71536798/112872311-3a221500-908e-11eb-8ce2-af6cc489271f.png)
   
   
   For nulls, it recommends to ensure that the value is not null when its 
dereferenced. 
   
![image](https://user-images.githubusercontent.com/71536798/112872646-99802500-908e-11eb-92b0-bd39b418ffd4.png)
   
   The thing, the alert is essentially explaining that the value might be null 
b/c it was initialized as so, but thats because it has to be arbitrary 
initialized so that it can be called in different statements. 


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

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


Reply via email to