File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -56,12 +56,13 @@ jobs:
5656 git config user.name "github-actions[bot]"
5757 git config user.email "github-actions[bot]@users.noreply.github.com"
5858 git add src/PluginRegistry/PluginHashGenerator.Generated.cs
59- if git diff --staged --quiet; then
60- echo "No changes to commit"
61- else
59+ $hasChanges = git diff --staged --quiet; $LASTEXITCODE -ne 0
60+ if ($hasChanges) {
6261 git commit -m "chore: update plugin hashes [skip ci]"
6362 git push
64- fi
63+ } else {
64+ Write-Host "No changes to commit"
65+ }
6566
6667 - name : Upload artifact
6768 uses : actions/upload-artifact@v4
Original file line number Diff line number Diff line change @@ -153,24 +153,11 @@ public void ClearCache ()
153153 /// <returns>Number of entries removed</returns>
154154 public int RemoveExpiredEntries ( )
155155 {
156- var removedCount = 0 ;
157- var keysToRemove = new List < string > ( ) ;
158156
159- foreach ( var kvp in _cache )
160- {
161- if ( ! IsCacheValid ( kvp . Value ) )
162- {
163- keysToRemove . Add ( kvp . Key ) ;
164- }
165- }
157+ var keysToRemove = _cache . Where ( kvp => ! IsCacheValid ( kvp . Value ) ) . Select ( kvp => kvp . Key ) . ToList ( ) ;
166158
167- foreach ( var key in keysToRemove )
168- {
169- if ( _cache . TryRemove ( key , out _ ) )
170- {
171- removedCount ++ ;
172- }
173- }
159+ var removedCount = 0 ;
160+ removedCount = keysToRemove . Select ( key => _cache . TryRemove ( key , out _ ) ) . Count ( removed => removed ) ;
174161
175162 if ( removedCount > 0 )
176163 {
Original file line number Diff line number Diff line change @@ -243,12 +243,9 @@ public bool Validate (out List<string> errors)
243243 // Validate permissions if present
244244 if ( Permissions != null && Permissions . Count > 0 )
245245 {
246- foreach ( var permission in Permissions )
246+ foreach ( var permission in Permissions . Where ( p => ! IsValidPermission ( p ) ) )
247247 {
248- if ( ! IsValidPermission ( permission ) )
249- {
250- errors . Add ( $ "Invalid permission: { permission } ") ;
251- }
248+ errors . Add ( $ "Invalid permission: { permission } ") ;
252249 }
253250 }
254251
Original file line number Diff line number Diff line change @@ -922,19 +922,16 @@ public void CleanupPlugins ()
922922 // Call lifecycle Shutdown
923923 if ( _useLifecycleHooks )
924924 {
925- foreach ( var columnizer in RegisteredColumnizers )
925+ foreach ( var lifecycle in RegisteredColumnizers . OfType < IPluginLifecycle > ( ) )
926926 {
927- if ( columnizer is IPluginLifecycle lifecycle )
927+ try
928928 {
929- try
930- {
931- lifecycle . Shutdown ( ) ;
932- _logger . Debug ( "Called Shutdown on plugin" ) ;
933- }
934- catch ( Exception ex )
935- {
936- _logger . Error ( ex , "Plugin Shutdown failed" ) ;
937- }
929+ lifecycle . Shutdown ( ) ;
930+ _logger . Debug ( "Called Shutdown on plugin" ) ;
931+ }
932+ catch ( Exception ex )
933+ {
934+ _logger . Error ( ex , "Plugin Shutdown failed" ) ;
938935 }
939936 }
940937 }
You can’t perform that action at this time.
0 commit comments