[ 
https://issues.apache.org/jira/browse/OPENNLP-1935?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18125789#comment-18125789
 ] 

ASF GitHub Bot commented on OPENNLP-1935:
-----------------------------------------

mawiesne commented on code in PR #1348:
URL: https://github.com/apache/opennlp/pull/1348#discussion_r4233413715


##########
.github/CONTRIBUTING.md:
##########
@@ -9,3 +9,7 @@ To make the process smooth for the project *committers* (those 
who review and ac
 Please check out the [How to get 
involved](http://opennlp.apache.org/get-involved.html) to understand how 
contributions are made. 
 A detailed list of coding standards can be found at [Apache OpenNLP Code 
Conventions](http://opennlp.apache.org/code-conventions.html) which also 
contains a list of coding guidelines that you should follow.
 For pull requests, there is a [check list](PULL_REQUEST_TEMPLATE.md) with 
criteria for acceptable contributions.
+
+## Regular expressions in production code
+
+OpenNLP production code scans text with code-point loops and the helpers in 
`opennlp.tools.util.StringUtil` (for example `splitOnUnicodeWhitespace` and 
`split(CharSequence, char)`) instead of `java.util.regex`. The build enforces 
this with forbiddenapis: `dev/forbidden-regex.txt` lists the forbidden 
signatures, and the `forbidden-regex-main` execution in the root `pom.xml` 
checks production classes in the `process-classes` phase (tests are not 
checked). An exception exists only for a member with a documented public 
contract that is a user-supplied regular expression, such as the patterns given 
to `RegexNameFinder`; mark that member (not the class) with 
`@opennlp.tools.commons.SuppressForbidden("reason")`. A private pattern, or one 
that is an implementation detail, is converted to a scan, not annotated: the 
check's report is the list of what remains to convert. See OPENNLP-1935 for the 
background.

Review Comment:
   Please don't write all of this in a single line. Break after full stops or a 
max length of 120ish characters.





> RegEx removal part 10: forbiddenapis guard for java.util.regex in production 
> code
> ---------------------------------------------------------------------------------
>
>                 Key: OPENNLP-1935
>                 URL: https://issues.apache.org/jira/browse/OPENNLP-1935
>             Project: OpenNLP
>          Issue Type: Improvement
>          Components: Build, Packaging and Test
>            Reporter: Kristian Rickert
>            Assignee: Kristian Rickert
>            Priority: Major
>             Fix For: 3.0.0
>
>          Time Spent: 1h
>  Remaining Estimate: 0h
>
> Once this is done, let's put safeguards in place to prevent regex during the 
> build except for the spots we have exceptions.  It's too easy and standard in 
> the language to add them.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to