Skip to content

Conversation

@rulasg
Copy link
Owner

@rulasg rulasg commented Aug 8, 2025

Improve the structure and readability of the Sync-IncludeWithModule code by refining function definitions, enhancing error handling, and ensuring consistent formatting. This refactor aims to streamline the module's functionality and maintainability.

@@ -1,16 +1,13 @@
Write-Information -Message ("Loading {0} ..." -f ($PSScriptRoot | Split-Path -Leaf)) -InformationAction continue
Write-Information -Message ("Loading {0} ..." -f ($PSCommandPath | Split-Path -LeafBase)) -InformationAction continue

Check warning

Code scanning / PSScriptAnalyzer

Cmdlet 'Write-Information' may be used incorrectly. Please check that all mandatory parameters are supplied. Warning

Cmdlet 'Write-Information' may be used incorrectly. Please check that all mandatory parameters are supplied.
[CmdletBinding()]
param(
[Parameter(Mandatory,ValueFromPipeline,Position = 0)]
[string]$Path

Check warning

Code scanning / PSScriptAnalyzer

Command accepts pipeline input but has not defined a process block. Warning

Command accepts pipeline input but has not defined a process block.
$path = $path | Split-Path -Parent
continue
}

Check notice

Code scanning / PSScriptAnalyzer

Line has trailing whitespace Note

Line has trailing whitespace
)

# If folderName is not empty
if($FolderName -ne $null){

Check warning

Code scanning / PSScriptAnalyzer

$null should be on the left side of equality comparisons. Warning

$null should be on the left side of equality comparisons.
return $MODULE_NAME
}

function Get-ModuleFolder{

Check notice

Code scanning / PSScriptAnalyzer

The cmdlet 'Get-ModuleFolder' does not have a help comment. Note

The cmdlet 'Get-ModuleFolder' does not have a help comment.
$path = $path | Split-Path -Parent
continue
}

Check notice

Code scanning / PSScriptAnalyzer

Line has trailing whitespace Note

Line has trailing whitespace
)

# If folderName is not empty
if($FolderName -ne $null){

Check warning

Code scanning / PSScriptAnalyzer

$null should be on the left side of equality comparisons. Warning

$null should be on the left side of equality comparisons.
return $MODULE_NAME
}

function Get-ModuleFolder{

Check notice

Code scanning / PSScriptAnalyzer

The cmdlet 'Get-ModuleFolder' does not have a help comment. Note

The cmdlet 'Get-ModuleFolder' does not have a help comment.

$function = "Invoke-$($MODULE_NAME)GetDbRootPath"
if(-not (Test-Path -Path function:$function)){

Check notice

Code scanning / PSScriptAnalyzer

Line has trailing whitespace Note

Line has trailing whitespace
}
Rename-Item -path Function:Reset-MyModuleDatabaseStore -NewName "Reset-$($moduleName)DatabaseStore"
Export-ModuleMember -Function "Reset-$($moduleName)DatabaseStore"

Check notice

Code scanning / PSScriptAnalyzer

Line has trailing whitespace Note

Line has trailing whitespace
@rulasg rulasg merged commit 709b14b into main Aug 8, 2025
3 checks passed
@rulasg rulasg deleted the sync-include branch August 8, 2025 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant