diff --git a/CHANGELOG.md b/CHANGELOG.md --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,4 +11,5 @@ ### Fixed - Fix issue causing .taskpaper files to not be correctly identified. +- Fix issue where empty strings would be leftover and count as untracked. diff --git a/src/project_checkup/core.clj b/src/project_checkup/core.clj --- a/src/project_checkup/core.clj +++ b/src/project_checkup/core.clj @@ -7,19 +7,19 @@ (defn get-extension [path] "Extracts the extension of a path. - Returns the extension with the period, e.g., '.txt' because that's the format - people are used to seeing extensions in." + Returns the extension with the period, e.g., '.txt' because that's the + format people are used to seeing extensions in." (re-find #"\.[a-zA-Z0-9]+$" path)) (defn gather-untracked [vcs-systems] "Gather untracked files in Git or Mercurial." - (reduce into [ + (filter (comp not empty?) (reduce into [ (if (contains? vcs-systems ".hg") (string/split (:out (shell/sh "chg" "st" "-u" "-n")) #"\n")) (if (contains? vcs-systems ".git") (string/split (:out (shell/sh "git" "ls-files" "--others" - "--exclude-standard")) #"\n"))])) + "--exclude-standard")) #"\n"))]))) (defn gather-project-info "Creates a dictionary of project information." [] @@ -32,6 +32,14 @@ :untracked-files (gather-untracked vcs-systems) :readme (if-let [filename (some #{"README.md" "README.txt" "README.mkd"} files)] (slurp filename) "") }) ) + +(def doc-extensions ["" ".txt" ".mkd" ".md" ".rst"]) + +(defn create-valid-names [exts names] + "Creates valid file names based on a sequence of exts and names." + (set (for [ext exts name names] + (str name ext)))) + (defn color [color string] (let [color-sequence (case color :green "\u001B[32m" @@ -53,8 +61,10 @@ (boolean (some #{"README.md" "README.txt" "README.mkd" "README"} files)))) (defn check-changelog [project] - (let [{files :files } project] - (boolean (some #{"CHANGELOG.md" "CHANGELOG.txt" "CHANGELOG.mkd" "CHANGELOG"} files)))) + (let [{files :files } project + changelog-names #{"CHANGELOG" "HISTORY" "NEWS" "RELEASES"}] + (boolean (some (create-valid-names doc-extensions changelog-names) files)))) + (defn check-untracked [project] (let [{untracked :untracked-files } project]