-
Notifications
You must be signed in to change notification settings - Fork 344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
adding --uml-no-inline-groupings-from #872
base: master
Are you sure you want to change the base?
Conversation
pyang/__init__.py
Outdated
@@ -1,4 +1,4 @@ | |||
"""The pyang library for parsing, validating, and converting YANG modules""" | |||
|
|||
__version__ = '2.5.3' | |||
__version__ = '2.5.4' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest that this decision is left to the repository owners.
pyang/plugins/uml.py
Outdated
dest="uml_skip_module", | ||
action="append", | ||
default=[], | ||
metavar="SKIP MODULE", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just use the default metavar, i.e., UML_SKIP_MODULE to indicate the context of the UML plugin; or at least SKIP_MODULE.
metavar="SKIP MODULE", |
pyang/plugins/uml.py
Outdated
@@ -93,6 +93,16 @@ def add_opts(self, optparser): | |||
optparse.make_option("--uml-filter-file", | |||
dest="uml_filter_file", | |||
help="NOT IMPLEMENTED: Only paths in the filter file will be included in the diagram"), | |||
optparse.make_option("--uml-skip-module", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The --uml-inline-groupings option is then not applied to those uses statements for groupings in the list of modules specified in --uml-skip-module? Correct?
Is this intended to only be applicable when the --uml-inline-groupings global option with the --uml-skip-module option is selected?
If so then the name of this option is too general and is thus misleading and should be improved to make it clearer, e.g., something like --uml-no-inline-groupings-from.
Also if --uml-inline-groupings and --uml-skip-module are not specified wouldn't it be expected that if a legend is specified, then the modules of the groupings should be listed as when --uml-inline-groupings=true and --uml-skip-module is not empty?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The --uml-inline-groupings option is then not applied to those uses statements for groupings in the list of modules specified in --uml-skip-module? Correct?
No, and I agree to the 3 point to switch to --uml-no-inline-groupings-from
Is this intended to only be applicable when the --uml-inline-groupings global option with the --uml-skip-module option is selected?
Yes
If so then the name of this option is to general and is thus misleading and should be improved to make it clearer, e.g., something like --uml-no-inline-groupings-from.
I will adopt to this option
Also if --uml-inline-groupings and --uml-skip-module are not specified wouldn't it be expected that if a legend is specified, then the modules of the groupings should be listed as when --uml-inline-groupings=true and --uml-skip-module is not empty?
You point is true, but if I don't use --uml-inline-groupings the uml is not traversing to it's groupings (other modules) so far. Now I see based on your comment the legend can be improved to touch the submodule too to keep in generic not just for --uml-inline-groupings
pyang/plugins/uml.py
Outdated
action="append", | ||
default=[], | ||
metavar="SKIP MODULE", | ||
help="skips given modules, i.e., --uml-skip-module=tailf-ncs"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Text should be improved to make it clearer what the actual skipping of modules means. See my comment on line 96.
Also avoid referencing specific modules that may not be available to everyone, e.g., tailf-ncs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nkhancock do you have any common example for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nkhancock do you have any common example for this?
A possible candidate could be ietf-yang-push. This has internal groupings and also uses an external grouping from ietf-yang-patch.
pyang/plugins/uml.py
Outdated
default=[], | ||
metavar="SKIP MODULE", | ||
help="skips given modules, i.e., --uml-skip-module=tailf-ncs"), | ||
optparse.make_option("--uml-add-legend", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name of this option implies that the user could define or control the rendering of a legend in the diagram, whereas this legend is specific to the --uml-skip-module option.
It also needs to be considered how such an option could co-exist with a possible new option to render a user-specified legend going forward.
Maybe consider using a note instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initially I tried note, which is mapping to the last class (It needed more logic to map to right class etc) let me revisit and add the changes.
@nkhancock
QQ: Shall I pull out the changes of --uml-add-legend
and open a new PR when it's ready?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall I pull out the changes of --uml-add-legend and open a new PR when it's ready?
That's up to you. If the changes are completely independent, maybe separate PRs would make it easier to review. It's basically up to you.
pyang/plugins/uml.py
Outdated
@@ -591,7 +615,12 @@ def emit_module_header(self, module, fd): | |||
def emit_module_class(self, module, fd): | |||
fd.write('class \"%s\" as %s << (M, #33CCFF) module>> \n' %(self.full_display_path(module), self.full_path(module))) | |||
|
|||
|
|||
def emit_uml_legend(self, module, fd): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name of this function is too general for the function it performs. It is specific to the --uml-skip-modules option.
To allow possible future support for a user to define a legend with a given text, this function should just accept a text to be shown within the legend box and a new function specific to --uml-skip-modules, e.g., emit_uml_skip_modules_legend could be defined that creates the required text for the skip module legend and calls the general function.
pyang/plugins/uml.py
Outdated
@@ -591,7 +615,12 @@ def emit_module_header(self, module, fd): | |||
def emit_module_class(self, module, fd): | |||
fd.write('class \"%s\" as %s << (M, #33CCFF) module>> \n' %(self.full_display_path(module), self.full_path(module))) | |||
|
|||
|
|||
def emit_uml_legend(self, module, fd): | |||
fd.write('legend \n') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should a legend be written if there are no files/modules to list, i.e., only when self.ctx_grp_files is not empty? If I don't specify either --uml-inline-groupings or --uml-skip-module, but specify --uml-add-legend, then a legend is displayed without any files listed.
Also if --uml-inline-groupings and --uml-skip-module are not specified wouldn't it be expected that if a legend is specified, then the modules of the groupings should be listed as when --uml-inline-groupings=true and --uml-skip-module is not empty?
@nkhancock Thanks for reviewing it. I will do update and improve the content. |
updating `--uml-add-legend` help Co-authored-by: Nick Hancock <[email protected]>
updating to module Co-authored-by: Nick Hancock <[email protected]>
legend msg update Co-authored-by: Nick Hancock <[email protected]>
@@ -62,6 +62,11 @@ def add_opts(self, optparser): | |||
dest="uml_inline", | |||
default =False, | |||
help="Inline groupings where they are used."), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a note could be added to this text to indicate that groupings from specific modules can be omitted from this option through use of the --uml-no-inline-groupings-from option.
@@ -62,6 +62,11 @@ def add_opts(self, optparser): | |||
dest="uml_inline", | |||
default =False, | |||
help="Inline groupings where they are used."), | |||
optparse.make_option("--uml-no-inline-groupings-from", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although suggested by myself, I am not totally convinced by this name.
Maybe others have better suggestions.
When we use --uml-inline-grouping flag we can expect to ignore base modules like tailf-ncs etc, in this PR we are added new flags.
Command:
pyang -f uml l3vpn.yang --path=/tmp/.ncs_uml --uml-inline-groupings --uml-skip-module=tailf-ncs --uml-output-directory=. --uml-no=module,import,annotation --uml-add-legend 2> /dev/null
--uml-add-legend
adds filenames from shared grouping - Note: not skipping any module for this exampleHere is the legend plantUML code generated.
--uml-skip-module=tailf-ncs
with--uml-inline-groupings
, inline grouping adds all the grouping uses in the yang including the base service-data, plan-date and more, in the new flag we can skip entire module from inline-grouping.Here the skip modules are kept in the {uses} as before --uml-inline-groupings flag.
Image before the
--uml-skip-module
Image with
--uml-skip-module