<commit_before>// Copyright 2013 The lime Authors.
// Use of this source code is governed by a 2-clause
// BSD-style license that can be found in the LICENSE file.

package main

import (
	"bytes"
	"go/format"
	"io/ioutil"
	"log"
	"os"
	"path/filepath"
	"strconv"
	"strings"
	"time"
)

var year = strconv.FormatInt(int64(time.Now().Year()), 10)
var licenseheader = []byte(`// Copyright ` + year + ` The lime Authors.
// Use of this source code is governed by a 2-clause
// BSD-style license that can be found in the LICENSE file.
`)

func patch(path string, fi os.FileInfo, err error) error {
	if fi.IsDir() {
		switch filepath.Base(path) {
		case "testdata":
			return filepath.SkipDir
		case "packages":
			if !strings.Contains(path, "lib/") {
				return filepath.SkipDir
			}
		}
		return nil
	}

	switch filepath.Ext(path) {
	case ".go", ".c", ".cpp":
	default:
		return nil
	}

	changed := false
	cmp, err := ioutil.ReadFile(path)
	if err != nil {
		return err<commit_msg>build/fix.go: skip vendor sub-dir<commit_after>// Copyright 2013 The lime Authors.
// Use of this source code is governed by a 2-clause
// BSD-style license that can be found in the LICENSE file.

package main

import (
	"bytes"
	"go/format"
	"io/ioutil"
	"log"
	"os"
	"path/filepath"
	"strconv"
	"strings"
	"time"
)

var year = strconv.FormatInt(int64(time.Now().Year()), 10)
var licenseheader = []byte(`// Copyright ` + year + ` The lime Authors.
// Use of this source code is governed by a 2-clause
// BSD-style license that can be found in the LICENSE file.
`)

func patch(path string, fi os.FileInfo, err error) error {
	if fi.IsDir() {
		switch filepath.Base(path) {
		case "testdata":
			return filepath.SkipDir
		case "vendor":
			return filepath.SkipDir
		case "packages":
			if !strings.Contains(path, "lib/") {
				return filepath.SkipDir
			}
		}
		return nil
	}

	switch filepath.Ext(path) {
	case ".go", ".c", ".cpp":
	default:
		return nil
	}

	changed := false
	cmp, err := ioutil.ReadFile(path)
	if err != nil {
		return err
{'fraction_non_alphanumeric': 0.13577799801783944, 'fraction_numerical': 0.009910802775024777, 'mean_word_length': 3.2684989429175477, 'pattern_counts': {'":': 7, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1487632', 'n_tokens_mistral': 774, 'n_tokens_neox': 712, 'n_words': 234}