Skip to content

Commit

Permalink
Add performance TODOs and restrictions
Browse files Browse the repository at this point in the history
  • Loading branch information
zph committed Apr 13, 2024
1 parent 8fc9d25 commit f97e211
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
15 changes: 11 additions & 4 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,16 @@
- [ ] Configurable logging (log levels for debugging and k/v log values)
- [ ] Add `init` command to create a default named config file
- [ ] Remove panics that are poor programming style
- [ ] Add testing for config files... lines, path
- [ ] Setup goreleaser for releases
- [x] Add testing for config files... lines, path
- [x] Setup goreleaser for releases
- [ ] Setup version bumper
- [ ] Ensure version is embedded into cobra cli and available for --version
- [x] Ensure version is embedded into cobra cli and available for --version
- [ ] Add way to pipe to exec process and non-zero exit is a failing to provide builtin, js, exec mechanisms
- [ ] Setup version reading https://goreleaser.com/cookbooks/using-main.version/
- [x] Setup version reading https://goreleaser.com/cookbooks/using-main.version/
- [x] Add this as a hermit-package in zph/hermit-packages

## Performance
- [ ] Setup support for gitignore and global gitignore to avoid reading things like node_modules :yawning_face:
- [ ] Setup parallelism for larger repos
- [ ] Requires reworking how we use goja functions because those VMs are not thread safe
- [ ] Could setup a worker pool of VMs? Or could provision new VM for each fn call....
6 changes: 4 additions & 2 deletions cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ func Run(cmd *cobra.Command, args []string) (int, []error) {
return err
}

// Check if the file has the extension
// Causes 4x slowdown in benchmarks on project with large node_modules folder
// if we use IsRegular() instead of isDir()
// Regular mode = non-dir, non-symlink etcs
// TODO(zph) investigate this issue and find a better solution
if !info.IsDir() {
content, err := os.ReadFile(path)

Expand All @@ -66,7 +69,6 @@ func Run(cmd *cobra.Command, args []string) (int, []error) {
if len(result.Findings) > 0 {
fmt.Printf("\n%s: violations count %d\n", result.Path, len(result.Findings))
for idx, finding := range result.Findings {
// TODO: figure out why the rule embedded is wrong
fmt.Printf("%d: Line %3d %30s %20s\n", idx+1, finding.LineNo, finding.RuleId, finding.Rule.Description)
}
exitCode = 1
Expand Down

0 comments on commit f97e211

Please sign in to comment.