-
-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add filetype extensions to modifiedFiles, createdFiles, and deletedFiles #81
Add filetype extensions to modifiedFiles, createdFiles, and deletedFiles #81
Conversation
I must have bad luck: |
Sources/Danger/File.swift
Outdated
// MARK: - FileType | ||
|
||
public enum FileType: String, Equatable { | ||
case h, json, m, markdown = "md", pbxproj, plist, storyboard, swift |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about adding the extensions for .xcscheme
, .yml
and .mm
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds great! One concern is .yml versus .yaml and how to support it in a simple and easy-to-maintain way. Maybe separating them into two different cases? What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, I think that's a good idea 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
Perfect 👍 |
@orta @SD10 Thanks for the quick review! One concern I’ve had lately is that Danger-js errors can make running Danger-Swift more of a maintenance burden than say the original Ruby Danger. Do you think this is something that should be solved by perfecting Danger-js, or perhaps by having Danger-swift eventually run independently of Danger-js? |
Danger JS is less mature, that's all. That bug has been real hard to get in danger-js. FWIW, I'll never build danger for Swift myself, too small of a community (and largely inactive in contributing back) for such a large amount of my time, this technique allows danger-swift to actually exist and to potentially allow it to run on Peril. |
Fair enough. 👍 |
As per #80, I propose to change modifiedFiles, createdFiles, and deletedFiles to be of type
File
from String, adding Name and FileType properties.This will break some Dangerfile workflow, requiring users to potentially have to access the .name property to get a regular string. In return, users a get type-safe enum property called fileType for .h, .json, .m, .markdown, .mm, .pbxproj, .plist, .storyboard, .swift, .xcscheme, .yaml, .yml.
In Ruby, detecting the filetype is rather straightforward because of easy-to-use regex support built right in. Swift, on the other hand, would require users to use the clunky NSRegularExpression class, which is bothersome to do inside the Dangerfile.
Example of use in Dangerfile