Description:
Expand the changelog check and do a little refactoring.
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r32:30b92d1615f7 -

@@ -11,4 +11,5
11 11
12 12 ### Fixed
13 13 - Fix issue causing .taskpaper files to not be correctly identified.
14 - Fix issue where empty strings would be leftover and count as untracked.
14 15
@@ -7,19 +7,19
7 7
8 8 (defn get-extension [path]
9 9 "Extracts the extension of a path.
10 Returns the extension with the period, e.g., '.txt' because that's the format
11 people are used to seeing extensions in."
10 Returns the extension with the period, e.g., '.txt' because that's the
11 format people are used to seeing extensions in."
12 12 (re-find #"\.[a-zA-Z0-9]+$" path))
13 13
14 14 (defn gather-untracked
15 15 [vcs-systems]
16 16 "Gather untracked files in Git or Mercurial."
17 (reduce into [
17 (filter (comp not empty?) (reduce into [
18 18 (if (contains? vcs-systems ".hg")
19 19 (string/split (:out (shell/sh "chg" "st" "-u" "-n")) #"\n"))
20 20 (if (contains? vcs-systems ".git")
21 21 (string/split (:out (shell/sh "git" "ls-files" "--others"
22 "--exclude-standard")) #"\n"))]))
22 "--exclude-standard")) #"\n"))])))
23 23 (defn gather-project-info
24 24 "Creates a dictionary of project information."
25 25 []
@@ -32,6 +32,14
32 32 :untracked-files (gather-untracked vcs-systems)
33 33 :readme (if-let [filename (some #{"README.md" "README.txt" "README.mkd"} files)] (slurp filename) "") }) )
34 34
35
36 (def doc-extensions ["" ".txt" ".mkd" ".md" ".rst"])
37
38 (defn create-valid-names [exts names]
39 "Creates valid file names based on a sequence of exts and names."
40 (set (for [ext exts name names]
41 (str name ext))))
42
35 43 (defn color [color string]
36 44 (let [color-sequence (case color
37 45 :green "\u001B[32m"
@@ -53,8 +61,10
53 61 (boolean (some #{"README.md" "README.txt" "README.mkd" "README"} files))))
54 62
55 63 (defn check-changelog [project]
56 (let [{files :files } project]
57 (boolean (some #{"CHANGELOG.md" "CHANGELOG.txt" "CHANGELOG.mkd" "CHANGELOG"} files))))
64 (let [{files :files } project
65 changelog-names #{"CHANGELOG" "HISTORY" "NEWS" "RELEASES"}]
66 (boolean (some (create-valid-names doc-extensions changelog-names) files))))
67
58 68
59 69 (defn check-untracked [project]
60 70 (let [{untracked :untracked-files } project]
You need to be logged in to leave comments. Login now