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

legacy_cggeometry_functions autocorrect doesn't correct when functions are used #2103

Closed
2 tasks done
marcelofabri opened this issue Mar 18, 2018 · 4 comments
Closed
2 tasks done
Labels
bug Unexpected and reproducible misbehavior. wontfix Issues that became stale and were auto-closed by a bot.

Comments

@marcelofabri
Copy link
Collaborator

New Issue Checklist

Bug Report

#2098, but for legacy_cggeometry_functions

Complete output when running SwiftLint, including the stack trace and command used
$ swiftlint --path file.swift 
Loading configuration from '.swiftlint.yml'
Linting Swift files at path file.swift
Linting 'file.swift' (1/1)
file.swift:1:1: warning: Legacy CGGeometry Functions Violation: Struct extension properties and methods are preferred over legacy functions (legacy_cggeometry_functions)
Done linting! Found 1 violation, 0 serious in 1 file.

$ swiftlint autocorrect --path file.swift
Loading configuration from '.swiftlint.yml'
Correcting Swift files at path file.swift
Correcting 'file.swift' (1/1)
Done correcting 1 files!

Environment

  • SwiftLint version (run swiftlint version to be sure)? 0.25.0
  • Installation method used (Homebrew, CocoaPods, building from source, etc)? CP
  • Paste your configuration file:

No configuration file needed

No

  • Which Xcode version are you using (check xcode-select -p)? 9.2
  • Do you have a sample that shows the issue? Run echo "[string here]" | swiftlint lint --no-cache --use-stdin --enable-all-rules
    to quickly test if your example is really demonstrating the issue. If your example is more
    complex, you can use swiftlint lint --path [file here] --no-cache --enable-all-rules.
// this triggers a violation but doesn't autocorrect
CGRectIsNull(foo())
@jszumski
Copy link
Contributor

This may be more systemic... I'm seeing autocorrect failing on many but not all rules (e.g., redundant_void_return works). Each of these examples triggers a linter warning but doesn't autocorrect:

joined_default_parameter

["1", "2"].joined(separator: "")

empty_enum_arguments:

enum Foo {
    case bar(String)
}

func f(foo: Foo) {
    switch foo {
    case .bar(_):
        break
    }
}

empty_parentheses_with_trailing_closure:

func f() {
    [1, 2].map( ) { $0 + 1 }
}

@marcelofabri
Copy link
Collaborator Author

@jszumski I know that this is a lot to ask, but can you please open one issue per rule you're seeing this (with examples)?

I've tried the examples you've provided and it really seems they're not being autocorrected.

@marcelofabri
Copy link
Collaborator Author

marcelofabri commented Mar 27, 2018

Actually, joined_default_parameter works for me. It works with the provided example, but fails once it's inside a function.

@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
@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
Labels
bug Unexpected and reproducible misbehavior. wontfix Issues that became stale and were auto-closed by a bot.
Projects
None yet
Development

No branches or pull requests

2 participants