Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Would a linter that sorts interface method signatures be useful?#5890

Unanswered
ingoaf asked this question inLinter Ideas
Discussion options

In our projects we have interfaces defined which can have more than 10 method signatures. Even though interfaces should generally not be big, for our use case it makes sense because each interface corresponds to a grpc client.

For readability it would be nice to have the method signatures of these interfaces sorted.

Is there a linter already that does that (I went through the list of linters in the docs, but could not find one which does this) and if not, would such a linter be considered useful?

You must be logged in to vote

Replies: 2 comments 1 reply

Comment options

ldez
Jun 23, 2025
Maintainer

Hello,

I don't remember an existing linter about that.

This is a niche style, because as you said, interfaces should be small.
I'm afraid to send a wrong message with a linter like that about interface size.

Could you explain how ordering the signatures can be a readability improvement?

You must be logged in to vote
0 replies
Comment options

In our case the interfaces contain method signatures representing crud operations of related objects, f.e. Delivery, Delivery Note, Delivery Positions. etc. If all these method signatures are listed in random order it is hard to find a particular method f.e. to check if it was already added before or to view the signature just by looking at the interface code. If the method signatures were sorted it would be easier to accomplish.

I understand your argumentation so far and would also understand if you said a linter like that is not wanted.

You must be logged in to vote
1 reply
@ldez
Comment options

ldezJun 23, 2025
Maintainer

If all these method signatures are listed in random order, it is hard to find a particular method

This is why interfaces should be small and focused on a specific behavior.
But I also can understand that it can be difficult, in some contexts, to have small interfaces.

So, I will say "maybe", I need to think more about the topic.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Labels
None yet
2 participants
@ingoaf@ldez

[8]ページ先頭

©2009-2025 Movatter.jp