More cleaning up
This commit is contained in:
42
main.go
42
main.go
@@ -135,9 +135,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
|
|
||||||
// This will also relieve processor of some of the file loading
|
// TODO: Also give each command its own logger, maybe prefix it with something... Maybe give commands a name?
|
||||||
// But we will also have to rework the tests.......
|
|
||||||
// Also give each command its own logger, maybe prefix it with something... Maybe give commands a name?
|
|
||||||
// Do that with logger.WithField("loglevel", level.String())
|
// Do that with logger.WithField("loglevel", level.String())
|
||||||
// Since each command also has its own log level
|
// Since each command also has its own log level
|
||||||
// TODO: Maybe even figure out how to run individual commands...?
|
// TODO: Maybe even figure out how to run individual commands...?
|
||||||
@@ -161,12 +159,6 @@ func main() {
|
|||||||
// return
|
// return
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// if len(files) == 0 {
|
|
||||||
// logger.Warning("No files found matching the specified patterns")
|
|
||||||
// fmt.Fprintf(os.Stderr, "No files found matching the specified patterns\n")
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if *gitFlag {
|
// if *gitFlag {
|
||||||
// logger.Info("Cleaning up git files before processing")
|
// logger.Info("Cleaning up git files before processing")
|
||||||
// err := cleanupGitFiles(files)
|
// err := cleanupGitFiles(files)
|
||||||
@@ -182,38 +174,6 @@ func main() {
|
|||||||
// return
|
// return
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// Process each file
|
|
||||||
// for _, file := range files {
|
|
||||||
// wg.Add(1)
|
|
||||||
// logger.SafeGoWithArgs(func(args ...interface{}) {
|
|
||||||
// defer wg.Done()
|
|
||||||
// fileToProcess := args[0].(string)
|
|
||||||
// logger.Debug("Processing file: %s", fileToProcess)
|
|
||||||
|
|
||||||
// // It's a bit fucked, maybe I could do better to call it from proc... But it'll do for now
|
|
||||||
// modCount, matchCount, err := processor.Process(proc, fileToProcess, pattern, luaExpr)
|
|
||||||
// if err != nil {
|
|
||||||
// logger.Error("Failed to process file %s: %v", fileToProcess, err)
|
|
||||||
// fmt.Fprintf(os.Stderr, "Failed to process file %s: %v\n", fileToProcess, err)
|
|
||||||
// stats.FailedFiles++
|
|
||||||
// } else {
|
|
||||||
// if modCount > 0 {
|
|
||||||
// logger.Info("Successfully processed file %s: %d modifications from %d matches",
|
|
||||||
// fileToProcess, modCount, matchCount)
|
|
||||||
// } else if matchCount > 0 {
|
|
||||||
// logger.Info("Found %d matches in file %s but made no modifications",
|
|
||||||
// matchCount, fileToProcess)
|
|
||||||
// } else {
|
|
||||||
// logger.Debug("No matches found in file: %s", fileToProcess)
|
|
||||||
// }
|
|
||||||
// stats.ProcessedFiles++
|
|
||||||
// stats.TotalMatches += matchCount
|
|
||||||
// stats.TotalModifications += modCount
|
|
||||||
// }
|
|
||||||
// }, file)
|
|
||||||
// }
|
|
||||||
// wg.Wait()
|
|
||||||
|
|
||||||
// Print summary
|
// Print summary
|
||||||
if stats.TotalModifications == 0 {
|
if stats.TotalModifications == 0 {
|
||||||
logger.Warning("No modifications were made in any files")
|
logger.Warning("No modifications were made in any files")
|
||||||
|
Reference in New Issue
Block a user