synapsecns/sanguine

View on GitHub
tools/modulecopier/internal/copy.go

Summary

Maintainability
A
2 hrs
Test Coverage

Function getUpdatedFileContents has 8 return statements (exceeds 4 allowed).
Open

func getUpdatedFileContents(path, newPackageName string) (fileContents []byte, err error) {
    file, err := pkger.Open(path)
    if err != nil {
        return fileContents, fmt.Errorf("could not open file at %s: %w", path, err)
    }
Severity: Major
Found in tools/modulecopier/internal/copy.go - About 50 mins to fix

    Function CopyModule has 6 return statements (exceeds 4 allowed).
    Open

    func CopyModule(toCopy, dest, packageName string) error {
        // walk through the dir, see: https://github.com/markbates/pkger/blob/09e9684b656b/examples/app/main.go#L29
        info, err := pkger.Info(toCopy)
        if err != nil {
            return fmt.Errorf("could not resolve %s", toCopy)
    Severity: Major
    Found in tools/modulecopier/internal/copy.go - About 40 mins to fix

      Function CopyFile has 6 return statements (exceeds 4 allowed).
      Open

      func CopyFile(fileToCopy, dest, packageName string) error {
          // first things first, pkger operates on go modules, so we need to trim
          modulePath := path.Dir(fileToCopy)
          fileName := path.Base(fileToCopy)
      
      
      Severity: Major
      Found in tools/modulecopier/internal/copy.go - About 40 mins to fix

        Function copyGoFile has 5 return statements (exceeds 4 allowed).
        Open

        func copyGoFile(filePath, packageName, dest string, info fs.FileInfo) error {
            fileContents, err := getUpdatedFileContents(filePath, packageName)
            if err != nil {
                return fmt.Errorf("could not get updated file contents: %w", err)
            }
        Severity: Major
        Found in tools/modulecopier/internal/copy.go - About 35 mins to fix

          There are no issues that match your filters.

          Category
          Status