Skip to content

Commit

Permalink
Merge pull request #5513 from microsoft/Dev
Browse files Browse the repository at this point in the history
Release 1.24.1204.1
  • Loading branch information
ykuijs authored Dec 4, 2024
2 parents d16e3e1 + eb5bdb6 commit f9e085d
Show file tree
Hide file tree
Showing 480 changed files with 18,568 additions and 8,846 deletions.
67 changes: 67 additions & 0 deletions .vscode/CustomRules/UseCorrectMethodCasing.psm1
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<#
.SYNOPSIS
Use correct method casing in the method name.
.DESCRIPTION
Methods called on an object should use the correct casing (PascalCase) for the method name.
.EXAMPLE
$MyInvocation.MyCommand.ModuleName.Replace('MSFT_', '')
$MyInvocation.MyCommand.ModuleName.replace('MSFT_', '')
The first example is correct, the second example is incorrect.
#>

function Use-CorrectMethodCasing {
[CmdletBinding()]
[OutputType([Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic.DiagnosticRecord[]])]
param (
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[System.Management.Automation.Language.ScriptBlockAst]
$ScriptBlockAst
)

Process
{
$results = @()
try
{
[System.Management.Automation.Language.InvokeMemberExpressionAst[]]$memberAst = $ScriptBlockAst.FindAll({$Args[0].GetType().Name -eq 'InvokeMemberExpressionAst'}, $true)

foreach ($member in $memberAst)
{
if ($member.Member.Value -cmatch '^[a-z]') {
[int]$startLineNumber = $member.Extent.StartLineNumber
[int]$endLineNumber = $member.Extent.EndLineNumber
[int]$startColumnNumber = $member.Extent.StartColumnNumber
[int]$endColumnNumber = $member.Extent.EndColumnNumber
[string]$file = $MyInvocation.MyCommand.Definition

$correctedString = $member.Member.Value.Substring(0, 1).ToUpper() + $member.Member.Value.Substring(1)
[string]$correction = $member.Extent.Text.Replace($member.Member.Value, $correctedString)
[string]$optionalDescription = "Replace '$($member.Member.Value)' with '$($member.Member.Value.Substring(0, 1).ToUpper() + $member.Member.Value.Substring(1))'."
$objParams = @{
TypeName = 'Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic.CorrectionExtent'
ArgumentList = $startLineNumber, $endLineNumber, $startColumnNumber,
$endColumnNumber, $correction, $file, $optionalDescription
}
$correctionExtent = New-Object @objParams
$suggestedCorrections = New-Object System.Collections.ObjectModel.Collection[$($objParams.TypeName)]
$suggestedCorrections.Add($correctionExtent) | Out-Null

$results += [Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic.DiagnosticRecord]@{
Message = 'Use correct method casing in the method name.'
Extent = $member.Extent
RuleName = $PSCmdlet.MyInvocation.InvocationName
Severity = 'Warning'
SuggestedCorrections = $suggestedCorrections
}
}
}
}
catch
{
$PSCmdlet.ThrowTerminatingError( $_ )
}

return $results
}
}
16 changes: 12 additions & 4 deletions .vscode/ScriptAnalyzerSettings.psd1
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
@{
Severity = @('Error',
'Warning')
ExcludeRules = @('PSMissingModuleManifestField',
Severity = @(
'Error',
'Warning'
)
ExcludeRules = @(
'PSMissingModuleManifestField',
'PSUseShouldProcessForStateChangingFunctions',
'PSAvoidGlobalVars',
'PSAvoidUsingWriteHost')
'PSAvoidUsingWriteHost'
)
CustomRulePath = @(
'.vscode\CustomRules\UseCorrectMethodCasing.psm1'
)
IncludeDefaultRules = $true
}
46 changes: 46 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,47 @@
# Change log for Microsoft365DSC

# 1.24.1204.1

* All resources
* Applying project default formatting on all files, to improve
reading and troubleshooting.
* AADAccessReviewDefinition
* Added support for #microsoft.graph.accessReviewInactiveUsersQueryScope in odatatype.
* AADActivityBasedTimeoutPolicy
* Added support for AccessTokens.
* AADClaimsMappingPolicy
* Fixed policy retrieval
FIXES [#5505](https://github.com/microsoft/Microsoft365DSC/issues/5505)
* AADIdentityAPIConnector
* Changed the export logic to export passwords as credential objects instead of string.
* AADRoleManagementPolicyRule
* Added the logic to handle filters in the Export logic flow.
* EXOAuthenticationPolicyAssignment
* Added $confirm flag to the Set-TargetResource function for PowerShell 7 compatibility.
* EXOClientAccessRule
* Added $confirm flag to the Set-TargetResource function for PowerShell 7 compatibility.
* EXOManagementRoleAssignment
* Changed logic to detect drift.
* EXOServicePrincipal
* Removed ObjectID from the return of the Get-TargetResource method.
* EXOTeamsProtectionPolicy
* Initial release
FIXES [#5296](https://github.com/microsoft/Microsoft365DSC/issues/5296)
* EXOTransportRule
* Fixed conditional logic for creation and update.
* IntuneTrustedRootCertificateIOS
* Initial release
* IntuneVPNConfigurationPolicyIOS
* Initial release.
* M365DSCRuleEvaluation
* Only attempt to pass AccessTokens if specified.
* SPORetentionLabelsSettings
* Initial release.
* MISC
* M365DSCDRGUtil
* Add separate check for strings with ordinal comparison and standardized line breaks.


# 1.24.1127.1

* AAD
Expand Down Expand Up @@ -36,6 +78,10 @@
* Improve verbose output and fix copy-pasted variables.
* IntuneRoleScopeTag
* Initial release.
* IntuneTrustedRootCertificateAndroidDeviceOwner
* Initial release.
* IntuneTrustedRootCertificateAndroidEnterprise
* Initial release.
* TeamsUserPolicyAssignment
* Added support for the Global policies.
* TeamsUpgradePolicy
Expand Down
Loading

0 comments on commit f9e085d

Please sign in to comment.