Skip to content
This repository was archived by the owner on Oct 2, 2020. It is now read-only.

Latest commit

 

History

History
53 lines (42 loc) · 2.64 KB

todo.org

File metadata and controls

53 lines (42 loc) · 2.64 KB

Deferred reference validation

technomancy, from #19:

“I’ve thought a bit about trying to walk all defmacro bodies in the namespace and check for symbols with a namespace, but that would almost positively result in false positives.”

“I’d rather not handle this than handle this in a way that would have edge cases which could make it go looking for vars that don’t exist.”

Does a solution exist that does not produce false positives, nor accidentally call (launch-missiles)?

  • [ ] Detect qualified references within syntax-quote
  • [ ] Detect fully qualified namespaces

Static Analysis

With the advent of official Clojure analyzers (see org.clojure/tools.analyzer and related projects), it may be possible to augment or replace Slamhound’s failure-driven missing reference detection algorithm with static analysis.

This has the potential to greatly improve the performance of the regrow step, and may also allow us to support ClojureScript.

  • [ ] Investigate use of a static analyzer to detect missing ns references

Performance

The slowest operation in slamhound is the pre-loading of namespaces, which is CPU bound (note that it is always slow regardless of the disk cache).

Pre-loading in parallel with (Executors/newFixedThreadPool #cpu-threads) does divide the execution time by ~ 0.8*cpu-threads, but obviously does not decrease the actual amount of work.

Also, GC thrashing due to PermGen appears to still be an issue with `-XX:+CMSClassUnloadingEnabled`. Initial investigation shows that we may need to implement our own classloader.

  • [ ] Improve performance of slam.hound.reload/pre-load-namespaces if possible
  • [ ] Investigate impact of a Slamhound optimized classloader on PermGen

Testing

Our unit tests rely heavily on references defined in the test namespaces and in external dependencies. It would be better to create and destroy a mock environment to clearly see the inputs for disambiguation.

This leads quite naturally to property based testing with test.check.

  • [ ] Replace test dependencies with mock namespaces that are easy to control
  • [ ] Convert tests to test.check where appropriate (e.g. slam.hound.regrow-test)

Minor enhancements

  • [X] Sort alias candidates by L̶e̶v̶e̶n̶s̶h̶t̶e̶i̶n̶ “alias” distance, with emphasis on initial letters
  • [X] Satisfy all reflection warnings (there are only a handful)
  • [X] Support Unicode characters in regrow/missing-sym-name
  • [ ] Count dashes as word separators when calculating “alias” distance
  • [ ] Sort refer candidates by matching arity. e.g. (join []) should prefer clojure.string/join