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 should emit cursor output like compilers do #2268

Closed
1 of 2 tasks
lilyball opened this issue Jun 25, 2018 · 3 comments
Closed
1 of 2 tasks

SwiftLint should emit cursor output like compilers do #2268

lilyball opened this issue Jun 25, 2018 · 3 comments

Comments

@lilyball
Copy link

New Issue Checklist

Enhancement Request

When SwiftLint emits a warning or error, it would be great if it could include the line of code and a cursor like compilers do.

For example, with the following Swift compiler output:

Untitled.swift:1:4: error: binary operator '+' cannot be applied to operands of type 'Int' and 'String'
23 + "foo"
~~ ^ ~~~~~

the ~~ ^ ~~~~~ is the cursor, and it's preceded by the line of code in question.

The reason I want this output is primarily because xcpretty apparently requires it in order to actually display warnings/errors. Without this, xcpretty is completely swallowing up all SwiftLint output.

@jpsim
Copy link
Collaborator

jpsim commented Nov 27, 2018

This is a great idea! Especially useful too if you're using SwiftLint from the command line and fixing violations in an editor other than Xcode, which I do from time to time.

If you have some time, this would be a fantastic contribution.

A good place to start would be to take a look at a similar function we use in our tests to render violations inline with the content. It's quite simple, it's called render(violations:in:) and outputs violations in this format:

func abc(){
          ^ warning: Opening Brace Spacing Violation: Opening braces should be preceded by a single space and on the same line as the declaration. (opening_brace)
}

@lilyball
Copy link
Author

I'd still really love to see this, though I don't have time to work on it myself.

@stale
Copy link

stale bot commented Nov 8, 2020

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!

@stale stale bot added the wontfix label Nov 8, 2020
@stale stale bot closed this as completed Nov 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants