Showing 13 of 13 total issues
Function main
has 60 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func main() {
flag.Usage = printUsage
versionPtr := flag.Bool("version", false, "print version of repogen")
pkgPtr := flag.String(
Method findBodyGenerator.generateFindManyBody
has 53 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (g findBodyGenerator) generateFindManyBody(querySpec querySpec,
sortsCode codegen.MapStatement) codegen.FunctionBody {
return codegen.FunctionBody{
codegen.DeclAssignStatement{
Method interfaceMethodParser.parseFindOperation
has 7 return statements (exceeds 4 allowed). Open
Open
func (p interfaceMethodParser) parseFindOperation(tokens []string) (Operation, error) {
mode, err := p.extractModelOrSliceReturns(p.Signature.Results())
if err != nil {
return nil, err
}
Method interfaceMethodParser.parseUpdateOperation
has 6 return statements (exceeds 4 allowed). Open
Open
func (p interfaceMethodParser) parseUpdateOperation(tokens []string) (Operation, error) {
mode, err := p.extractIntOrBoolReturns(p.Signature.Results())
if err != nil {
return nil, err
}
Function getPkgID
has 5 return statements (exceeds 4 allowed). Open
Open
func getPkgID(pattern string) (string, error) {
pkgs, err := packages.Load(nil, pattern)
if err != nil {
return "", err
}
Method interfaceMethodParser.extractIntOrBoolReturns
has 5 return statements (exceeds 4 allowed). Open
Open
func (p interfaceMethodParser) extractIntOrBoolReturns(returns *types.Tuple) (QueryMode, error) {
if returns.Len() != 2 {
return "", NewOperationReturnCountUnmatchedError(2)
}
Method interfaceMethodParser.parseUpdate
has 5 return statements (exceeds 4 allowed). Open
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
Method interfaceMethodParser.extractInsertReturns
has 5 return statements (exceeds 4 allowed). Open
Open
func (p interfaceMethodParser) extractInsertReturns(returns *types.Tuple) (QueryMode, error) {
if returns.Len() != 2 {
return "", NewOperationReturnCountUnmatchedError(2)
}
Method interfaceMethodParser.parseFindTop
has 5 return statements (exceeds 4 allowed). Open
Open
func (p interfaceMethodParser) parseFindTop(tokens []string) (int, []string,
error) {
if len(tokens) >= 1 && tokens[0] == "Top" {
if len(tokens) < 2 {
Function deriveSourceTypes
has 5 return statements (exceeds 4 allowed). Open
Open
func deriveSourceTypes(modelPkg, repoPkg *types.Package, structModelName string,
repositoryInterfaceName string) (*types.Named, *types.Interface, error) {
structModelObj := modelPkg.Scope().Lookup(structModelName)
if structModelObj == nil {
Method interfaceMethodParser.parseInsertOperation
has 5 return statements (exceeds 4 allowed). Open
Open
func (p interfaceMethodParser) parseInsertOperation(tokens []string) (Operation, error) {
mode, err := p.extractInsertReturns(p.Signature.Results())
if err != nil {
return nil, err
}
Method interfaceMethodParser.extractModelOrSliceReturns
has 5 return statements (exceeds 4 allowed). Open
Open
func (p interfaceMethodParser) extractModelOrSliceReturns(returns *types.Tuple) (QueryMode, error) {
if returns.Len() != 2 {
return "", NewOperationReturnCountUnmatchedError(2)
}
Function generateFromRequest
has 5 return statements (exceeds 4 allowed). Open
Open
func generateFromRequest(request GenerationRequest) (string, error) {
cfg := packages.Config{
Mode: packages.NeedName | packages.NeedTypes,
}
if request.ModelPkg == "" {