Sha256: 103dc4494dee851b1ae85704875455d5e45d38bac2832fbb4c62fcd2a647cd62
Contents?: true
Size: 728 Bytes
Versions: 9
Compression:
Stored size: 728 Bytes
Contents
# frozen_string_literal: true module Overcommit::Hook::PreCommit # Runs `rst-lint` against any modified reStructuredText files # # @see https://github.com/twolfson/restructuredtext-lint class RstLint < Base MESSAGE_REGEX = / ^(?<type>INFO|WARNING|ERROR|SEVERE)(?<file>(?:\w:)?[^:]+):(?<line>\d+)\s(?<msg>.+) /x.freeze def run result = execute(command, args: applicable_files) output = result.stdout.chomp return :pass if result.success? return [:fail, result.stderr] unless result.stderr.empty? # example message: # WARNING README.rst:7 Title underline too short. extract_messages( output.split("\n"), MESSAGE_REGEX ) end end end
Version data entries
9 entries across 9 versions & 2 rubygems