BroadcomMFD / cobol-control-flow

COBOL Control Flow is an extension for Visual Studio Code that provides graphical visualization of program flow for programs written in COBOL.
https://marketplace.visualstudio.com/items?itemName=broadcomMFD.ccf
Other
9 stars 8 forks source link

Allow to exclude certain elements from the graph #56

Open FALLAI-Denis opened 1 year ago

FALLAI-Denis commented 1 year ago

Hi,

In our standard for writing our COBOL code, we declare certain paragraphs or sections which have no interest in appearing in the graph built by CCF, which would lighten the graphical representation of the program accordingly.

These are mainly paragraphs that mark the end of scope of a PERFORM (PERFORM PARA THRU PARA-EXIT, or PERFORM SECT with a final PARA-EXIT), and which contain only an "exit" statement or a variant of type "exit paragraph" or "exit section".

These paragraphs are usually not explicitly referenced and are just executed in sequence. On the other hand, if these paragraphs (or sections) are explicitly referenced by a GO TO, or even by a PERFORM, they must be included in the graph.

For this, it would be necessary to be able to declare in CCF the list of paragraphs or sections to be ignored in the form of patterns of regular expressions. To take the example above: ignore the paragraphs responding to the regex pattern /\b.*-EXIT\b/i.

The rule would therefore be: if a paragraph (or section) responds to an exclusion pattern and is not explicitly referenced, then do not make it appear in the graph.

GitMensch commented 1 year ago

I think it is more reasonable to have two setttings:

BroadcomMFD.ccf.ignoreProcedures [String, empty] regex of entries that are not shown in CCF BroadcomMFD.ccf.ignoreUnreferenced [Boolean, false] ignore any

In the presented case one would likely only adjust the second setting, no?

FALLAI-Denis commented 1 year ago

Hi @GitMensch

I think BroadcomMFD.ccf.ignoreUnreferenced will handle most of needs.

Is perfom aaa thru bbb would be a reference for bbb?

GitMensch commented 1 year ago

Is perfom aaa thru bbb would be a reference for bbb?

"Depends on"... In any case the complete paragraph bbb is executed to its end, so one can say "it is definitely a reference" (the name is mentioned) "and it is also executed". ... but on the other hand also aab. aba and all other paragraphs that are in between both paragraphs are executed, they just aren't explicit mentioned.

I'd personally suggest to NOT count perfom aaa thru bbb as a reference for bbb for applying BroadcomMFD.ccf.ignoreUnreferenced AND suggest people, as a best practice, to prefer PERFORM section-name over PERFORM parahraph-1 THRU paragraph-2 - at least to be able to enjoy a more clear control flow output ;-)

only minimal related note, which possibly should go to a separate issue: a GO TO should visibly be different (and "less strong") than a PERFORM in the drawing. And of course a CALL #6 should be even stronger.

Nurkambay commented 10 months ago

Hello @FALLAI-Denis,

Filtering of the nodes is definitely on our roadmap. It will be useful for hiding exits as well

I will return to you when we have a decision on how it should look from the UI/UX point of view