[ https://issues.apache.org/jira/browse/LUCENE-10003?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17375864#comment-17375864 ]
David Smiley commented on LUCENE-10003: --------------------------------------- I did some experimentation with using a regexp in {{validate-source-patterns.gradle}} {{invalidJavaOnlyPatterns}} and came up with this: {noformat} (~$/(?m)^(?!\s*(/[/*]|\*).*).*\b\w+\s+\w+(\[])+\s*[=,;]/$) : 'C style array declarations disallowed; move the brackets' {noformat} The first part is a negative lookahead to ensure the line doesn't start with a comment, because there are a number of comments that would otherwise match this expression. There is only one place where there's a false positive (MemoryIndex line 949), and it can be addressed trivially via adding a newline. I'll push a PR that just does the changes, and separately push another PR oriented on the automated detection using the above regexp. > Disallow C-style array declarations > ----------------------------------- > > Key: LUCENE-10003 > URL: https://issues.apache.org/jira/browse/LUCENE-10003 > Project: Lucene - Core > Issue Type: Improvement > Reporter: David Smiley > Assignee: David Smiley > Priority: Minor > > The Google Java Format, that which we adhere to, disallows c-style array > declarations: https://google.github.io/styleguide/javaguide.html#s4.8.3-arrays > It's also known to "Error Prone": > https://errorprone.info/bugpattern/MixedArrayDimensions -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org