nopSolutions / nopCommerce

ASP.NET Core eCommerce software. nopCommerce is a free and open-source shopping cart.
https://www.nopcommerce.com
Other
9.14k stars 5.25k forks source link

Suspicious code fragments #7117

Closed NikiPn closed 4 months ago

NikiPn commented 5 months ago

Hello.

I have checked your project (the code corresponds to the commit) using the PVS-Studio analyzer. The results of the check revealed a number of suspicious code fragments that I have included in an article. You may be interested in taking a look at them.

It's worth noting that the article contains only the most interesting warnings issued by the analyzer. You can check your project in more detail using the free version of PVS-Studio for open-source projects.

skoshelev commented 4 months ago

Hi @NikiPn. Many thanks for your help. We already have several similar reports (sent to our contacts form), but they were not as detailed as your article. Thanks again! We've made several changes based on your observations and will look into other reports.

I would like to separately explain about Fragment 7, in case someone is also interested in it. It's really rare to see while used instead of if, but with this code everything is fine. The main goal is to place a single recursive call at the end of the method to ensure that tail recursion is optimized. Since in this place performance is more important than simplicity, we went for this design

Closed #7117