We are facing quite a weird issue regarding the props validation it appears that sonar cloud requires the core javascript functions to be properly validated. I would like to share an example code:
Suppose we have a Component which takes 2 inputs as a prop in react native
in the above example it is a simple code component takes input and show output. and we understand if sonar wants to validated the inputs (props-validation). Like Below
This is fine but sonar cloud throw an error triggered by rule javascript:S6774, that firstName.trim is missed in props validation and lastName.trim is missed in props validation so i would like to know how to resolve this issue that we don’t need to validate the core javascript functions or anything like that. any help would be appreciated.
Here are some more details:
Which product(s) you’re using? Sonar Cloud
Which language you’re analyzing (and tag your post with the language!)? React-Native, Javascript
Which rule is affected? S:6774
Why you believe it’s a false-positive / false-negative? Because it asks to validate the js core functions and react native core functions.