Skip to content

Commit 47d0863

Browse files
authored
Merge pull request #21038 from github/path-combine-name-desc-update
Clarify Path.Combine call behavior
2 parents da99bbf + a3c0082 commit 47d0863

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

csharp/ql/src/Bad Practices/PathCombine.ql

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/**
2-
* @name Call to System.IO.Path.Combine
3-
* @description Finds calls to System.IO.Path's Combine method
2+
* @name Call to 'System.IO.Path.Combine' may silently drop its earlier arguments
3+
* @description 'Path.Combine' may silently drop its earlier arguments
4+
* if its later arguments are absolute paths.
45
* @kind problem
56
* @problem.severity recommendation
67
* @precision very-high
@@ -15,4 +16,4 @@ import semmle.code.csharp.frameworks.System
1516

1617
from MethodCall call
1718
where call.getTarget().hasFullyQualifiedName("System.IO", "Path", "Combine")
18-
select call, "Call to 'System.IO.Path.Combine'."
19+
select call, "Call to 'System.IO.Path.Combine' may silently drop its earlier arguments."
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
category: queryMetadata
3+
---
4+
* Updated the `name`, `description`, and alert message of `cs/path-combine` to have more details about why it's a problem.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
| PathCombine.cs:7:9:7:54 | call to method Combine | Call to 'System.IO.Path.Combine'. |
1+
| PathCombine.cs:7:9:7:54 | call to method Combine | Call to 'System.IO.Path.Combine' may silently drop its earlier arguments. |

0 commit comments

Comments
 (0)