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

New check: Trailing comma in enum similar to array initializer #464

Open
kariem opened this issue Jul 22, 2016 · 7 comments
Open

New check: Trailing comma in enum similar to array initializer #464

kariem opened this issue Jul 22, 2016 · 7 comments
Labels

Comments

@kariem
Copy link
Contributor

kariem commented Jul 22, 2016

copied from checkstyle/checkstyle#3161

Similar to ArrayTrailingComma there should be a check for trailing commas in enum constants. A lot of enums are used to map to values from somewhere else and it might be necessary to adapt them often.

The check verifies that the last element of a multi-line enum constant definition has a comma:

Check ok:

enum MovieTypes {
  GOOD,
  BAD,
  UGLY,
  ;
}

Check failed:

enum ErrorMessages {
  USER_DOES_NOT_EXIST,
  INVALID_USER_PASS,
  EVERYTHING_ELSE;
}

I stumbled across this while writing how to check for trailing commas in arrays and enums based on an article discussion JavaScript.

@romani
Copy link
Member

romani commented Jul 23, 2016

please review recent issues to see what is required to discuss (names, config) before implementation to avoid extra coding/refactoring/.... .

kariem added a commit to kariem/sevntu.checkstyle that referenced this issue Jul 29, 2016
This checks that the last enum constant definition in a multi-line enum ends in a comma:

    enum E1 {
        ONE,
        TWO,
        THREE,
    }

Addresses sevntu-checkstyle#464
kariem added a commit to kariem/sevntu.checkstyle that referenced this issue Jul 29, 2016
This checks that the last enum constant definition in a multi-line enum ends in a comma:

    enum E1 {
        ONE,
        TWO,
        THREE,
    }

Addresses sevntu-checkstyle#464
kariem added a commit to kariem/sevntu.checkstyle that referenced this issue Aug 1, 2016
This checks that the last enum constant definition in a multi-line enum ends in a comma:

    enum E1 {
        ONE,
        TWO,
        THREE,
    }

Addresses sevntu-checkstyle#464
kariem added a commit to kariem/sevntu.checkstyle that referenced this issue Aug 5, 2016
Provide examples for the check and extend the rationale behind it.

Addresses sevntu-checkstyle#464
kariem added a commit to kariem/sevntu.checkstyle that referenced this issue Aug 5, 2016
The default branch on the previous switch did not do anything and should not have raised an exception, which would be invalid for single-line enums.

Addresses sevntu-checkstyle#464
kariem added a commit to kariem/sevntu.checkstyle that referenced this issue Aug 5, 2016
kariem added a commit to kariem/sevntu.checkstyle that referenced this issue Aug 26, 2016
kariem added a commit to kariem/sevntu.checkstyle that referenced this issue Oct 20, 2016
This Check assures that the last enum constant definition in a multi-line enum ends in a comma:

    enum E1 {
        ONE,
        TWO,
        THREE,
    }

Original PR: sevntu-checkstyle#465

2016-07-29 -- 2016-08-26
kariem added a commit to kariem/sevntu.checkstyle that referenced this issue Dec 4, 2016
This Check assures that the last enum constant definition in a multi-line enum ends in a comma:

    enum E1 {
        ONE,
        TWO,
        THREE,
    }

Original PR: sevntu-checkstyle#465

2016-07-29 -- 2016-08-26
kariem added a commit to kariem/sevntu.checkstyle that referenced this issue Dec 4, 2016
This Check assures that the last enum constant definition in a multi-line enum ends in a comma:

    enum E1 {
        ONE,
        TWO,
        THREE,
    }

Original PR: sevntu-checkstyle#465

2016-07-29 -- 2016-08-26
kariem added a commit to kariem/sevntu.checkstyle that referenced this issue Dec 4, 2016
kariem added a commit to kariem/sevntu.checkstyle that referenced this issue Dec 4, 2016
kariem added a commit to kariem/sevntu.checkstyle that referenced this issue Jul 26, 2018
kariem added a commit to kariem/sevntu.checkstyle that referenced this issue Aug 1, 2018
kariem added a commit to kariem/sevntu.checkstyle that referenced this issue Aug 2, 2018
kariem added a commit to kariem/sevntu.checkstyle that referenced this issue Aug 2, 2018
kariem added a commit to kariem/sevntu.checkstyle that referenced this issue Sep 13, 2018
kariem added a commit to kariem/sevntu.checkstyle that referenced this issue Sep 13, 2018
kariem added a commit to kariem/sevntu.checkstyle that referenced this issue Oct 5, 2018
kariem added a commit to kariem/sevntu.checkstyle that referenced this issue Oct 5, 2018
kariem added a commit to kariem/sevntu.checkstyle that referenced this issue Oct 5, 2018
kariem added a commit to kariem/sevntu.checkstyle that referenced this issue Oct 8, 2018
kariem added a commit to kariem/sevntu.checkstyle that referenced this issue Oct 8, 2018
kariem added a commit to kariem/sevntu.checkstyle that referenced this issue Oct 11, 2018
kariem added a commit to kariem/sevntu.checkstyle that referenced this issue Oct 16, 2018
kariem added a commit to kariem/sevntu.checkstyle that referenced this issue Oct 17, 2018
kariem added a commit to kariem/sevntu.checkstyle that referenced this issue Oct 17, 2018
kariem added a commit to kariem/sevntu.checkstyle that referenced this issue Oct 17, 2018
kariem added a commit to kariem/sevntu.checkstyle that referenced this issue Oct 17, 2018
kariem added a commit to kariem/sevntu.checkstyle that referenced this issue Oct 17, 2018
kariem added a commit to kariem/sevntu.checkstyle that referenced this issue Oct 21, 2018
kariem added a commit to kariem/sevntu.checkstyle that referenced this issue Oct 21, 2018
kariem added a commit to kariem/sevntu.checkstyle that referenced this issue Oct 21, 2018
kariem added a commit to kariem/sevntu.checkstyle that referenced this issue Oct 22, 2018
kariem added a commit to kariem/sevntu.checkstyle that referenced this issue Oct 23, 2018
kariem added a commit to kariem/sevntu.checkstyle that referenced this issue Oct 23, 2018
kariem added a commit to kariem/sevntu.checkstyle that referenced this issue Oct 23, 2018
kariem added a commit to kariem/sevntu.checkstyle that referenced this issue Oct 25, 2018
@romani
Copy link
Member

romani commented May 19, 2019

Referenced PR was not finished (but functionally it works, but still require minor changes to be completed) and abandoned .... . Everyone is welcome to continue.

@romani
Copy link
Member

romani commented Dec 30, 2019

https://checkstyle.org/config_coding.html#UnnecessarySemicolonInEnumeration is about ; .... so Check for trailing comma , is still in demand.

@DmytroBarabash
Copy link

Hey @kariem @yaziza
I think it is a great idea to implement this Check (I even created a similar issue, but @rnveach suggested writing here first)
Maybe we need one more small step to finish this job eventually. I'd like to take part in it if possible.
What blocks the final implementation/merge now, and how could I help?

@kariem
Copy link
Contributor Author

kariem commented Oct 18, 2022

@DmytroBarabash I have created #465, #474, #709, #722 to address this issue and with every change the maintainers found new things that needed to be addressed before merging anything. Effectively, this was not much work on the implementation side. However, the requests in the PRs increased the required work by at least a magnitude. Instead of just changing wording here or there to better fit with what the maintainers expected, there were just more and more changes after addressing an issue. I did not see an end to the additional requested changes and it did not seem as if the work put into the changes were appreciated at all. The last comment even suggested to just rename everything, more than 2 years after the first commit.

@DmytroBarabash
Copy link

@kariem I see. I read one of those threads. My condolences. Now I understand why checktyle still doesn't have so useful check. When you expected an easy walk, but it turned out that you have to fight a dragon (
But probably we still have a chance to finish it? Which PR could be re-opened and re-reviewed, and finally merged to deliver the EnumTrailingCommaCheck to master? @rnveach could you please help us with these tasks?
This story is already too long and deserves a happy ending )

@romani
Copy link
Member

romani commented Oct 18, 2022

Please do not expect quick progress as maintainers of this project are same as checkstyle/checkstyle repository. There are huge amounts of issues and PRs.
But we appreciate you persistence to finish. It can take awhile, but please keep pushing.

Please review review all PRs, grab code from them, do all changes that were requested but not done, make code as if it would be your code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants