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

Adding a TypeContent case of type_contents_order #5461

Open
2 tasks done
PangYenChen opened this issue Feb 7, 2024 · 7 comments
Open
2 tasks done

Adding a TypeContent case of type_contents_order #5461

PangYenChen opened this issue Feb 7, 2024 · 7 comments

Comments

@PangYenChen
Copy link

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?

@dk-talks
Copy link

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

@PangYenChen
Copy link
Author

PangYenChen commented Mar 30, 2024

The change in the image is enough. Thanks!

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

@SimplyDanny
Copy link
Collaborator

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.

@dk-talks
Copy link

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.

@SimplyDanny
Copy link
Collaborator

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.

dk-talks added a commit to dk-talks/SwiftLint that referenced this issue Apr 2, 2024
@dk-talks
Copy link

dk-talks commented Apr 6, 2024

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?

@SimplyDanny
Copy link
Collaborator

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.

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