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

"mark" rule autocorrection is eating preceding comment content #1749

Closed
voidless opened this issue Aug 4, 2017 · 5 comments · Fixed by #3844
Closed

"mark" rule autocorrection is eating preceding comment content #1749

voidless opened this issue Aug 4, 2017 · 5 comments · Fixed by #3844
Labels
bug Unexpected and reproducible misbehavior.

Comments

@voidless
Copy link

voidless commented Aug 4, 2017

Swiftlint 0.21.0
"mark" rule autocorrection work incorrectly for commented out code, it removes all preceding comment content including comment open mark.
It should handle this case properly or ignore commented out code instead

Example:

/*
    func test1() {
    }
//MARK: mark
    func test2() {
    }
*/

Output:

// MARK: mark
    func test2() {
    }
*/
@marcelofabri marcelofabri added the bug Unexpected and reproducible misbehavior. label Aug 4, 2017
@marcelofabri
Copy link
Collaborator

I could reproduce it with 0.21.0.

@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 Issues that became stale and were auto-closed by a bot. label Nov 8, 2020
@voidless
Copy link
Author

voidless commented Nov 9, 2020

I can still reproduce this on latest master (0.41.0) with by adding this corrections example to MarkRule.swift and rerunning tests

            Example("""
            /*
                func test1() {
                }
            ↓//MARK: mark
                func test2() {
                }
            */
            """): Example("""
            /*
                func test1() {
                }
            ↓// MARK: mark
                func test2() {
                }
            */
            """),

@stale stale bot removed the wontfix Issues that became stale and were auto-closed by a bot. label Nov 9, 2020
@stale
Copy link

stale bot commented Jan 8, 2021

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 Issues that became stale and were auto-closed by a bot. label Jan 8, 2021
@stale stale bot closed this as completed Jan 15, 2021
@jpsim jpsim removed the wontfix Issues that became stale and were auto-closed by a bot. label Feb 23, 2021
@jpsim jpsim reopened this Feb 23, 2021
goranche added a commit to goranche/SwiftLint that referenced this issue Feb 5, 2022
@goranche
Copy link
Contributor

goranche commented Feb 5, 2022

I can still reproduce this on latest master (0.41.0) with by adding this corrections example to MarkRule.swift and rerunning tests

I hope you don't mind that I've used your example in the PR 😄

jpsim pushed a commit to goranche/SwiftLint that referenced this issue Mar 4, 2022
jpsim pushed a commit to goranche/SwiftLint that referenced this issue Mar 4, 2022
jpsim pushed a commit that referenced this issue Mar 4, 2022
coffmark pushed a commit to coffmark/SwiftLint that referenced this issue Apr 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unexpected and reproducible misbehavior.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants