-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce wrap-ignore-errors
#317
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
(disable-warning | ||
{:linter :unused-ret-vals-in-try | ||
:if-inside-macroexpansion-of #{'clojure.test/deftest | ||
'clojure.core/assert}}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -194,10 +194,10 @@ | |
|
||
(defn- rename-source-file | ||
"Move file from old to new, updating any dependents." | ||
[old-path new-path] | ||
[old-path new-path ignore-errors?] | ||
(let [old-ns (core/ns-from-string (slurp old-path)) | ||
new-ns (path->ns new-path) | ||
tracker (tracker/build-tracker) | ||
tracker (tracker/build-tracker (util/with-suppressed-errors tracker/default-file-filter-predicate ignore-errors?)) | ||
dependents (tracker/get-dependents tracker old-ns) | ||
new-dependents (atom {})] | ||
(doseq [^File f dependents] | ||
|
@@ -214,15 +214,17 @@ | |
[path old-parent new-parent] | ||
(str/replace path old-parent new-parent)) | ||
|
||
(defn- rename-dir [old-path new-path] | ||
(defn- rename-dir [old-path new-path ignore-errors?] | ||
(let [old-path (util/normalize-to-unix-path old-path) | ||
new-path (util/normalize-to-unix-path new-path) | ||
old-path (if (.endsWith old-path "/") old-path (str old-path "/")) | ||
new-path (if (.endsWith new-path "/") new-path (str new-path "/"))] | ||
(flatten (for [^File f (file-seq (File. old-path)) | ||
:when (not (fs/directory? f)) | ||
:let [path (util/normalize-to-unix-path (.getAbsolutePath f))]] | ||
(-rename-file-or-dir path (merge-paths path old-path new-path)))))) | ||
(-rename-file-or-dir path | ||
(merge-paths path old-path new-path) | ||
ignore-errors?))))) | ||
|
||
(defn- file-or-symlink-exists? [^String path] | ||
(let [f (File. path)] | ||
|
@@ -234,12 +236,12 @@ | |
(when (.. target toFile exists) | ||
path))))))) | ||
|
||
(defn- -rename-file-or-dir [^String old-path new-path] | ||
(defn- -rename-file-or-dir [^String old-path new-path ignore-errors?] | ||
(let [affected-files (if (fs/directory? old-path) | ||
(rename-dir old-path new-path) | ||
(rename-dir old-path new-path ignore-errors?) | ||
(if ((some-fn core/clj-file? core/cljs-file?) | ||
(File. old-path)) | ||
(rename-source-file old-path new-path) | ||
(rename-source-file old-path new-path ignore-errors?) | ||
(rename-file! old-path new-path)))] | ||
(->> affected-files | ||
flatten | ||
|
@@ -271,7 +273,11 @@ | |
old-path and new-path are expected to be aboslute paths. | ||
|
||
Returns a list of all files that were affected." | ||
[old-path new-path] | ||
(assert-friendly old-path new-path) | ||
(binding [*print-length* nil] | ||
(-rename-file-or-dir old-path new-path))) | ||
|
||
([old-path new-path] | ||
(rename-file-or-dir old-path new-path false)) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Extra line here |
||
([old-path new-path ignore-errors?] | ||
(assert-friendly old-path new-path) | ||
(binding [*print-length* nil] | ||
(-rename-file-or-dir old-path new-path ignore-errors?)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
;; An incorrect alias usage (because `a` is not declared in the `ns` form): | ||
::a/foo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
;; An incorrect data readers usage (because there's no such data reader declared anywhere): | ||
#totally.made.up/foo [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
(ns unreadable-file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if I should compare against
true
or"true"
here?...Checking out the codebase, I see a handful of
"true"
handlings. But there's also a boolean coercion in config.clj which makes me hesitateThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is correct, the stuff that's in the
msg
hasn't yet been coerced to boolean.I suppose we could've done a better job of consistently doing coercions in this ns (like you're doing now) instead of passing the
msg
on as is.