-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Use Sourcery to generate LinuxMain.swift & MasterRuleList.swift #1592
Conversation
Here's an example of your CHANGELOG entry: * Use Sourcery to generate LinuxMain.swift & MasterRuleList.swift.
[jpsim](https://github.com/jpsim)
[#issue_number](https://github.com/realm/SwiftLint/issues/issue_number) note: There are two invisible spaces after the entry's text. Generated by 🚫 Danger |
@@ -100,17 +33,17 @@ public let masterRuleList = RuleList(rules: | |||
FileHeaderRule.self, | |||
FileLengthRule.self, | |||
FirstWhereRule.self, | |||
ForWhereRule.self, |
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.
shouldn't we keep the sort order as case insensitive?
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.
Sourcery returns these already sorted, and I don't think there's a way to re-sort. Is this a problem?
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.
no, just wanted to see if it was possible to do it 👍
@@ -28,6 +28,16 @@ VERSION_STRING=$(shell /usr/libexec/PlistBuddy -c "Print :CFBundleShortVersionSt | |||
all: bootstrap | |||
$(BUILD_TOOL) $(XCODEFLAGS) build | |||
|
|||
sourcery: | |||
sourcery --sources Tests --templates .sourcery/LinuxMain.stencil --output .sourcery |
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.
If you add to the top of the template the target file, it will override it instead of creating .generated.swift
// sourcery:file:Tests/LinuxMain.swift
https://twitter.com/ilyapuchka/status/847567291302674434
https://oleb.net/blog/2017/03/keeping-xctest-in-sync/
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.
Thanks for the tip! Although I need to shuffle things around to move the auto-generated Sourcery comments after the header anyways, so it doesn't really help in my case.
); | ||
runOnlyForDeploymentPostprocessing = 0; | ||
shellPath = /bin/sh; | ||
shellScript = "if which sourcery >/dev/null; then\n make sourcery\nelse\n echo \"Sourcery not found, install with 'brew install sourcery'\"\nfi"; |
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.
I know these are minor issues, but:
- Shouldn't we avoid running
sourcery
on CI? - What do you think about making this message a warning?
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.
- Travis doesn't appear to have Sourcery installed.
- It shouldn't be an error (or a warning even) if you don't have Sourcery installed but you're building SwiftLint via Xcode. It's only really useful for contributors.
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.
👍
Feel free to merge it 🎉
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.
Yup, just fixing up the merge conflict now.
This adds 6 tests that were accidentally not being run on Linux: * LineLengthConfigurationTests.testLineLengthConfigurationInitialiserSetsIgnoresComments * LineLengthConfigurationTests.testLineLengthConfigurationInitialiserSetsIgnoresFunctionDeclarations * LineLengthConfigurationTests.testLineLengthConfigurationThrowsOnBadConfigValues * LineLengthRuleTests.testLineLengthWithIgnoreCommentsEnabled * LineLengthRuleTests.testLineLengthWithIgnoreFunctionDeclarationsEnabled * RegionTests.testSeveralRegionsFromSeveralCommands
only runs if Sourcery is installed.
ba05793
to
922a867
Compare
Codecov Report
@@ Coverage Diff @@
## master #1592 +/- ##
==========================================
+ Coverage 84.35% 88.02% +3.66%
==========================================
Files 193 193
Lines 10081 9661 -420
==========================================
Hits 8504 8504
+ Misses 1577 1157 -420
Continue to review full report at Codecov.
|
Extends #1591 by also automatically generating
MasterRuleList.swift