Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: joeyates/sloccount-clojure
base: 9d7eff864a
...
head fork: joeyates/sloccount-clojure
compare: 1569fc138d
Checking mergeability… Don't worry, you can still create the pull request.
  • 4 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Showing with 18 additions and 7 deletions.
  1. +10 −7 src/sloccount/files.clj
  2. +8 −0 test/sloccount/files_test.clj
View
17 src/sloccount/files.clj
@@ -27,11 +27,6 @@
(binary? filename) false
true true))
-(defn source-files [path]
- (filter
- source-file?
- (filenames path)))
-
;; File type inference
(defn clojure-file-name? [filename] (.endsWith filename ".clj"))
(defn clojurescript-file-name? [filename] (.endsWith filename ".cljs"))
@@ -102,12 +97,20 @@
(and (file-empty? file) :empty)
(file-type-from-contents file))))
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+; Public interface
+
+(defn source-files [path]
+ (filter
+ source-file?
+ (filenames path)))
+
(defn file-types [path]
(map
- #(list (.toString %) (file-type %))
+ #(list % (file-type %))
(source-files path)))
(defn files-of-type [path type]
(filter
- #(= (sloccount.files/file-type %) type)
+ #(= (file-type %) type)
(source-files path)))
View
8 test/sloccount/files_test.clj
@@ -18,3 +18,11 @@
(fact "it excludes binary files"
(files/source-files "path") => ["foo"]
(provided (files/filenames "path") => ["text.doc" "foo"])))
+
+(facts "about `files-of-type`"
+ (fact "it returns filenames"
+ (files/files-of-type "path" "foo") => ["foo_file"]
+ (provided
+ (files/filenames "path") => ["foo_file", "qux_file"],
+ (files/file-type "foo_file") => "foo",
+ (files/file-type "qux_file") => "qux")))

No commit comments for this range

Something went wrong with that request. Please try again.