Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions checkers/discover/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,9 @@ func GenerateAnalyzer(checkerDir, dest string) error {
return nil
}


// define the templates to be used in the registry.go
const (
headerTemplate = `// AUTOMATICALLY GENERATED: DO NOT EDIT
headerTemplate = `// AUTOMATICALLY GENERATED: DO NOT EDIT

package checkers

Expand All @@ -81,18 +80,17 @@ import (

var AnalyzerRegistry = []Analyzer{`

entryTemplate = `
entryTemplate = `
{
TestDir: "%[1]s/testdata", // relative to the repository root
Analyzers: []*goAnalysis.Analyzer{%[2]s
},
},
`

footerTemplate = "}\n"
footerTemplate = "}\n"
)


func generateBuiltinCheckerRegistry(builtinCheckerMap map[string][]string) string {
var builder strings.Builder
// write the header
Expand Down
3 changes: 2 additions & 1 deletion checkers/javascript/scope.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//globstar:registry-exclude
// scope resolution implementation for JS and TS files
//
//globstar:registry-exclude
package javascript

import (
Expand Down
20 changes: 10 additions & 10 deletions cmd/genregistry/main.go
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
package main

import (
"context"
"fmt"
"github.com/urfave/cli/v3"
"os"
"context"
"path/filepath"
"github.com/urfave/cli/v3"


"globstar.dev/checkers/discover"
)

func main() {
app := &cli.Command {
Name: "gen-registry",
app := &cli.Command{
Name: "gen-registry",
Usage: "Tool to dynamically generate checker registry",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "dir",
Aliases: []string{"d"},
Usage: "Path to checker containing directory",
Name: "dir",
Aliases: []string{"d"},
Usage: "Path to checker containing directory",
Required: true,
},
},
Expand All @@ -44,7 +44,7 @@ func main() {
},
}

if err := app.Run(context.Background(), os.Args); err != nil {
if err := app.Run(context.Background(), os.Args); err != nil {
fmt.Fprintf(os.Stderr, "could not run gen-registry: %v", err)
}
}
Expand All @@ -62,4 +62,4 @@ func getAllSubDirectories(topdir string) ([]string, error) {
}

return subdirs, err
}
}