RackSec / desdemona

Data-backed security operations
Eclipse Public License 1.0
2 stars 7 forks source link

Dont hardcode logic variable to 'x #111

Closed lvh closed 8 years ago

lvh commented 8 years ago

Closes #110, paves the way for multi-arity queries.

lvh commented 8 years ago

I originally wanted to do this by walking the logic query, and finding all of the non-namespaced symbols (so (every-pred symbol? (comp nil? namespace))). That would sorta work, but has a few downsides. Since at some point, some of the queries will introduce their own fresh variables (see #106), finding fresh variables means understanding the structure of the query, because not all non-namespaced symbols are yours to fresh. Just overriding them doesn't work either, since run-logic-query returns all results it freshed. That means duplicating all of the matching logic, which is obviously pretty sad.

The second approach I tried is in this PR: it annotates the metadata of the symbol. This approach only has the downside that it doesn't work for a literal quoted logic program anymore; run-logic-query assumes that the logic query it is handed is already properly annotated. I think this is OK: that fn isn't public API.

lvh commented 8 years ago

I'm surprised kibit doesn't complain about the (into #{}).

codecov-io commented 8 years ago

Current coverage is 92.23%

Merging #111 into master will decrease coverage by -0.41% as of e0811af

@@            master    #111   diff @@
======================================
  Files           17      17       
  Stmts          204     219    +15
  Branches         8      10     +2
  Methods          0       0       
======================================
+ Hit            189     202    +13
- Partial          8      10     +2
  Missed           7       7       

Review entire Coverage Diff as of e0811af

Powered by Codecov. Updated on successful CI builds.

lvh commented 8 years ago

Coverage data is once again nonsense; it's just upset about the for.

lvh commented 8 years ago

This is ready for review.

derwolfe commented 8 years ago

I think this looks good to go.