Unused variables and/or functions

Post feature requests, product enhancement ideas, and other product-specific suggestions here. Do not post bug reports.
Forum rules
Do not post any licensing information in this forum.
Locked
User avatar
PsCustomObject
Posts: 80
Joined: Tue Apr 29, 2014 1:55 am

Unused variables and/or functions

Post by PsCustomObject » Fri Jun 09, 2017 4:11 am

Hello,

more often than not I work with large script files (3k+ lines) so it can happen during maintenance and/or updates to the script that some variables previousely declared are not sued anymore, it would be great if PowerShell Studio would give me a way to highlighty all unused variables and/or functions so that code can be cleaned up.

I know I can setup some pre-flight checks for this but would love to have it directly in the editor.

Thanks in advance for considering this.

User avatar
davidc
Posts: 5913
Joined: Thu Aug 18, 2011 4:56 am

Re: Unused variables and/or functions

Post by davidc » Fri Jun 09, 2017 10:03 am

Have you tried the PSScriptAnalayzer module? It performs validates tests on scripts. Once installed, you can trigger it from PowerShell Studio (Tools->Validation->Analyze Script) or automatically when you run a script.
David
SAPIEN Technologies, Inc.

User avatar
PsCustomObject
Posts: 80
Joined: Tue Apr 29, 2014 1:55 am

Re: Unused variables and/or functions

Post by PsCustomObject » Fri Jun 09, 2017 1:28 pm

Thanks David,

yep I'm aware of the module, even if I will admit never used within PSS which I will remediate soon, what I was referring was something more "real time".

More often than not I don't run scripts from within PSS for a variety of reasons, so having red/green/blue squiggly underlines would be a real time saver for me, what I usually do is copying/pasting code to Visual Studio Code which does this natively.

I can live without the feature as PSS already saves me TONS of time when coding but avoid the extra step would be great addition :-)

User avatar
davidc
Posts: 5913
Joined: Thu Aug 18, 2011 4:56 am

Re: Unused variables and/or functions

Post by davidc » Fri Jun 09, 2017 2:36 pm

Thank you for the feedback. We will see what we can do.
David
SAPIEN Technologies, Inc.

Locked