SwiftLint icon indicating copy to clipboard operation
SwiftLint copied to clipboard

Adding a TypeContent case of `type_contents_order`

Open PangYenChen opened this issue 1 year ago • 7 comments

Currently the TypeContent of type_contents_order is:

enum TypeContent: String {
    case `case` = "case"
    case typeAlias = "type_alias"
    case associatedType = "associated_type"
    case subtype = "subtype"
    case typeProperty = "type_property"
    case instanceProperty = "instance_property"
    case ibOutlet = "ib_outlet"
    case ibInspectable = "ib_inspectable"
    case initializer = "initializer"
    case typeMethod = "type_method"
    case viewLifeCycleMethod = "view_life_cycle_method"
    case ibAction = "ib_action"
    case otherMethod = "other_method"
    case `subscript` = "subscript"
    case deinitializer = "deinitializer"
}

It distinguishes between ib_outlet and instance_property, ib_action and other_method.

Would it be nice to have ib_segue_action as a case?

PangYenChen avatar Feb 07 '24 13:02 PangYenChen

Hi Do we have to add a new case for 'ib_segue_action'. If so then I am not able to figure out what else is needed to change. I have added an image for the changes I could figure out to make. Thanks Screenshot 2024-03-31 at 1 46 40 AM

dk-talks avatar Mar 30 '24 20:03 dk-talks

The change in the image is enough. Thanks!

By the way, I don't know the proper order of ibSegueAction in the default configuration.

PangYenChen avatar Mar 30 '24 23:03 PangYenChen

Hi Do we have to add a new case for 'ib_segue_action'. If so then I am not able to figure out what else is needed to change. I have added an image for the changes I could figure out to make. Thanks Screenshot 2024-03-31 at 1 46 40 AM

You should also adapt TypeContentsOrderRule.swift, specifically the typeContent method.

And .ibSegueAction should not become part of the default configuration to avoid causing surprises when people update to a newer SwiftLint version.

SimplyDanny avatar Mar 31 '24 10:03 SimplyDanny

Hi @SimplyDanny I was trying to figure out when should I return .ibSegueAction in typeContent method. Will this a part of functionMethodInstance. Or should i return at the place of .otherMethod because as I can see it has no use case as of now.

dk-talks avatar Mar 31 '24 20:03 dk-talks

Hi @SimplyDanny I was trying to figure out when should I return .ibSegueAction in typeContent method. Will this a part of functionMethodInstance. Or should i return at the place of .otherMethod because as I can see it has no use case as of now.

This should be implemented in the same way as it is done for .ibAction.

I think it would be easier to discuss this in a PR.

SimplyDanny avatar Apr 01 '24 21:04 SimplyDanny

Hi, I created a PR but tests were failing and I am not able to figure out why this is happening. I am new to open source. If you got some time from you busy schedule can you please tell me what needs to be taken care of to pass all the tests. Or does it mean my implemetation was wrong?

dk-talks avatar Apr 06 '24 15:04 dk-talks

If you got some time from you busy schedule can you please tell me what needs to be taken care of to pass all the tests. Or does it mean my implemetation was wrong?

I've just given you a hint in the PR.

SimplyDanny avatar Apr 06 '24 15:04 SimplyDanny