It certainly appears to do the right thing, but yeah I would remove the check for “.Trash” and visibility from this function, so that it only tells you if the file is being mangled by iCloud.
May I make some suggestions (that I’m trying to recall to do myself)?
Checking the "result’ to make sure that the getResourceValue call worked. If it is is false, then handle the error. Just in case Apple change the key names next week, so you get some information, rather than your code thinking that this file is not iCloud.
Checking the “value” type as Apple have a habit of changing the return values from API, this way if they do, the error will let you know they have rather than falsely believing the file isn’t in iCloud.
if the getResourceValue call returned true, but “value” is NIL, then Apple are now returning a data type that the MBS doesn’t convert to a variant, so check for that if it is not numeric.