realm / SwiftLint

A tool to enforce Swift style and conventions.
https://realm.github.io/SwiftLint
MIT License
18.59k stars 2.22k forks source link

Carthage bootstrap/update fails due to swiftlint up to date #2548

Closed kenji21 closed 3 years ago

kenji21 commented 5 years ago

New Issue Checklist

Describe the bug

When building an old tag of a Framework using Carthage, the swiftlint script build phase can fail because some rules added after the tag matches in the tagged source code. Carthage uses xcodebuild archive and it sets the ACTION environment variable to "install".

First option to solve this issue: swiftlint should skip linting (maybe with a warning) if ACTION environment variable equals to "install" (cf https://help.apple.com/xcode/mac/10.0/#/itcaec37c2a6)

Second option: patch the README to update the script of the "Run Script Phase" to lint only Debug builds as https://github.com/auth0/JWTDecode.swift do :

if if [[ \"${CONFIGURATION}\" = \"Debug\" ]] && which swiftlint >/dev/null; then
  swiftlint
else
  echo "warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint"
fi

A temporary solution is to brew uninstall swiftlint before running carthage and then reinstall it.

Environment

marcelofabri commented 5 years ago

Configuration decisions vary a lot by project, so I'd say it's up to the user to choose how to integrate SwiftLint in the way that fits their workflow better.

kenji21 commented 5 years ago

That's why my preferred solution is the first one : as I have no control over dependencies I want to "archive" when compiling them with Carthage, I can't be sure there take care not to "build fail" because rules of switflint newer than last dependency tag (which they can't know about and fix)

Drusy commented 5 years ago

Having the same problem here, it's sad that an external tool (aka. Carthage) canot build a project for what should be considered as warning instead of errors. Throwing warnings instead of errors in Release configuration is not doable ? This behavior could be the default one and may be prevented by a command line argument ?

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had any recent activity. Please comment to prevent this issue from being closed. Thank you for your contributions!