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
- Short-hand to full length alias translation working
- Cronological order of commands in the code reflected in the output
- Clean-ups. Comments and the like.
- Make it possible to specify that debug commands should be excluded from the graph.
Copy file name to clipboardExpand all lines: Public/PowerShellInfo/Out-PSModuleCallGraph.ps1
+77-36Lines changed: 77 additions & 36 deletions
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
functionOut-PSModuleCallGraph() {
3
3
<#
4
4
.DESCRIPTION
5
-
Out-PSModuleCallGraph generates a call graph on a PowerShell module. The call graph is generated by parsing the public functions of the module being analyzed. Identifying
5
+
Out-PSModuleCallGraph generates a call graph on a PowerShell module. The call graph is generated by parsing the public commands/functions of the module being analyzed. Identifying
6
6
the commands/functions each one utilizes. Noting their scope and the chronological order by which they where called. Finally the graph is generated with the PSGraph module and
7
7
saved in the format and on the media specified.
8
8
.INPUTS
@@ -11,18 +11,24 @@ function Out-PSModuleCallGraph() {
11
11
.OUTPUTS
12
12
A graphviz graph via the PSGraph module.
13
13
.NOTES
14
-
Pre-requisites:
15
-
- The PSGraph module should already be installed.
14
+
On the analysis:
15
+
- The analysis is based on parsing the AST of each command/public function in the analyzed module. You therefore do not get a sequence like graph over certain calls made
16
+
if 'x' path in the program was followed. Rather the generated call graph represents the code written, static as it is, when parsed line by line, as it is read-in from files
17
+
on disk, to identify the sub-routines called and to be able to present an overview of how parts of the program is thought to interact/can interact with eachother.
16
18
Other:
17
19
- Call graphs can be very useful when working with your own PowerShell module or a PS module developed by external parties. A call graph gives you an overview over the calling
18
20
relationships of commands/functions in a program. Thereby making it possible to get a good overview of a PowerShell module and they its sub-routines interact with eachother.
21
+
Pre-requisites:
22
+
- The PSGraph module should already be installed.
19
23
.EXAMPLE
20
24
Out-PSModuleCallGraph -ModuleName Pester
21
25
This will generate a call graph on the Pester module.
This will generate a call graph on a properly defined PowerShell module in the folder 'PowerShellTooling'. A sub-folder to current folder. Useful if the module is not installed
25
29
in one of the default PowerShell module installation locations.
30
+
.PARAMETERExcludeDebugCommands
31
+
Used to specify that you wish to exclude common debug commands such as > Write-Verbose & Write-Error.
26
32
.PARAMETERModuleName
27
33
The name of the module to analyze. Assumes that the module is installed in one of the default PowerShell module installation locations.
28
34
.PARAMETERModuleRoot
@@ -35,14 +41,21 @@ function Out-PSModuleCallGraph() {
# Add the analyzed info to the collection that holds all the aggregated info, derived by analyzing the public function/command currently being iterated over
149
186
$PublicFunctionCommandHierarchy.Add(@{
@@ -160,19 +197,23 @@ function Out-PSModuleCallGraph() {
160
197
- Generate data for the graph
161
198
#>
162
199
$graphData= Graph ModuleCallGraph {
200
+
# Graph root node. To which all other nodes will be rooted.
0 commit comments