class Object

Constants

Censored_phrases
De_command

though newcommand could gobble both parameters…

De_comment
De_math
De_verb
Gedit_Mode

if run with -g, insert a space between line and column, so that gedit linkparser.py at least parses the file and line number

Gem_Ruleset_Path

enough that the main code can find these rules.

Gem_Rulesets
Input_files
PathList
PctCensored_phrases
PreCensored_phrases

Public Instance Methods

do_cns(line, file, linenum, phra_hash) click to toggle source
# File lib/style-check.rb, line 171
def do_cns(line, file, linenum, phra_hash)
  # if line =~ /\\caption/ && file =~ /Mapping/ then
    # puts "validating: '#{line}'"
  # end
  m = nil
  r = nil # so we can keep it as a side-effect of the detect call
  detected = nil
  windows_detect_bug_avoider = nil
  # if m = $prefilter.match(line) then
    if(detected = phra_hash.keys.detect { |r| m = r.match(line) and (line.index("\n") == nil or m.begin(0) < line.index("\n"))  } ) then
      matchedlines = ( m.end(0) <= ( line.index("\n") or 0 ) ) ? line.gsub(/\n.*/,'') : line.chomp
      puts "%s:%d:%s%d: %s (%s)" % [ file, linenum, Gedit_Mode ? ' ': '', m.begin(0)+1, matchedlines, m.to_s.tr("\n", ' ') ]
      $exit_status = 1 if(!phra_hash[detected] =~ /\?\s*$/) 
      if($VERBOSE && phra_hash[detected]) then
        puts "  " + phra_hash[detected]
        phra_hash[detected] = nil # don't print the reason more than once
      end
    end
  # end
end