Merge pull request #21038 from github/path-combine-name-desc-update

Clarify Path.Combine call behavior
This commit is contained in:
Tom Hvitved
2025-12-18 12:54:38 +01:00
committed by GitHub
3 changed files with 9 additions and 4 deletions

View File

@@ -1,6 +1,7 @@
/**
* @name Call to System.IO.Path.Combine
* @description Finds calls to System.IO.Path's Combine method
* @name Call to 'System.IO.Path.Combine' may silently drop its earlier arguments
* @description 'Path.Combine' may silently drop its earlier arguments
* if its later arguments are absolute paths.
* @kind problem
* @problem.severity recommendation
* @precision very-high
@@ -15,4 +16,4 @@ import semmle.code.csharp.frameworks.System
from MethodCall call
where call.getTarget().hasFullyQualifiedName("System.IO", "Path", "Combine")
select call, "Call to 'System.IO.Path.Combine'."
select call, "Call to 'System.IO.Path.Combine' may silently drop its earlier arguments."

View File

@@ -0,0 +1,4 @@
---
category: queryMetadata
---
* Updated the `name`, `description`, and alert message of `cs/path-combine` to have more details about why it's a problem.

View File

@@ -1 +1 @@
| PathCombine.cs:7:9:7:54 | call to method Combine | Call to 'System.IO.Path.Combine'. |
| PathCombine.cs:7:9:7:54 | call to method Combine | Call to 'System.IO.Path.Combine' may silently drop its earlier arguments. |