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

Release and Bitrise builds fail on any Swiftlint violation #577

Merged
merged 5 commits into from
Feb 18, 2020

Conversation

tomasstrba
Copy link
Contributor

@tomasstrba tomasstrba commented Feb 14, 2020

Description: If there is any Swiftlint warning present, release and Bitrise build will fail.

Steps to test this PR:

  1. Add one unnecessary space between methods and run the app
  2. Compilation should be successful with one warning
  3. Archiving should fail

Internal references:

Software Engineering Expectations
Technical Design Template

@bwaresiak
Copy link
Collaborator

@tomasstrba good job 👍 One optional idea: could we check type of lint failure (maybe looking at return codes) and then echo out some more verbose error e.g. echo "error: SwiftLint validation failed"?

@tomasstrba
Copy link
Contributor Author

@bwaresiak thanks for approval.

When I look at return codes of swiftlint, there are just three:

  • 1 - Usage or system error
  • 2 - Style violations of severity "Error"
  • 3 - Violations of severity "warning" with --strict mode

Do you think it will tell us more information? Output already contains
"Done linting! Found X violation, Y serious in Z files."

@bwaresiak
Copy link
Collaborator

@tomasstrba when I look at output of a (failed) Archive operation I see:

errors

and in the console:

Linting 'DisplayableCertificateExtensionTests.swift' (351/352)
Linting 'AtbParserTests.swift' (352/352)
Done linting! Found 1 violation, 0 serious in 352 files.
Command PhaseScriptExecution failed with a nonzero exit code

I think we could make it more clear, for instance by adding:

if ! swiftlint lint --strict; then
    echo "error: SwiftLint validation failed."
    exit 1
fi

we get following errors in Xcode:

errors2

Linting 'DisplayableCertificateExtensionTests.swift' (351/352)
Linting 'AtbParserTests.swift' (352/352)
Done linting! Found 1 violation, 0 serious in 352 files.
error: SwiftLint validation failed.

What do you think?

@tomasstrba
Copy link
Contributor Author

tomasstrba commented Feb 18, 2020

@bwaresiak thank you, it's more clear now. You are right, adding specific error message helps when working in Xcode. 👍

I only added error message, no need to test again.

@tomasstrba tomasstrba merged commit a1f16b9 into develop Feb 18, 2020
@tomasstrba tomasstrba deleted the feature/tom/swiftlint-strict branch February 18, 2020 19:58
pull bot referenced this pull request in scope-demo/DuckDuckGo-iOS Feb 18, 2020
gaborszakacs pushed a commit to bitrise-io/DuckDuckGo-iOS that referenced this pull request Nov 15, 2020
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.

None yet

2 participants