Permalink
Commits on Oct 19, 2016
Commits on Oct 18, 2016
  1. Fix regrow function for aliases containing non-word characters

    Slamhound was failing for some code like:
    
    ```clojure
    (with-redefs [alias-with-dash/foo (constantly "bar")] ...)
    ```
    
    I finally tracked it down to the regex that matches the "Unable to resolve var:" error. This regex was only matching aliases that contained alphanumeric characters. This PR changes the regex to match all non-whitespace characters.
    b-ryan committed with guns Oct 17, 2016
Commits on Aug 20, 2015
  1. Fix detection of dotted ns alias

    Due to http://dev.clojure.org/jira/browse/CLJ-1403, a dotted ns alias like
    [clojure.java.io :as java.io] or [clj-time.coerce :as time.coerce] throws
    a ClassNotFoundException with the alias as the message. Identifying this
    case allows us to keep looking for the correct alias
    nberger committed with guns Jun 2, 2015
Commits on Jul 3, 2014
  1. Quote input string before creating a new Pattern

    This was always broken, but manifests clearly with Windows filesystem
    paths:
    
        C:\Users\alice
    guns committed Jul 3, 2014
Commits on May 20, 2014
Commits on May 14, 2014
  1. Remove irrelevant comment about ns creation in asplode/asplode

    clojure.core/read will create unknown namespaces on evaluation the
    ns form, so there is no reason to fret over calling create-ns before
    reading a Clojure source file.
    guns committed May 14, 2014
Commits on May 11, 2014
  1. Refactor slam.hound.search

    Small changes:
    
    * Eager evaluation of JarFile contents
    * Removed unused local
    * path-class-files rewritten as for comprehension for clarity
    * #^ dropped in favor of ^
    
      This has been the preferred style since this commit (pre 1.3.0):
    
      commit a5ca8243e3ea45e6387b2b00d0e9b2624d16adbf
      Author: Rich Hickey <richhickey@gmail.com>
      Date:   4 years ago
    
          ^ does what #^ does, reader metadata
    guns committed May 8, 2014
Commits on May 6, 2014
  1. Merge pull request #78 from TreeRex/master

    Preserve header comments
    committed May 6, 2014
  2. Clarify unquoting example in README

    The previous `defcustom` example was boneheaded.
    
    Also includes minor comment fix.
    guns committed May 6, 2014
Commits on May 2, 2014
  1. Preserve header comments

    When deleting the first sexp in the file any header comments were nuked
    as well. This change preserves them.
    TreeRex committed May 2, 2014
Commits on Apr 30, 2014
  1. Release 1.5.5

    The *ns* bound to `user` bug is pretty serious, so I am choosing to push
    a release sooner than later.
    guns committed Apr 30, 2014
  2. Bind *ns* to file's ns during read

    Commit 54cba5c introduced a method of
    detecting unqualified, unquoted symbols within syntax quotes that are
    consumed in-namespace.
    
    From the commit message:
    
    > We can avoid this situation by walking the body and de-qualifying only
    > the symbols that have been qualified in the current ns. This should
    > not be problematic since unknown symbols are qualified in the current
    > ns by default.
    
    Now, the "current ns" is determined by the reader to be the value of
    the *ns* var. When using Slamhound from an editor plugin, it can be
    assumed that *ns* is set to the namespace of the current open buffer.
    Unfortunately, when using Slamhound from a command line, *ns* is
    actually set to the `user` ns.
    
    This causes symbols that we expect to be qualified as `my.ns/foo` to
    actually be qualified as `user/foo`. There have been scattered reports
    of slamhound attempting to alias namespaces as `user`¹. In at least some
    of these cases, this problem is likely to blame.
    
    ¹ #65 comes to mind
    guns committed Apr 30, 2014
  3. Remove unneeded io/file of input to swap-in-reconstructed-ns-form

    swap-in-reconstructed-ns-form is polymorphic and supports anything
    implementing clojure.java.io/Coercions.
    guns committed Apr 30, 2014
Commits on Apr 23, 2014
  1. Add support for definterface and gen-class

    Classes generated by definterface and gen-class don't have any reliable
    metadata that can be used to differentiate them from regular classes.
    
    Also, while defrecord and deftype implement clojure.lang.IType, nothing
    dictates that these must be created from a Clojure namespace. This is in
    contrast to definterface and gen-class, which have no utility outside of
    of a namespace.
    
    Therefore, we must fall back to naming conventions to infer
    relationships.
    guns committed Apr 23, 2014
  2. Make get-package public (for internal use)

    Also, the type signature has changed from Symbol -> String to Class ->
    String to avoid calling resolve twice for the same import symbol in
    group-by-package.
    guns committed Apr 23, 2014
Commits on Apr 10, 2014
  1. Add TODO items

    * We need to address PermGen GC
    
    * Testing is a bit messy and relies on implicit assumptions about the
      environment (I contributed heavily to this, so I pledge to fix it)
    
    * Using test.check for testing disambiguation and candidate search would
      be really awesome
    guns committed Apr 10, 2014
Commits on Apr 8, 2014
  1. Update README with another macro reference workaround

    Imports can be unquoted within macros. We do, however, have to expand
    the reader macros for interop ourselves:
    
        (AClass. foo)       -> (new AClass foo)
        (AClass/method foo) -> (. AClass (method foo))
    
    This change also updates the section on PermGen pressure. While the
    initial loading of all namespaces does contribute, the real culprit is
    that JVMs do not garbage collect discarded classes.
    guns committed Apr 8, 2014
Commits on Apr 3, 2014
  1. Release 1.5.4

    guns committed Apr 3, 2014
  2. Prefer imports whose package name matches a project namespace

    A user who creates a logging deftype at
    org.mycompany.loggingservices.Logger probably doesn't want to import
    java.util.logging.Logger.
    
    The slam.hound.regrow_test.UUID IRecord was changed to conflict with
    java.util.TreeSet as this change breaks other tests that did not
    anticipate this preference.
    guns committed Apr 3, 2014
Commits on Apr 1, 2014
  1. Merge branch 'java-annotations'

    Fixes #72
    
    * java-annotations:
      Match aliased definterface/deftype/defrecord symbols
      Add support for metadata as Java annotations
    guns committed Apr 1, 2014
Commits on Mar 31, 2014
  1. Match aliased definterface/deftype/defrecord symbols

    For instance, schema.core/defrecord may be aliased as s/defrecord, so
    find these references as well.
    
    No support is offered for renames.
    guns committed Mar 31, 2014
  2. Add support for metadata as Java annotations

    Rich Hickey introduced support for Java annotations on definterface,
    deftype, and defrecord types on 23 April, 2010¹.
    
    Unfortunately, since the Clojure compiler allows the use of unquoted
    symbols in metadata, annotations of the form
    
        ^{ClassSymbol value}
    
    are only interpreted as annotations when ClassSymbol resolves to an
    imported class.
    
    Since a compiler error is not generated in either case, we must walk any
    forms that may contain annotations and force the compiler to resolve
    them.
    
    We already walk the body once to dequalify erroneously qualified
    symbols, so this patch hooks into this traversal to collect a set of
    class symbols that may be interpreted as annotations.
    
    This set of symbols is appended to the candidate body so that they
    become visible to the compiler during check-for-failure.
    
    It is possible that metadata inside of a definterface/deftype/defrecord
    form of the form ^{CapitalizedSymbol value} may be erroneously
    interpreted as an annotation instead of just metadata of Symbol -> Any.
    
    This is impossible to determine without user intervention, but since
    most metadata keys are keywords, I think interpreting these entries as
    annotations is a good bet.
    
    Addresses #72
    
    ¹ https://groups.google.com/forum/#!topic/clojure/0hKOFQXAwRc
    guns committed Mar 31, 2014
Commits on Mar 30, 2014
  1. Set development project version

    guns committed Mar 30, 2014
  2. Fix detection of metadata on composite forms

    Commit 54cba5c introduced a call to clojure.walk/prewalk to dequalify
    vars that were qualified to the current *ns*. A side effect of this is
    that metadata on composite forms was lost because clojure.walk/walk does
    not preserve the metadata on these forms.
    
    To address this, we define our own version of prewalk that properly
    preserves metadata.
    
    Addresses #72
    guns committed Mar 30, 2014
  3. Allow asplode to accept any type implementing clojure.java.io/Coercions

    The reader passed to asplode is wholly consumed by asplode and is not
    used again within reconstruct. Therefore, it makes sense to contain the
    entire use of the reader within asplode.
    
    Since the most straightforward approach to creating a reader from an
    input is to call clojure.java.io/reader, asplode can share the same
    convenient input signature.
    guns committed Mar 30, 2014
  4. Export test string literals from prettify-test and stitch-test

    These changes, unlike 27d61ba, do not use `with-transform-test`, but
    they do make manipulating and reading the expected test output easier.
    guns committed Mar 30, 2014
  5. Refactor slam.hound-test with with-transform-test

    Though this separates the input and outputs for the top-level
    integration tests, I think this is a win for two reasons:
    
        - Easier to manipulate and read output strings (open the *.out file
          in a split window, then turn on Clojure syntax)
    
        - Metadata in the input file is processed without being mangled by
          `str`
    guns committed Mar 30, 2014
  6. Add slam.hound.test.util/with-transform-test

    In order to accurately test Slamhound's interaction with files, we must
    test the output of the entire process:
    
        - Open a reader on a file
        - Receive Clojure forms from reader (with reader macros expanded)
        - Reconstruct namespace
        - Write the new namespace back to the file, but copy everything else
          back verbatim
    
    Many tests within Slamhound use (StringReader. (str '(literal forms)))
    in order to avoid the drudgery of doing a manual pr-str.
    
    Unfortunately, (str '[^{:my-metadata "value"} x]) outputs: "[x]", so any
    metadata on the forms is irretrievably lost.
    
    Since the interaction of Slamhound and metadata on forms is non-obvious,
    I think writing our integration tests as comparisons of input and output
    _files_ will help us detect these issues sooner in the future.¹
    
    I have placed with-transform-test and with-tempfile into a common
    testing namespace so that they can be used across all test files.
    
    RE: the name `with-transform-test`:
    
        - I read it as "With transform, test …"
        - Many editors commonly treat ^with-.* as a specially indented form
        - It's awkward, so if a better name is found, let's use it
    
    ¹ See issue #72, and commit 54cba5c for
      past issues with metadata
    guns committed Mar 29, 2014
Commits on Mar 29, 2014
  1. Elaborate on defmacro in README, and expand tests for the same

    Working around defmacro in Slamhound is quite easy, but the README was
    lacking specific advice.
    guns committed Mar 29, 2014
Commits on Mar 28, 2014
  1. Merge pull request #77 from seancorfield/master

    Fix #76 by adding with-open in two places.
    
    Awesome!
    
    I suppose I could add a little git hook or something that commits a SNAPSHOT rev every time a new release tag is added.
    guns committed Mar 28, 2014
  2. Call (shutdown-agents) in slam.hound/-main

    Now that swap-in-reconstructed-ns-form can be passed a simple string, we
    can reserve -main for command line use only.
    
    Closes #75
    guns committed Mar 28, 2014