// ParsePaths parses all files provided and returns the number of files with violations
ParsePaths parses all files provided and returns the number of files with violations
// ParsePaths parses all files provided and returns the number of files with violations
func (p *Parser) ParsePaths(print printer.Printer, paths ...string) int {
	if util.InSlice(os.Stdin.Name(), paths) {
		r, _ := p.generateFileViolations(os.Stdin)
		if r.Len() > 0 {
			print.Print(output.Stdout, r)
		}
		return r.Len()
	}
	if len(paths) == 0 {
		paths = DefaultPath
	}
	var wg sync.WaitGroup
	done := make(chan bool)
	defer close(done)
	for _, path := range paths {
		wg.Add(1)
		go func(path string) {
			defer wg.Done()
			p.processViolationInPath(path, done)
		}(path)
	}
	go func() {
		wg.Wait()
		close(p.rchan)
	}()
	violations := 0
	for r := range p.rchan {
		sort.Sort(r)
		print.Print(output.Stdout, &r)
		violations++
	}
	return violations
}
func ( p * Parser ) ParsePaths ( print printer . Printer , paths ... string ) int { if util . InSlice ( os . Stdin . Name ( ) , paths ) { r , _ := p . generateFileViolations ( os . Stdin ) if r . Len ( ) > 0 { print . Print ( output . Stdout , r ) } return r . Len ( ) } if len ( paths ) == 0 { paths = DefaultPath } var wg sync . WaitGroup done := make ( chan bool ) defer close ( done ) for _ , path := range paths { wg . Add ( 1 ) go func ( path string ) { defer wg . Done ( ) p . processViolationInPath ( path , done ) } ( path ) } go func ( ) { wg . Wait ( ) close ( p . rchan ) } ( ) violations := 0 for r := range p . rchan { sort . Sort ( r ) print . Print ( output . Stdout , & r ) violations ++ } return violations }
ParsePaths parses all files provided and returns the number of files with violations
ParsePaths parses all files provided and returns the number of files with violations
// data provided through stdin