You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The cmdlet is very big, and contains a lot of repetitive code.
It also calls two child functions, which are probably not necessary (New-GraphPArameters and New-CUGraphExport)
New-CUGraphParameters
Doesnt gatehr parameters, but actually generates the Graph (graphviz format).
this is the code of the function:
functionNew-CUGraphParameters {
<#.SYNOPSIS Helper function to generate a Graph, wrap Out-CUPSGraph..DESCRIPTION Helper function to generate a Graph, wrap Out-CUPSGraph..NOTES Private function for PSClassUtils, used in Write-CUClassDiagram#>Param (
$inputobject,$ignorecase,$showcomposition
)
$GraphParams=@{
InputObject=$inputobject
}
If ( $ignorecase ) { $GraphParams.Add('IgnoreCase',$ignorecase) }
If ( $showcomposition ) { $GraphParams.Add('ShowComposition',$showcomposition) }
Out-CUPSGraph@GraphParams
}
New-CUGraphExport
This function is actually just a wrapper for Export-PSGraph, which needs a 'graph' as input.
In the current version, it is generated using Out-CUGraphParameters. (see above).
This is a wrapper for Out-CUPsGraph.
functionNew-CUGraphExport {
<#.SYNOPSIS Helper function to generate a Graph export file, wraps Export-PSGraph..DESCRIPTION Helper function to generate a Graph export file , wraps Export-PSGraph..NOTES Private function for PSClassUtils, used in Write-CUClassDiagram#>param (
$Graph,$PassThru,$Path,$ChildPath,$OutPutFormat,
[Switch]$Show
)
$ExportParams=@{
ShowGraph=$ShowOutPutFormat=$OutPutFormatDestinationPath=Join-Path-Path $Path-ChildPath ($ChildPath+'.'+$OutPutFormat)
}
If ( $PassThru ) {
$Graph$null=$Graph|Export-PSGraph@ExportParams
} Else {
$Graph|Export-PSGraph@ExportParams
}
}
It would be nice to simplify this function, to enable potential futur extensions to it.
Some thoughts on how to achiev this:
It seems like most of the work for [CUDiagram] is done. I managed to keep things simple in this first version by reusing existing functions (Export-PSGraph).
Ideally, Export-PSGraph should also be refactored into a method in CUDiagram.
Open points:
Tests done:
One Class in one file
Multiple classes in one file
Every class is displayed as beening in their own subgraph, with the subgraph as name. this is wrong. It should be grouped by the file name.
Classses throughout different files
Every class is in a subgraph with their own name. This is wrong, and should be the name of the file they were in.
Also, several classes are in the same file (Pester.ps1 for example) and all these classes should be displayed as such.
The cmdlet is very big, and contains a lot of repetitive code.
It also calls two child functions, which are probably not necessary (New-GraphPArameters and New-CUGraphExport)
New-CUGraphParameters
this is the code of the function:
New-CUGraphExport
This function is actually just a wrapper for Export-PSGraph, which needs a 'graph' as input.
In the current version, it is generated using
Out-CUGraphParameters
. (see above).This is a wrapper for Out-CUPsGraph.
It would be nice to simplify this function, to enable potential futur extensions to it.
Some thoughts on how to achiev this:
The text was updated successfully, but these errors were encountered: