Skip to content

Refactor to avoid double parsing and make testing easier#57

Merged
mk merged 28 commits into
mainfrom
string-tests
Jan 19, 2022
Merged

Refactor to avoid double parsing and make testing easier#57
mk merged 28 commits into
mainfrom
string-tests

Conversation

@mk

@mk mk commented Jan 18, 2022

Copy link
Copy Markdown
Member

This refactors the hashing and eval to:

  • only parse & analyze each form once fixing an Could not resolve var error that could previously occur in the second analysis pass
  • also provide string based interfaces and use for testing instead of going through files
  • move Clerk's cache into the .clerk folder
  • drop metadata and use a map to make conveyance of previous results more explicit

@mk mk requested review from philomates and zampino and removed request for philomates January 18, 2022 15:21
Comment thread src/nextjournal/clerk/hashing.clj Outdated
(analyze-doc {:graph (dep/graph)} doc))
([state doc]
(let [state-with-document (assoc state :doc doc)
code-cells (into [] (filter (comp #{:code} :type)) (:doc doc))]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably worth lifting (into [] (filter (comp #{:code} :type)) (:doc doc)) into a helper and calling both here and from analyze-file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should analyze-doc ever care about the :markdown? option? If so it might be worth writing analyze-file read the file and pass it to analyze-doc for doing work on

@zampino zampino left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

Comment thread src/nextjournal/clerk/hashing.clj Outdated
(analyze-doc {:graph (dep/graph)} doc))
([state doc]
(let [state-with-document (assoc state :doc doc)
code-cells (into [] (filter (comp #{:code} :type)) (:doc doc))]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe inline bindings above?

@mk mk changed the title Refactor hashing to enable working with string contents Refactor to avoid double parsing and make testing easier Jan 19, 2022
@mk mk merged commit ce38ba9 into main Jan 19, 2022
@mk mk deleted the string-tests branch January 19, 2022 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants