We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Child of #8452 Check documentation: https://checkstyle.sourceforge.io/config_sizes.html#MethodLength
From check documentation: Checks for long methods and constructors.
➜ full-record-grammar /usr/lib/jvm/java-14-openjdk/bin/javac --enable-preview --source 14 TestClass.java Note: TestClass.java uses preview language features. Note: Recompile with -Xlint:preview for details. ➜ full-record-grammar cat config.xml <?xml version="1.0"?> <!DOCTYPE module PUBLIC "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN" "https://checkstyle.org/dtds/configuration_1_3.dtd"> <module name="Checker"> <module name="TreeWalker"> <module name="MethodLength"> <property name="tokens" value="METHOD_DEF,CTOR_DEF"/> <property name="max" value="2"/> </module> </module> </module> ➜ full-record-grammar cat TestClass.java class MyTestClass { void foo(){ // violation System.out.println("test"); System.out.println("test"); System.out.println("test"); } MyTestClass() { // violation System.out.println("test"); System.out.println("test"); System.out.println("test"); } } // ctor record MyTestRecord() { public MyTestRecord(){ // violation System.out.println("test"); System.out.println("test"); System.out.println("test"); } } //compact ctor record MyTestRecord2() { public MyTestRecord2{ // should be a violation System.out.println("test"); System.out.println("test"); System.out.println("test"); } } //method record MyTestRecord3() { void foo(){ // violation System.out.println("test"); System.out.println("test"); System.out.println("test"); } } ➜ full-record-grammar java $RUN_LOCALE -jar ~/IdeaProjects/checkstyle/target/checkstyle-8.35-SNAPSHOT-all.jar -c config.xml TestClass.java Starting audit... [ERROR] /home/nick/Desktop/full-record-grammar/TestClass.java:2:5: Method length is 5 lines (max allowed is 2). [MethodLength] [ERROR] /home/nick/Desktop/full-record-grammar/TestClass.java:7:5: Method length is 6 lines (max allowed is 2). [MethodLength] [ERROR] /home/nick/Desktop/full-record-grammar/TestClass.java:18:5: Method length is 5 lines (max allowed is 2). [MethodLength] [ERROR] /home/nick/Desktop/full-record-grammar/TestClass.java:37:5: Method length is 5 lines (max allowed is 2). [MethodLength] Audit done. Checkstyle ends with 4 errors.
This check works as intended within the body of a record definition, but we need to add support for compact constructors.
The text was updated successfully, but these errors were encountered:
Issue checkstyle#8519: Records support check update for MethodLengthC…
2f37fb4
…heck
Issue #8519: Records support check update for MethodLengthCheck
382d60c
fix is merged.
Sorry, something went wrong.
3d20a49
No branches or pull requests
Child of #8452
Check documentation: https://checkstyle.sourceforge.io/config_sizes.html#MethodLength
From check documentation:
Checks for long methods and constructors.
This check works as intended within the body of a record definition, but we need to add support for compact constructors.
The text was updated successfully, but these errors were encountered: