Skip to content
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 support for "warnings as errors" #365

Merged
merged 5 commits into from
Sep 10, 2022
Merged

Conversation

Kyle-Ye
Copy link
Collaborator

@Kyle-Ye Kyle-Ye commented Aug 22, 2022

Bug/issue #, if applicable:
Close #363

Summary

Add a new flag "--warnings-as-errors" for "docc convert" Command.

If this flag is set, the engine will treat the warning severity level as an error severity level

Forum discussion post: https://forums.swift.org/t/add-support-for-warnings-as-errors/59832

Dependencies

None

Testing

  1. git clone https://github.com/apple/swift-markdown.git
  2. Generate swift-markdown's symbol-graph
  3. Run
docc convert swift-markdown/Sources/Markdown/Markdown.docc`
--fallback-display-name SwiftDocC
--fallback-bundle-identifier org.swift.SwiftDocC 
--fallback-bundle-version 1.0.0
--additional-symbol-graph-dir xx/swift-markdown.build/Debug/Markdown.build/symbol-graph

and see a list of warnings.
4. Run

docc convert swift-markdown/Sources/Markdown/Markdown.docc`
--fallback-display-name SwiftDocC
--fallback-bundle-identifier org.swift.SwiftDocC 
--fallback-bundle-version 1.0.0
--additional-symbol-graph-dir xx/swift-markdown.build/Debug/Markdown.build/symbol-graph
--warnings-as-errors

and see all the warnings are treated as errors.

Checklist

Make sure you check off the following items. If they cannot be completed, provide a reason.

  • Added tests
  • Ran the ./bin/test script and it succeeded
  • Updated documentation if necessary

@Kyle-Ye
Copy link
Collaborator Author

Kyle-Ye commented Aug 22, 2022

@swift-ci please test

@ethan-kusters
Copy link
Contributor

Looks great! Thank you for opening this Kyle. Do you mind starting a thread on the Swift Forums about the intended user-experience here? Something along the lines of: https://forums.swift.org/t/adding-links-to-source-files-in-swift-docc/58587.

I think we should let folks on the forums weigh in on the naming and behavior of command-line option.

@Kyle-Ye
Copy link
Collaborator Author

Kyle-Ye commented Aug 23, 2022

Looks great! Thank you for opening this Kyle. Do you mind starting a thread on the Swift Forums about the intended user-experience here? Something along the lines of: https://forums.swift.org/t/adding-links-to-source-files-in-swift-docc/58587.

I think we should let folks on the forums weigh in on the naming and behavior of command-line option.

Yes, that's great. The forum post is here.

https://forums.swift.org/t/add-support-for-warnings-as-errors/59832

@Kyle-Ye
Copy link
Collaborator Author

Kyle-Ye commented Aug 23, 2022

@swift-ci please test macOS

@Kyle-Ye
Copy link
Collaborator Author

Kyle-Ye commented Aug 31, 2022

@swift-ci please test

@Kyle-Ye
Copy link
Collaborator Author

Kyle-Ye commented Aug 31, 2022

@swift-ci please test

@Kyle-Ye
Copy link
Collaborator Author

Kyle-Ye commented Aug 31, 2022

Update naming according to the forum post feedback. Could you help review this? @franklinsch

Copy link
Member

@franklinsch franklinsch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking really great, thanks @Kyle-Ye! Just have a few minor bits of feedback.

@Kyle-Ye
Copy link
Collaborator Author

Kyle-Ye commented Sep 8, 2022

@swift-ci please test

@Kyle-Ye
Copy link
Collaborator Author

Kyle-Ye commented Sep 8, 2022

Rebase to main and add a new commit to fix the comment suggestions cc @franklinsch

@Kyle-Ye
Copy link
Collaborator Author

Kyle-Ye commented Sep 9, 2022

@swift-ci please test

@Kyle-Ye
Copy link
Collaborator Author

Kyle-Ye commented Sep 9, 2022

@d-ronnqvist Any other Code Review suggestion for this? If you are OK with it, I'll merge it this Sunday.

@Kyle-Ye
Copy link
Collaborator Author

Kyle-Ye commented Sep 9, 2022

@swift-ci please test macOS

@d-ronnqvist
Copy link
Contributor

@d-ronnqvist Any other Code Review suggestion for this? If you are OK with it, I'll merge it this Sunday.

No other suggestions. Thanks.

@Kyle-Ye
Copy link
Collaborator Author

Kyle-Ye commented Sep 9, 2022

@swift-ci please test

@Kyle-Ye Kyle-Ye merged commit 566a177 into apple:main Sep 10, 2022
@Kyle-Ye Kyle-Ye deleted the warning-as-error branch September 10, 2022 05:02
@tinder-cfuller
Copy link

How to treat warnings as errors when using docbuild for iOS?

xcodebuild docbuild -scheme "Example" -destination "generic/platform=iOS"

@Kyle-Ye
Copy link
Collaborator Author

Kyle-Ye commented Mar 10, 2024

How to treat warnings as errors when using docbuild for iOS?

xcodebuild docbuild -scheme "Example" -destination "generic/platform=iOS"

This question is better asked in Apple's Developer forums or via a DTS. @tinder-cfuller

But anyway I have tried it on Xcode 15.2 and the following answer should apply.

  • For Xcode GUI:
    • First locate - Build Settings - Documentation Compiler Options - Other DocC Flags
    • Then add --warnings-as-errors to the field list

image

  • For xcodebuild:
    • Set OTHER_DOCC_FLAGS to --warnings-as-errors
    • You can also get the full command in your Xcode GUI's build log.

@tinder-cfuller
Copy link

@Kyle-Ye Thank you for your thorough answer! While this may not have been the best place for me to ask, the excellent info you provided may help others who end up here looking for the same thing. Thank you for taking the time to comment!! Very much appreciated. ⭐

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for "warnings as errors"
5 participants