<commit_before># Description
#
# The anti-pattern file is a text file that is read line by line.
# A hash at the beginning of a line (blank characters are allowed before) marks
# the line as a comment. Comments are not read and skipped. Means they are
# processed as if the line does not exist.
# Characters can be encoded hexadecimal.
# 
#     e.g. \x<HEX> (\x23 = #, \x20 = space) 
# 
# The anti-pattern are organized in sections.
# A section begins after a blank line or if the line does not begin with a blank
# character. Therefore, the subsequent lines of a section are indented.
# If a line is to be continued exactly, the line must begin with blanks and
# '...'. The line is then continued with the first character after '...'.
#
# The section of a anti-pattern has three and more lines.
# 
#     line 1: file filter
# 
# - space characters are separators
# - every part of the filter must start with a directive
# - backslash / slash are identical
# - placeholders * and ? are supported
# - delimiter + (include) and - (exclude)
# 
#     line 2 and more: primary pattern, optional partial patterns (sub-pattern)
#     
# - primary pattern is the main pattern (always an include)
#   The match found is then searched for Partial patterns.
#   Partial patterns can be inclusions and exclusions. Inclusions must begin
#   with + and - begin exclusions. The primary pattern has no directive.
#   All partial patterns must be true, only then is the action executed.
# - patterns are separated by white spaces
#   In a pattern, spaces must be encoded hexadecimal.
#
# AVOID LOOKBEHIND AT THE BEGINNING AND LOOKAHEAD AT THE END!
# THE PATTERNS ARE FOUND, EXTRACTED TO REPLACE BUT DO NOT FIT, BECAUSE MATCH
# STARTS AFTER LOOKBEHIND AND ENDS BEFORE LOOKAHEAD. 
#   
#     last line: action
#     
# The action is primarily a regular replacement, corresponding to the search
# pattern. When replacing, the groups and the backward references of the primary
# pattern can be used. Secondary patterns cannot be used.
# The action always starts with a command that can be followed by spaces and
# then other arguments.
# 
#     The following additional actions are supported:
#     
#     TEST <replacment>
# Displays a preview of the replacement without performing the replacement.    
#     
#     REMOVE
#     PATCH
# Deletes the match.
# No further arguments are expected.
# 
#     PRINT <message>
# Displays a information about a location without performing a replacement.
# 
#     PATCH <replacement>
# Performs the replacement if the replacement is allowed as a program argument.
# Otherwise, the command behaves like TEST.


# examples for java ============================================================

# finds capitalized variables
# include all *.java files, ignore all .svn directories
#+ *.java
#    private\s+[A-Za-z]+\s[A-Z][\w]+;
#    PRINT check it, uncapitalize

# finds constants without final
# include all *.java files, ignore all .svn directories
#+ *.java
#    \x20+(\x20+[a-z]+){1,}\x20+[A-Z]{2,} -\sfinal\s
#    PRINT check it, use 'final' for constants

# finds constants without static
# include all *.java files, ignore all .svn directories
#+ *.java
#    \x20+(\x20+[a-z]+){1,}\x20+[A-Z]{2,} -\sstatic\s
#    PRINT check it, use 'static' for constants

# finds class|interface|enun with invalid name
# include all *.java files, ignore all .svn directories
#+ *.java
#    \s(class|interface|enun)\s+[A-Z]*[a-zA-Z0-9]*[A-Z]{2}
#    PRINT check it, use camel case for class/interface/enum

# finds class|interface|enun with invalid name
# include all *.java files, ignore all .svn directories
#+ *.java
#    \s(class|interface|enun)\s+(?i)[a-z0-9]*[^a-z0-9\s]
#    PRINT check it, use only chars a-z, 0-9 for class/interface/enum

# finds all new Boolean(true) and replace in Boolean.TRUE 
# include all *.java files, ignore all .svn directories
#+ *.java    
#    new\s+Boolean\(\s*true\s*\)
#    PATCH Boolean.TRUE

# finds all new Boolean(false) and replace in Boolean.FALSE
# include all *.java files, ignore all .svn directories
#+ *.java    
#    new\s+Boolean\s*\(\s*false\s*\)
#    PATCH Boolean.FALSE
  
# finds all the places where 'valueOf' can be used and correct it  
# include all *.java files, ignore all .svn directories
#+ *.java    
#    new\s+(Boolean|Byte|Character|Double|Float|Integer|Long|Short)\s*\(
#    PATCH $1.valueOf(    


# examples for html ============================================================

# finds a-tag where the title-attribute ist empty or missing 
# include all *.html files, ignore all .svn directories
#+ *.html
#  (?i)<\s*a[^>]+> -(?i)\btitle="[^"]+"
#  PRINT check it, a-tag with invalid title-attribute

# finds a-tag where the href-attribute ist empty or missing
# include all *.html files, ignore all .svn directories
#+ *.html
#  (?i)<\s*a[^>]+> -(?i)\bhref="[^"]+"
#  PRINT check it, a-tag with invalid href-attribute

# finds input-tags without label-tag
# include all *.html files, ignore all .svn directories
#+ *.html
#   <\s*[^/].*?\s*<input -<\s*label
#  PRINT check it, use input alway with a label


# examples for properties ======================================================

# only 7-bit characters (x0D x0A x20-x7F xA7) are used
+ *.properties
    ([\x80-\xFF])
    PRINT Check and add a rule<commit_msg>#0000 Optimization of syntax for continuing lines<commit_after># Description
#
# The anti-pattern file is a text file that is read line by line.
# A hash at the beginning of a line (blank characters are allowed before) marks
# the line as a comment. Comments are not read and skipped. Means they are
# processed as if the line does not exist.
# Characters can be encoded hexadecimal.
# 
#     e.g. \x<HEX> (\x23 = #, \x20 = space) 
# 
# The anti-pattern are organized in sections.
# A section begins after a blank line or if the line does not begin with a blank
# character. Therefore, the subsequent lines of a section are indented.
# If a line is to be continued exactly, the line must begin with blanks and
# '...'. The line is then continued with the first character after '...'.
#
# The section of a anti-pattern has three and more lines.
# 
#     line 1: file filter
# 
# - space characters are separators
# - every part of the filter must start with a directive
# - backslash / slash are identical
# - placeholders * and ? are supported
# - delimiter + (include) and - (exclude)
# 
#     line 2 and more: primary pattern, optional partial patterns (sub-pattern)
#     
# - primary pattern is the main pattern (always an include)
#   The match found is then searched for Partial patterns.
#   Partial patterns can be inclusions and exclusions. Inclusions must begin
#   with + and - begin exclusions. The primary pattern has no directive.
#   All partial patterns must be true, only then is the action executed.
# - patterns are separated by white spaces
#   In a pattern, spaces must be encoded hexadecimal.
#
# AVOID LOOKBEHIND AT THE BEGINNING AND LOOKAHEAD AT THE END!
# THE PATTERNS ARE FOUND, EXTRACTED TO REPLACE BUT DO NOT FIT, BECAUSE MATCH
# STARTS AFTER LOOKBEHIND AND ENDS BEFORE LOOKAHEAD. 
#   
#     last line: action
#     
# The action is primarily a regular replacement, corresponding to the search
# pattern. When replacing, the groups and the backward references of the primary
# pattern can be used. Secondary patterns cannot be used.
# The action always starts with a command that can be followed by spaces and
# then other arguments.
# 
#     The following additional actions are supported:
#     
#     TEST <replacment>
# Displays a preview of the replacement without performing the replacement.    
#     
#     REMOVE / PATCH
# Deletes the match.
# No further arguments are expected.
# 
#     PRINT <message>
# Displays a information about a location without performing a replacement.
# 
#     PATCH <replacement>
# Performs the replacement if the replacement is allowed as a program argument.
# Otherwise, the command behaves like TEST.


# examples for java ============================================================

# finds capitalized variables
# include all *.java files, ignore all .svn directories
# + *.java
# private\s+[A-Za-z]+\s[A-Z][\w]+;
# PRINT check it, uncapitalize

# finds constants without final
# include all *.java files, ignore all .svn directories
# + *.java
# \x20+(\x20+[a-z]+){1,}\x20+[A-Z]{2,} -\sfinal\s
# PRINT check it, use 'final' for constants

# finds constants without static
# include all *.java files, ignore all .svn directories
# + *.java
# \x20+(\x20+[a-z]+){1,}\x20+[A-Z]{2,} -\sstatic\s
# PRINT check it, use 'static' for constants

# finds class|interface|enun with invalid name
# include all *.java files, ignore all .svn directories
# + *.java
# \s(class|interface|enun)\s+[A-Z]*[a-zA-Z0-9]*[A-Z]{2}
# PRINT check it, use camel case for class/interface/enum

# finds class|interface|enun with invalid name
# include all *.java files, ignore all .svn directories
# + *.java
# \s(class|interface|enun)\s+(?i)[a-z0-9]*[^a-z0-9\s]
# PRINT check it, use only chars a-z, 0-9 for class/interface/enum

# finds all new Boolean(true) and replace in Boolean.TRUE 
# include all *.java files, ignore all .svn directories
# + *.java
# new\s+Boolean\(\s*true\s*\)
# PATCH Boolean.TRUE

# finds all new Boolean(false) and replace in Boolean.FALSE
# include all *.java files, ignore all .svn directories
# + *.java
# new\s+Boolean\s*\(\s*false\s*\)
# PATCH Boolean.FALSE
  
# finds all the places where 'valueOf' can be used and correct it  
# include all *.java files, ignore all .svn directories
# + *.java
# new\s+(Boolean|Byte|Character|Double|Float|Integer|Long|Short)\s*\(
# PATCH $1.valueOf(


# examples for html ============================================================

# finds a-tag where the title-attribute ist empty or missing 
# include all *.html files, ignore all .svn directories
# + *.html
# (?i)<\s*a[^>]+> -(?i)\btitle="[^"]+"
# PRINT check it, a-tag with invalid title-attribute

# finds a-tag where the href-attribute ist empty or missing
# include all *.html files, ignore all .svn directories
# + *.html
# (?i)<\s*a[^>]+> -(?i)\bhref="[^"]+"
# PRINT check it, a-tag with invalid href-attribute

# finds input-tags without label-tag
# include all *.html files, ignore all .svn directories
# + *.html
# <\s*[^/].*?\s*<input -<\s*label
# PRINT check it, use input alway with a label


# examples for properties ======================================================

# only 7-bit characters (x0D x0A x20-x7F xA7) are used
+ *.properties
([\x80-\xFF])
PRINT Check and add a rule
{'fraction_non_alphanumeric': 0.14162724692526016, 'fraction_numerical': 0.008136234626300852, 'mean_word_length': 3.6815766164747563, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4294616', 'n_tokens_mistral': 3335, 'n_tokens_neox': 3137, 'n_words': 1311}