@@ -683,21 +683,26 @@ with Overcommit without writing any Ruby code in a similar way as
683
683
684
684
These special line-aware command hooks behave and are configured the same way
685
685
as the Git ones, except only file arguments get passed to them.
686
- Also they must have the `ad_hoc` option, so that, using the command output :
686
+ Also to enable the feature, they must use at least one of the following options,
687
+ so that, using the command output :
687
688
- differentiating between warnings and errors becomes possible
688
689
- modified lines can be detected and acted upon as defined by
689
690
the `problem_on_unmodified_line`, `requires_files`, `include` and `exclude`
690
691
[hook options](#hook-options)
691
692
692
693
**Warning**: Only the command's standard output stream is considered for now,
693
694
*not* its standard error stream.
695
+ If you do not need to change the default values for any other option,
696
+ then the `extract_messages_from` option has to be specified.
697
+ Its value does not matter for now, but it should be set to `stdout`
698
+ to avoid problems in the future.
694
699
695
700
To differentiate between warning and error messages,
696
- the `warning_message_type_pattern` suboption may be specified :
701
+ the `warning_message_type_pattern` option may be specified :
697
702
the `type` field of the `message_pattern` regexp below must then include
698
703
the `warning_message_type_pattern` option's text.
699
704
700
- The `message_pattern` suboption specifies the format of the command's messages.
705
+ The `message_pattern` option specifies the format of the command's messages.
701
706
It is a optional [(Ruby) regexp][RubyRE], which if present must at least define
702
707
a `file` [named capture group][RubyRENCG].
703
708
The only other allowed ones are `line` and `type`, which when specified
@@ -714,9 +719,8 @@ PreCommit:
714
719
CustomScript:
715
720
enabled: true
716
721
command: './bin/custom-script'
717
- ad_hoc:
718
- message_pattern: !ruby/regexp /^(?<file>[^:]+):(?<line>[0-9]+):(?<type>[^ ]+)/
719
- warning_message_type_pattern: warning
722
+ message_pattern: !ruby/regexp /^(?<file>[^:]+):(?<line>[0-9]+):(?<type>[^ ]+)/
723
+ warning_message_type_pattern: warning
720
724
` ` `
721
725
722
726
**Tip**: To get the syntax of the regexps right, a Ruby interpreter like `irb`
0 commit comments