-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This change refactors the code for the **Documentarian.DevX** module in
preparation for further refactoring and updates. It: - Standardizes the structure of classes, adding code regions for static properties, static methods, instance properties, instance methods, and constructors in that order. - Standardizes the style for class property declarations using the following template: ```powershell <# .SYNOPSIS Property synopsis. #> hidden # Included only for hidden properties static # Included only for static properties [Attribute()] # Any declared attributes, one per line [Type] # Always defined $PropertyName # Always defined, PascalCased. ``` If the property has a default value, that value is defined after the property name as normal. - Standardizes the style for class method declarations, using the following template: ```powershell hidden static [ReturnType] MethodName( [ParameterOneType] $parameterOne, [ParameterTwoType] $parameterTwo ) { <# .SYNOPSIS Method overload synopsis #> # Method overload body code } ``` Methods always define a return type. Methods that don't return any output use the `[void]` type. Method parameters are always camel-cased and always define a type. If the parameter can be any type, use the `[object]` type. Parameter definitions are always multi-line, with a blank line between parameters. - Standardizes the style for function declarations, using the following template: ``````powershell <# .SYNOPSIS Function synopsis #> [CmdletBinding()] # Always defined, even if empty. [OutputType([Type])] # Always defined, one per line. param( [Parameter()] # Always defined, even if empty. [Attribute()] # One per line, as needed. [ParameterOneType] # Always defined $ParameterOne, [Parameter()] # Always defined, even if empty. [Attribute()] # One per line, as needed. [ParameterTwoType] # Always defined $ParameterTwo ) begin { # Code before all processing, including initializing variables and # defining helper scriptblocks or functions. } process { # Processing code, main body of the function. } end { # Post-processing code. } `````` Functions always use cmdlet binding and define their output type or types. If the function returns no output, the output type is `[void]`. They always define the `param` keyword, even if empty, and use the `begin`, `process`, and `end` keywords. Function parameters are always declared with the `Parameter` attribute, even if it's empty. Every parameter must define a type. If the parameter can be of any type, specify the type as `[object]`. Parameter names are always Pascal-cased and may have default values as normal. - Adds comment-based help to the beginning of the definition for classes, enumerations, functions, and tasks, immediately after the opening of the definition script block. Refactoring the behavior and fully documenting the code will be handled in future changes. These changes are being made first to avoid conflating structural changes with the actual refactoring and improvement work.
- Loading branch information
1 parent
36ae374
commit 627477e
Showing
36 changed files
with
2,021 additions
and
504 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.