@@ -685,32 +685,29 @@ with Overcommit without writing any Ruby code in a similar way as
685
685
686
686
These special line-aware command hooks behave and are configured the same way
687
687
as the Git ones, except only file arguments get passed to them.
688
- Also to enable the feature, they must use at least one of the following options,
689
- so that, using the command output :
688
+ Also to enable them and for optimal use, one must configure them as explained
689
+ below, so that, using the command output :
690
690
- differentiating between warnings and errors becomes possible
691
691
- modified lines can be detected and acted upon as defined by
692
692
the `problem_on_unmodified_line`, `requires_files`, `include` and `exclude`
693
693
[hook options](#hook-options)
694
694
695
695
**Warning**: Only the command's standard output stream is considered for now,
696
696
*not* its standard error stream.
697
- If you do not need to change the default values for any other option,
698
- then the `extract_messages_from` option has to be specified.
699
- Its value does not matter for now, but it should be set to `stdout`
700
- to avoid problems in the future.
701
697
702
698
To differentiate between warning and error messages,
703
699
the `warning_message_type_pattern` option may be specified :
704
700
the `type` field of the `message_pattern` regexp below must then include
705
701
the `warning_message_type_pattern` option's text.
706
702
707
703
The `message_pattern` option specifies the format of the command's messages.
708
- It is a optional [(Ruby) regexp][RubyRE], which if present must at least define
704
+ It is mandatory, must be a [(Ruby) regexp][RubyRE], and must define at least
709
705
a `file` [named capture group][RubyRENCG].
710
706
The only other allowed ones are `line` and `type`, which when specified
711
707
enable detection of modified lines and warnings respectively.
712
708
713
- **Note**: The default value for this option is often adequate:
709
+ **Tip**: The following value for this option is often adequate:\
710
+ ` !ruby/regexp /^(?<file>(?:\w :)?[^:]+):(?<line>\d +):[^ ]* (?<type>[^ ]+)/` :\
714
711
it generalizes the quasi-standard [GNU/Emacs-style error format][GNUEerrf],
715
712
adding the most frequently used warning syntax to it.
716
713
0 commit comments