Sha256: e05d60339b5e5e48c29dd120d3c35899724ca4f1ebc519f614f46680a043c63d
Contents?: true
Size: 902 Bytes
Versions: 1
Compression:
Stored size: 902 Bytes
Contents
module Bashcov class Lexer def initialize filename @filename = File.expand_path(filename) end def irrelevant_lines lines = [] IO.readlines(@filename).each_with_index do |line, lineno| lines << lineno if is_irrevelant? line end lines end private def is_irrevelant? line line.strip! return true if line.empty? return true if start_with.any? { |token| line.start_with? token } return true if is.any? { |keyword| line =~ /\A#{keyword}\Z/ } return true if line =~ /\A\w+\(\) {/ # function declared like this: "foo() {" false end # Lines containing only one of these keywords are irrelevant for coverage def is %w(esac fi then do done else { }) end # Lines starting with one of these keywords are irrelevant for coverage def start_with %w(# function) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bashcov-0.0.1 | lib/bashcov/lexer.rb |