xapi-project / xen-api

The Xapi Project's XenAPI Server
http://xenproject.org/developers/teams/xapi.html
Other
342 stars 282 forks source link

IH-640: Eliminate unnecessary usage of List.length to check for empty lists #5762

Closed last-genius closed 10 hours ago

last-genius commented 1 week ago

Instead of traversing the entire list just to check if the first element is present, do that directly.

OCaml 5.1 has List.is_empty, here a simple lst = [] is used along with match statements.

Adds a quality gate to check that we don't add trivially unnecessary cases like this anymore.

coveralls commented 1 week ago

Coverage Status

coverage: 44.887%. remained the same when pulling 27fd041877d4ac4b78a387a70c007eef27c88040 on last-genius:private/asultanov/empty-length-checking into 2008661e9cc6f0593b3727f608a9455f62478424 on xapi-project:master.

coveralls commented 6 days ago

Coverage Status

coverage: 44.887%. remained the same when pulling b57ff2c0dffffafef5c33d549c491e04620fabbe on last-genius:private/asultanov/empty-length-checking into 2008661e9cc6f0593b3727f608a9455f62478424 on xapi-project:master.

lindig commented 6 days ago

I like this spring cleaning!

last-genius commented 4 days ago

These changes passed the BST+BVT test suites, undrafting.

lindig commented 4 days ago

I would avoid creating an internal page and rather create a ticket and use labels to find them again. Or start with a single ticket to collect them and from there create sub-tickets once they are worked on.

contificate commented 4 days ago

I would avoid creating an internal page and rather create a ticket and use labels to find them again. Or start with a single ticket to collect them and from there create sub-tickets once they are worked on.

Ah, yeah.. probably a better idea than throwing them into the Confluence abyss.

coveralls commented 4 days ago

Coverage Status

coverage: 44.887%. remained the same when pulling 845ffdd4cd1ca14d66c9dd8eefd2ee5bd38d9553 on last-genius:private/asultanov/empty-length-checking into dd9ba19b6dcbfe1709cbf0db0ce609f46a9b2d8d on xapi-project:master.