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
In using v0.2.7, Invoke-PSCodehealth is detecting all functions, but it treats them the same. There's nothing wrong with detecting all the functions, but they should be identified as private or public (i.e. exported module member). That way if in an html report I see a private function with no help, I'm not concerned about that. But I would hope that there are a few lines of comments that explain the function which shouldn't be considered a penalty on function length per our other issue.
In the PerFunction section, added a column indicating if the function is exported or not. That would be helpful.
This applies only to modules, but yes, knowing whether a function is public or private is useful information. I'm going to investigate how to implement that.
By the way, how do think this property should be named ? Visibility ?
I think it would still be useful to check private function for help, at least to populate the Per Function Information table but private functions without help could be excluded from the FunctionsWithoutHelp property of the report.
As a relevant sidenote, there is no compliance rule for the FunctionsWithoutHelp metric because, as the docs say :
There is no compliance rule for this metric because it is highly dependent on the total number of functions, and arguably, on the number of public functions.
In other words PSCodeHealth tells the number of functions without help but doesn't tell if it's good or bad.
If we don't count private function in this metric, I guess it would be a good idea to rename it to PublicFunctionsWithoutHelp to make that clear.
And then, having a compliance rule on this PublicFunctionsWithoutHelp metric would make sense.
Since now you seem to be getting a list of all functions, you should also be able to use Get-Command to discover the exported functions and compare. You could use Visibility and Private/Public or Exported with True/False. The functions without help metric should be limited to exported functions.
Activity
MathieuBuisson commentedon Oct 12, 2017
Hi Jeffery,
This applies only to modules, but yes, knowing whether a function is public or private is useful information. I'm going to investigate how to implement that.
By the way, how do think this property should be named ? Visibility ?
I think it would still be useful to check private function for help, at least to populate the Per Function Information table but private functions without help could be excluded from the FunctionsWithoutHelp property of the report.
As a relevant sidenote, there is no compliance rule for the FunctionsWithoutHelp metric because, as the docs say :
In other words
PSCodeHealthtells the number of functions without help but doesn't tell if it's good or bad.If we don't count private function in this metric, I guess it would be a good idea to rename it to PublicFunctionsWithoutHelp to make that clear.
And then, having a compliance rule on this PublicFunctionsWithoutHelp metric would make sense.
Thanks a lot for your feedback.
jdhitsolutions commentedon Oct 12, 2017
Since now you seem to be getting a list of all functions, you should also be able to use Get-Command to discover the exported functions and compare. You could use Visibility and Private/Public or Exported with True/False. The functions without help metric should be limited to exported functions.
MathieuBuisson commentedon Oct 13, 2017
Hi Jeffery,
Yes, I'm gonna go with a property named
Exportedand a boolean value.