Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var RootCmd = &cobra.Command{ Use: "iccheck", Short: "Finds inconsistent changes in your git changes", Long: fmt.Sprintf(`ICCheck %v Finds inconsistent changes in your git changes.`, cli.GetFormattedVersion()), Version: cli.GetFormattedVersion(), SilenceUsage: true, RunE: func(cmd *cobra.Command, args []string) error { ctx, cancel := context.WithTimeout(context.Background(), time.Second*time.Duration(timeoutSeconds)) defer cancel() if err := setLogLevel(); err != nil { return err } repoDir, err := getRepoDir() if err != nil { return err } repo, err := git.PlainOpen(repoDir) if err != nil { return errors.Wrapf(err, "opening repository at %v", repoDir) } searchConf, err := searchConfig(repoDir) if err != nil { return err } if fromRef == "" && toRef != "" { fromRef = toRef + "^" } else if fromRef != "" && toRef == "" { return errors.New("only one of --from was set, this is invalid - do not set for automatic discovery or set both") } else if fromRef == "" && toRef == "" { fromRef, toRef, err = autoDetermineRefs(repo) if err != nil { return errors.Wrapf(err, "determining refs") } } fromTree, err := resolveTree(repo, fromRef) if err != nil { return errors.Wrap(err, "resolving base tree") } toTree, err := resolveTree(repo, toRef) if err != nil { return errors.Wrap(err, "resolving target tree") } queries, changedFiles, err := search.DiffTrees(ctx, fromTree, toTree) if err != nil { return err } slog.Info(fmt.Sprintf("%d changed text chunk(s) were found within %d changed file(s).", len(queries), changedFiles), "from", fromTree, "to", toTree) for i, q := range queries { slog.Debug(fmt.Sprintf("Query#%d", i), "query", q) } cloneSets, err := search.Search(ctx, algorithm, queries, toTree, searchConf) if err != nil { return err } reportClones(cloneSets) return nil }, }
RootCmd represents the base command when called without any subcommands
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.