This repository has been archived by the owner on Apr 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(GH-37) Add extension for returning file name and path
- Loading branch information
1 parent
e1bc183
commit 5e94212
Showing
4 changed files
with
35 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
namespace Cake.Issues.Reporting.Generic | ||
{ | ||
using Cake.Core.IO; | ||
|
||
/// <summary> | ||
/// Extension for <see cref="IIssue"/>. | ||
/// </summary> | ||
public static class IIssueExtension | ||
{ | ||
/// <summary> | ||
/// Returns the path of the <see cref="IIssue.AffectedFileRelativePath"/>. | ||
/// </summary> | ||
/// <param name="issue">Issue for which the path should be returned.</param> | ||
/// <returns>Path of the file affected by the issue.</returns> | ||
public static string FilePath(this IIssue issue) | ||
{ | ||
return issue.AffectedFileRelativePath?.GetDirectory().FullPath; | ||
} | ||
|
||
/// <summary> | ||
/// Returns the name of the file of the <see cref="IIssue.AffectedFileRelativePath"/>. | ||
/// </summary> | ||
/// <param name="issue">Issue for which the file name should be returned.</param> | ||
/// <returns>Name of the file affected by the issue.</returns> | ||
public static string FileName(this IIssue issue) | ||
{ | ||
return issue.AffectedFileRelativePath?.GetFilename().ToString(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters