sunboyy/repogen

View on GitHub

Showing 13 of 13 total issues

Function main has 60 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func main() {
flag.Usage = printUsage
 
versionPtr := flag.Bool("version", false, "print version of repogen")
pkgPtr := flag.String(
Severity: Minor
Found in main.go - About 1 hr to fix

    Method findBodyGenerator.generateFindManyBody has 53 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (g findBodyGenerator) generateFindManyBody(querySpec querySpec,
    sortsCode codegen.MapStatement) codegen.FunctionBody {
     
    return codegen.FunctionBody{
    codegen.DeclAssignStatement{
    Severity: Minor
    Found in internal/mongo/find.go - About 1 hr to fix

      Method interfaceMethodParser.parseFindOperation has 7 return statements (exceeds 4 allowed).
      Open

      func (p interfaceMethodParser) parseFindOperation(tokens []string) (Operation, error) {
      mode, err := p.extractModelOrSliceReturns(p.Signature.Results())
      if err != nil {
      return nil, err
      }
      Severity: Major
      Found in internal/spec/parser.go - About 45 mins to fix

        Method interfaceMethodParser.parseUpdateOperation has 6 return statements (exceeds 4 allowed).
        Open

        func (p interfaceMethodParser) parseUpdateOperation(tokens []string) (Operation, error) {
        mode, err := p.extractIntOrBoolReturns(p.Signature.Results())
        if err != nil {
        return nil, err
        }
        Severity: Major
        Found in internal/spec/update.go - About 40 mins to fix

          Method interfaceMethodParser.parseFindTop has 5 return statements (exceeds 4 allowed).
          Open

          func (p interfaceMethodParser) parseFindTop(tokens []string) (int, []string,
          error) {
           
          if len(tokens) >= 1 && tokens[0] == "Top" {
          if len(tokens) < 2 {
          Severity: Major
          Found in internal/spec/parser.go - About 35 mins to fix

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

            func generateFromRequest(request GenerationRequest) (string, error) {
            cfg := packages.Config{
            Mode: packages.NeedName | packages.NeedTypes,
            }
            if request.ModelPkg == "" {
            Severity: Major
            Found in main.go - About 35 mins to fix

              Method interfaceMethodParser.parseInsertOperation has 5 return statements (exceeds 4 allowed).
              Open

              func (p interfaceMethodParser) parseInsertOperation(tokens []string) (Operation, error) {
              mode, err := p.extractInsertReturns(p.Signature.Results())
              if err != nil {
              return nil, err
              }
              Severity: Major
              Found in internal/spec/parser.go - About 35 mins to fix

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

                func getPkgID(pattern string) (string, error) {
                pkgs, err := packages.Load(nil, pattern)
                if err != nil {
                return "", err
                }
                Severity: Major
                Found in main.go - About 35 mins to fix

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

                  func deriveSourceTypes(modelPkg, repoPkg *types.Package, structModelName string,
                  repositoryInterfaceName string) (*types.Named, *types.Interface, error) {
                   
                  structModelObj := modelPkg.Scope().Lookup(structModelName)
                  if structModelObj == nil {
                  Severity: Major
                  Found in internal/generator/generator.go - About 35 mins to fix

                    Method interfaceMethodParser.extractIntOrBoolReturns has 5 return statements (exceeds 4 allowed).
                    Open

                    func (p interfaceMethodParser) extractIntOrBoolReturns(returns *types.Tuple) (QueryMode, error) {
                    if returns.Len() != 2 {
                    return "", NewOperationReturnCountUnmatchedError(2)
                    }
                     
                     
                    Severity: Major
                    Found in internal/spec/parser.go - About 35 mins to fix

                      Method interfaceMethodParser.extractInsertReturns has 5 return statements (exceeds 4 allowed).
                      Open

                      func (p interfaceMethodParser) extractInsertReturns(returns *types.Tuple) (QueryMode, error) {
                      if returns.Len() != 2 {
                      return "", NewOperationReturnCountUnmatchedError(2)
                      }
                       
                       
                      Severity: Major
                      Found in internal/spec/parser.go - About 35 mins to fix

                        Method interfaceMethodParser.extractModelOrSliceReturns has 5 return statements (exceeds 4 allowed).
                        Open

                        func (p interfaceMethodParser) extractModelOrSliceReturns(returns *types.Tuple) (QueryMode, error) {
                        if returns.Len() != 2 {
                        return "", NewOperationReturnCountUnmatchedError(2)
                        }
                         
                         
                        Severity: Major
                        Found in internal/spec/parser.go - About 35 mins to fix

                          Method interfaceMethodParser.parseUpdate has 5 return statements (exceeds 4 allowed).
                          Open

                          func (p interfaceMethodParser) parseUpdate(tokens []string) (Update, error) {
                          if len(tokens) == 0 {
                          expectedType := types.NewPointer(p.NamedStruct)
                          if p.Signature.Params().Len() <= 1 || !types.Identical(p.Signature.Params().At(1).Type(), expectedType) {
                          return nil, ErrInvalidUpdateFields
                          Severity: Major
                          Found in internal/spec/update.go - About 35 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language