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

Error parsing .swiftlint.yml with mixed spaces/tabs #308

Closed
NachoSoto opened this issue Jan 3, 2016 · 4 comments
Closed

Error parsing .swiftlint.yml with mixed spaces/tabs #308

NachoSoto opened this issue Jan 3, 2016 · 4 comments
Labels
enhancement Ideas for improvements of existing features and rules.

Comments

@NachoSoto
Copy link
Contributor

I inadvertently introduced mixed spaces/tabs, and suddenly SwiftLint started linting Carthage/Checkouts. I wasn't sure what happened, until I saw this in the output:

expected colon, near "included:\n- Chess\n- ChessAPI\n- ChessAPITests\n- Che..."

My file looked something like this:
screen shot 2016-01-03 at 12 50 34 pm

Once I changed everything to spaces, it started reading the configuration correctly. It took me a big to figure out what was going on, since at first I thought it was due to upgrading SwiftLint to 0.5.4.

I can think of 2 solutions:

  • Short term: fail to lint altogether, with a warning to fix .swiftlint.yml.
  • Longer term: improve parsing of file with mixed indentations.

Let me know if I can help at all 🚶

Thanks!

@jpsim jpsim added the enhancement Ideas for improvements of existing features and rules. label Jan 3, 2016
@jpsim
Copy link
Collaborator

jpsim commented Jan 3, 2016

This is related to #120.

Short term: fail to lint altogether, with a warning to fix .swiftlint.yml.

We currently fail if the file is invalid only if the config file was explicitly given (using --config): https://github.com/realm/SwiftLint/blob/0.5.4/Source/SwiftLintFramework/Models/Configuration.swift#L125-L152

However, I think it'd be more appropriate to always fail if the file was found but could not be parsed.

Longer term: improve parsing of file with mixed indentations.

SwiftLint uses https://github.com/behrang/YamlSwift to parse YAML, so support for mixed indentations should probably be added there.

@NachoSoto
Copy link
Contributor Author

@jpsim thanks! I opened behrang/YamlSwift#17 to track the "longer term" plan.

@jpsim
Copy link
Collaborator

jpsim commented Jan 3, 2016

Cool, since short term has been merged, and long term is being tracked in the appropriate repo, I'll close this. Thanks for reporting!

@jpsim jpsim closed this as completed Jan 3, 2016
@NachoSoto
Copy link
Contributor Author

Thanks for fixing! ⭐

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Ideas for improvements of existing features and rules.
Projects
None yet
Development

No branches or pull requests

2 participants