sailr icon indicating copy to clipboard operation
sailr copied to clipboard

error even if the regex matches

Open BigHoss opened this issue 3 years ago • 2 comments

I implemented the hook and I get an error even it matches.

[Invalid Commit Message]
------------------------
Valid types: build
 ci
 docs
 feat
 fix
 perf
 refactor
 style
 test
 chore
Max length (first line): 52
Min length (first line): 1
Regex: ^[.0-9]+$|build
|ci
|docs
|feat
|fix
|perf
|refactor
|style
|test
|chore)(\(.+\))?: .{1,52}$
Actual commit message: "refactor(async): almost done"
Actual length: 29

and I also dont get it why my regex has line breaks in it

I am on windows

BigHoss avatar Nov 05 '21 10:11 BigHoss

Same issue. The regex seems to be invalid according to https://regex101.com/, since there's an unmatched ellipsis.

cmwolke-gamedesign avatar Jan 11 '22 11:01 cmwolke-gamedesign

  • The regexp start or revert/merge part seem to be incorrect: sailr.sh#L60
    regexp="${regexp}^([Rr]evert|[Mm]erge):? )?.*$|^("
    
  • As noted above, the closing brace between question marks ? )? is unmatched, the expression could be improved in general
  • The opening brace ( was removed in 6d047d022b74403a0c034a6f2a1695b38d7457f0
    @@ -48,10 +48,10 @@ function set_config_values() {
    -  regexp="^("
    +  regexp="^[.0-9]+$|"
    
    -  regexp="${regexp}revert: )?(\w+)("
    +  regexp="${regexp}^([Rr]evert|[Mm]erge):? )?.*$|^("
    

electronum avatar Dec 21 '23 11:12 electronum