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

Validate typealias naming #49

Closed
jpsim opened this issue May 28, 2015 · 6 comments
Closed

Validate typealias naming #49

jpsim opened this issue May 28, 2015 · 6 comments
Labels
rule-request Requests for a new rules.

Comments

@jpsim
Copy link
Collaborator

jpsim commented May 28, 2015

Sort of depends on rdar://18845613 getting fixed.

@jpsim jpsim added the rule-request Requests for a new rules. label May 28, 2015
@jpsim
Copy link
Collaborator Author

jpsim commented Nov 18, 2015

I don't know why I said this depended on rdar://18845613, that's an unrelated radar.

@masters3d
Copy link
Contributor

To be uppercase? any other validations?

@jpsim
Copy link
Collaborator Author

jpsim commented Aug 26, 2016

same naming rules as types.

@marcelofabri
Copy link
Collaborator

I think TypeNameRule covers this, doesn't it?

@jpsim
Copy link
Collaborator Author

jpsim commented Nov 25, 2016

No.

$ echo "typealias myType = Void" | swiftlint lint --use-stdin 
Done linting! Found 0 violations, 0 serious in 1 file.

@marcelofabri
Copy link
Collaborator

Apparently, SourceKit doesn't provide info about typealias so we'd need to do that manually:

$ sourcekitten structure --text "typealias myType = Void"  
{
  "key.offset" : 0,
  "key.diagnostic_stage" : "source.diagnostic.stage.swift.parse",
  "key.length" : 23
}


$ sourcekitten syntax --text "typealias myType = Void"    
[
  {
    "offset" : 0,
    "length" : 9,
    "type" : "source.lang.swift.syntaxtype.keyword"
  },
  {
    "offset" : 10,
    "length" : 6,
    "type" : "source.lang.swift.syntaxtype.identifier"
  },
  {
    "offset" : 19,
    "length" : 4,
    "type" : "source.lang.swift.syntaxtype.typeidentifier"
  }
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rule-request Requests for a new rules.
Projects
None yet
Development

No branches or pull requests

3 participants