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

swiftlint_version silently ignores incorrectly typed values #2518

Closed
2 tasks done
skagedal opened this issue Dec 20, 2018 · 1 comment
Closed
2 tasks done

swiftlint_version silently ignores incorrectly typed values #2518

skagedal opened this issue Dec 20, 2018 · 1 comment

Comments

@skagedal
Copy link

New Issue Checklist

Describe the bug

SwiftLint has a mechanism for pinning the tool to a specific version in the config file. One may write like this:

swiftlint_version: 0.29.1

And it will only run with that version of SwiftLint. If you write like this instead:

swiftlint_version: 0.29

It will also run. The user may think, as I did, that it has accepted 0.29.1 as being "at least" 0.29. That is however not what's happening, instead it is parsing 0.29 as a float and silently ignoring the directive. See Configuration+Parsing.swift, line 99.

Complete output when running SwiftLint, including the stack trace and command used
$ swiftlint version
0.29.1
$ echo 'swiftlint_version: 0.29.1' > .swiftlint.yml
$ swiftlint                                        
Loading configuration from '.swiftlint.yml'
Linting Swift files at paths 
No lintable files found at paths: ''
$ echo 'swiftlint_version: 0.30.1' > .swiftlint.yml
$ swiftlint                                        
Loading configuration from '.swiftlint.yml'
Currently running SwiftLint 0.29.1 but configuration specified version 0.30.1.
$ echo 'swiftlint_version: 0.30' > .swiftlint.yml 
$ swiftlint                                      
Loading configuration from '.swiftlint.yml'
Linting Swift files at paths 
No lintable files found at paths: ''

Expected: that the last invocation of SwiftLint either printed "Currently running SwiftLint 0.29.1 but configuration specified version 0.30" or failed with "incorrect format for .swiftlint.yml"

Environment

  • SwiftLint version (run swiftlint version to be sure)?
    0.29.1

  • Installation method used (Homebrew, CocoaPods, building from source, etc)?
    Homebrew

  • Paste your configuration file:
    As above

  • Are you using nested configurations?
    If so, paste their relative paths and respective contents.
    No

  • Which Xcode version are you using (check xcode-select -p)?
    10.1

@jpsim
Copy link
Collaborator

jpsim commented Dec 23, 2018

Fix incoming in #2523.

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

No branches or pull requests

2 participants