Warn about activities that are not referenced elsewhere
Non planifiéeI was working on a workflow that had 3 Get Layer activities, and 3 Set Layer Definitions, one for each layer. These where all copy/pasted, but I'd forgotten to update 2 of the layer references in the Set Layer Definitions. It took some time to find out my mistake.
It would be helpful if a warning was added to the Problems panel about activities that are not referenced anywhere else in same workflow, because this may indicate an error in the workflow.
I realize that not all activities have to be referenced, for instance, the result of a Set Layer Definition is often not used, but in that case, the ID could (or should, IMO) be cleared anyway.
-
Commentaire officiel
We've looked into this and decided it would potentially be more of a nuisance than a help in most cases to warn the author of unused outputs.
Out of 184 activities that have outputs (activity packs are not included) there were 150 which should use the outputs. In many cases the output is the whole point of executing the activity, like Get Layer or Get Map Extent. On the other hand, there were 34 where there are outputs which provide additional information but are not necessary. For example, Set Map Extent actually outputs both the old and new values. I think in many cases the author doesn't care to use these.
On balance, I didn't want to add the extra overhead of needing to somehow categorize these activities in both camps and then try to maintain this going forwards. I also didn't want authors to need to choose to ignore individual warnings as this would get tedious and they would finally start ignoring the validation information entirely.
-
It'd be nice to place the little .WarningIcon in the corner of activities which appear to be unreferenced too.
2 -
If we implement this as a new variety of the existing "validation warning" idea, it will show the usual exclamation mark in a triangle icon.
My only concern about this is that if there are too many false positives, users might start to get "alert blindness" and begin ignoring validation issues. I get that your workaround would be to delete the id.
An alternative might be to allow a workflow author to mark certain warnings as "ignored" and filter them out. I'm considering this as a possibility.
2 -
Yes, I think that filtering out certain items would work for me. I already have cases where I want to ignore certain warnings now, so that would be great.
I agree that having too much information in the Problems panel could work contra-productive. There are other things that I would personally like to have a warning about (and I can think of more), so the list would grow even longer if those were implemented.
Maybe it would be an option to add a new type of 'error', similar to e.g. Visual Studio, where you have three levels: Error, Warning and Message. A user can then select which level to show, where Message could be off by default
2 -
+2 from me to Berend's note.
I too have cases where Designer understandably displays a validation error but in a given case I want to hide the error, so that suggestion is very interesting to me.
Distinguishing between different levels of errors would be very helpful too! Levels like that would probably help with alert blindness, which I would be worried about too Ken. OTOH, I wouldn't be surprised if such a thing required a more serious rewrite of the Designer's existing validation code.
1 -
Berend Veldkamp I'd like to understand your original workflow a bit better. You had a Get Layer activity and a Set Layer Definition Expression activity which were both copied and then pasted a couple of times. They need to be updated which was overlooked as it wasn't obvious.
I see that both of these activities have a Layer Id input. Were they both referencing a value from a Create Value activity, something like $layerId1.value?
I wondered if you copied $layerId1 and pasted it to get $layerId2 and $layerId3 before then doing the same with $layer1 and $layerDef1.
If that was your setup and if they all existed in the same container, you could copy/paste $layerId1, $layer1 and $layerDef1 at the same time and any expressions in $layer2 and $layerDef2 would use the new $layerId2 instead of the old $layerId1.
I'm guessing that you likely have the Create Value steps in a different part of the workflow, making it impossible to copy/paste the related steps all at the same time.
2 -
I think you're touching on something that Berend also did in the OP, Ken. For most activities, it probably wouldn't really add much to validate downstream referencing. Get Layer, though, would be an activity that is useless unless it is referenced elsewhere. The same can probably be said for a number of activities, Value, GIS activities, a bunch of the Feature/Layer/Map activities, Get App Data, etc.
Of course I couldn't speak to the specifics of Berend's Workflow... I can't say I know how ugly his WF authoring is but I bet he dup'd Get Layer first then Set Definition at some time later... which of course circumvents the conveniences of batch duplication which I'm sure he knows about and would love to use. If my experience is any guide sometimes "it do be like that" and you get backed into doing things the hard way; I've certainly been there (hope I'm not the only one). That's why I over-complicate all my code by looping over custom objects instead of ever repeating myself in activities (which never bites me in the rear).
0 -
Ken Lyon I don't remember exactly how I copied those activities. I tested again, and found out that if both activities (Get Layer and Set Layer Definition) are copied together, the references are updated. If I copy only Get Layer first, and then Set Layer Definition, that does not work.
But as Zack already mentioned, copying activities together isn't always possible though. For instance, I often put all my Get Layer's somewhere at the beginning of the workflow in an 'Initialize' container, and only use them later.
But in the end, it doesn't really matter how I did this, and my first post was just an example. The problem is that in workflow, there are many ways to mess things up, and you can unintentionally end up with unreferenced activities.
Another thing is that the result of an activity isn't always needed. For instance, I hardly ever use the newExpression or oldExpression results of a Set Layer Definition. If I get a warning that this activity is not referenced, I can just clear the ID, so that it doesn't show up in the (always too long) autocomplete list. (Did I ever mention adding a scope to activities ;-) ?
1 -
Ken Lyon I understand your consideration, but the point I was trying to make in my first post here still stands. Even with activities where output should be used, or maybe I should say: Especially with those activities, it would help to know if that output was never referenced.
And I don't think workflow authors would have to ignore specific warnings. If these type of messages would be classified as ‘message’ instead of ‘warning’, one could simply ignore that message level.
0
Vous devez vous connecter pour laisser un commentaire.
Commentaires
9 commentaires