@@ -685,33 +685,32 @@ with Overcommit without writing any Ruby code in a similar way as
685685
686686These special line-aware command hooks behave and are configured the same way
687687as 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 :
690690- differentiating between warnings and errors becomes possible
691691- modified lines can be detected and acted upon as defined by
692692 the `problem_on_unmodified_line`, `requires_files`, `include` and `exclude`
693693 [hook options](#hook-options)
694694
695695**Warning**: Only the command's standard output stream is considered for now,
696696*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.
701697
702698To differentiate between warning and error messages,
703699the `warning_message_type_pattern` option may be specified :
704700the `type` field of the `message_pattern` regexp below must then include
705701the `warning_message_type_pattern` option's text.
706702
707703The `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
709705a `file` [named capture group][RubyRENCG].
710706The only other allowed ones are `line` and `type`, which when specified
711707enable detection of modified lines and warnings respectively.
712708
713- **Note**: The default value for this option is often adequate:
714- it generalizes the quasi-standard [GNU/Emacs-style error format][GNUEerrf],
709+ **Tip**: The following value for this option is often adequate:
710+ ` ` ` ruby
711+ /^(?<file>(?:\w :)?[^:]+):(?<line>\d +):[^ ]* (?<type>[^ ]+)/
712+ ` ` `
713+ It generalizes the quasi-standard [GNU/Emacs-style error format][GNUEerrf],
715714adding the most frequently used warning syntax to it.
716715
717716For example :
0 commit comments