diff --git a/.gitignore b/.gitignore index 3f95d16..078e6a0 100644 --- a/.gitignore +++ b/.gitignore @@ -38,3 +38,7 @@ pom.xml.asc # IntelliJ IDEA .idea *.iml + +# The `version.edn` file is autogenerated by `lein cache-version`. Do not check in that file. And do not alter it. +lein-kibit/resources/version.edn +.env diff --git a/.travis.yml b/.travis.yml index d53254e..14eacb0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,13 @@ language: clojure +lein: 2.9.1 install: -- "pushd kibit" -- "lein deps" -- "popd" +- "LEIN_USE_BOOTCLASSPATH=no lein cache-version" +- "LEIN_USE_BOOTCLASSPATH=no lein monolith each :in gorillalabs/kibit deps" script: -- "pushd kibit" -- "lein test-all" +- "LEIN_USE_BOOTCLASSPATH=no lein monolith each :in gorillalabs/kibit test-all" +- "LEIN_USE_BOOTCLASSPATH=no lein cache-version" +- "LEIN_USE_BOOTCLASSPATH=no lein monolith each install" jdk: - openjdk8 - openjdk11 + - oraclejdk11 diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d58ce4..260f095 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,31 +1,45 @@ # Changelog -All notable changes to this project will be documented in this file. This change log follows the conventions of [keepachangelog.com](http://keepachangelog.com). +All notable changes to this project will be documented in this file. -## [Unreleased] +The format is based on [Keep a Changelog](http://keepachangelog.com) +and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## [0.1.6] / 2018-11-08 +## [Unreleased] +### Added +- _CHANGELOG.md_ created. +### Changed +- Something has been changed. ### Fixed +- Something has been fixed. +### Removed +- Something has been removed. +## [0.3.0] - 2019-04-18 +### Added +* Added a file path into an error message while reading a file fixes [#205](https://github.com/jonase/kibit/issues/205). [#212](https://github.com/jonase/kibit/pull/212) +* Use :repositories from original project in synthetic project.clj. [#222](https://github.com/jonase/kibit/pull/222) + +## [0.1.6] - 2018-11-08 * A long awaited feature/fix - Kibit now supports reading namespaced keywords correctly. A very special thanks to Alex Redington who took this tricky task on. [#198](https://github.com/jonase/kibit/pull/198). * Make Kibit work with local-repos. [#195](https://github.com/jonase/kibit/pull/195) * Fixup the monkeypatching. [#192](https://github.com/jonase/kibit/pull/192) * Add alias support to the reader * Improve source path handling to prevent checking duplicates -## [0.1.5] / 2017-05-02 +## [0.1.5] - 2017-05-02 * 0.1.4, but released properly. -## [0.1.4] / 2017-05-05 +## [0.1.4] - 2017-05-05 ### Additions * Automatic replacement of suggestions (`--replace` and `--interactive` cli arguments) * Rules for using `run!` instead of `(dorun (map f coll))` -## [0.1.3] / 2016-11-21 +## [0.1.3] - 2016-11-21 ### Additions * Enabled Emacs' next error function to go to next Kibit suggestion. See the updated code in the README for the change. @@ -35,8 +49,10 @@ All notable changes to this project will be documented in this file. This change * #168 Bumped to new versions of clojure and tools.cli dependencies * #171 Update core.logic to avoid exception from spec -## [0.1.2] / 2015-04-21 +## [0.1.2] - 2015-04-21 ### Additions * Clojurescript/Cljx support (cljc support coming soon). This just works™, kibit will pick up your source paths from your `project.clj`'s `:source-paths`, `[:cljsbuild :builds]`, and `[:cljx :builds]`. * Non-zero exit codes. Kibit now exits non-zero when one or more suggestions are made. This is particularly useful for those running checks in a CI environment. * You can now run kibit on any Clojure project without a project.clj file. Just call `lein kibit` with any number of files and folders and it will inspect the Clojure files contained within. + +[Unreleased]: https://github.com/gorillalabs/kibit/compare/v0.3.0...HEAD diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..0134e83 --- /dev/null +++ b/Makefile @@ -0,0 +1,13 @@ +.PHONY: clean test install release + +install: + LEIN_USE_BOOTCLASSPATH=no lein do cache-version, monolith each install + +deploy: + LEIN_USE_BOOTCLASSPATH=no lein do cache-version, release $(VERSION) + +test: + LEIN_USE_BOOTCLASSPATH=no lein monolith each :in gorillalabs.jonase/kibit test-all + +clean: + LEIN_USE_BOOTCLASSPATH=no lein monolith each clean \ No newline at end of file diff --git a/README.md b/README.md index 7d712bc..2f84221 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ -[![Build Status](https://travis-ci.org/jonase/kibit.svg?branch=master)](https://travis-ci.org/jonase/kibit) -[![Dependencies Status](http://jarkeeper.com/jonase/kibit/status.svg)](http://jarkeeper.com/jonase/kibit) +[![Clojars Project](https://img.shields.io/clojars/v/gorillalabs/kibit.svg)](https://clojars.org/gorillalabs/kibit) +[![Build Status](https://travis-ci.org/gorillalabs/kibit.svg)](https://travis-ci.org/gorillalabs/kibit) +[![Dependencies Status](https://versions.deps.co/gorillalabs/kibit/status.svg)](https://versions.deps.co/gorillalabs/kibit) +[![Downloads](https://versions.deps.co/gorillalabs/kibit/downloads.svg)](https://versions.deps.co/gorillalabs/kibit) + # kibit @@ -206,6 +209,15 @@ some false positives. ## Contributing +To build your own version of Kibit, your leiningen plugin needs to reference the correct version of kibit. +This is achieved by having a version.edn file in lein-kibit/resources. This file best is autogenerated from +[lein-v](https://github.com/roomkey/lein-v#task-usage). So, after cloning the repo, run `lein cache-version`. +I run on Leiningen 2.9.1 currently, and to overcome a problem with the leiningen bootclasspath +optimization re-introduced in 2.9.0, I use `LEIN_USE_BOOTCLASSPATH=no` (from an `.env` file in my setup.) + +To install your version including changes, just run `make install`. To release a new version to Clojars (given +the permission to do so), run `lein release <:patch|:minor|:major>`. + It is very easy to write new patterns for `kibit`. Take a look at [`control-structures.clj`](https://github.com/jonase/kibit/blob/master/kibit/src/kibit/rules/control_structures.clj) to see how new patterns are created. If you know of a recurring diff --git a/install.sh b/install.sh deleted file mode 100755 index 272c383..0000000 --- a/install.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash - -# Locally install all the components. - -set -ex - -pushd kibit -lein install -popd -pushd lein-kibit -lein install -popd - diff --git a/kibit-common/resources/jonase/kibit/VERSION b/kibit-common/resources/jonase/kibit/VERSION deleted file mode 100644 index c946ee6..0000000 --- a/kibit-common/resources/jonase/kibit/VERSION +++ /dev/null @@ -1 +0,0 @@ -0.1.6 diff --git a/kibit/project.clj b/kibit/project.clj index f00901a..29cc618 100644 --- a/kibit/project.clj +++ b/kibit/project.clj @@ -1,22 +1,28 @@ -(defproject jonase/kibit (clojure.string/trim-newline (slurp "../kibit-common/resources/jonase/kibit/VERSION")) +(defproject gorillalabs/kibit "0.0.0" + :plugins [[lein-monolith "1.2.0"] + [com.roomkey/lein-v "7.1.0"]] + :monolith/inherit true + :middleware [leiningen.v/version-from-scm + leiningen.v/dependency-version-from-scm + leiningen.v/add-workspace-data] :description "There's a function for that!" - :url "https://github.com/jonase/kibit" + :url "https://github.com/gorillalabs/kibit" :license {:name "Eclipse Public License - v 1.0" :url "http://www.eclipse.org/legal/epl-v10.html" :distribution :repo :comments "Contact if any questions"} - :dependencies [[org.clojure/clojure "1.8.0"] + :dependencies [[org.clojure/clojure "1.10.0"] [org.clojure/core.logic "0.8.11"] - [org.clojure/tools.cli "0.3.5"] - [rewrite-clj "0.4.12"] - [org.clojure/tools.reader "1.0.2"]] - :profiles {:dev {:dependencies [[lein-marginalia "0.9.0"]] + [org.clojure/tools.cli "0.4.2"] + [rewrite-clj "0.6.1"] + [org.clojure/tools.reader "1.3.2"]] + :profiles {:dev {:dependencies [[lein-marginalia "0.9.1"]] :resource-paths ["test/resources"]}} :deploy-repositories [["releases" :clojars] ["snapshots" :clojars]] - :aliases {"test-all" ["do" - ["clean"] - ["test"] - ["clean"] - ["compile" ":all"]]} + :aliases {"test-all" ["do" + ["clean"] + ["test"] + ["clean"] + ["compile" ":all"]]} :warn-on-reflection false) diff --git a/lein-kibit/project.clj b/lein-kibit/project.clj index 57928c7..7d87d57 100644 --- a/lein-kibit/project.clj +++ b/lein-kibit/project.clj @@ -1,11 +1,17 @@ -(defproject lein-kibit (clojure.string/trim-newline (slurp "../kibit-common/resources/jonase/kibit/VERSION")) +(defproject gorillalabs/lein-kibit "0.0.0" + :plugins [[lein-monolith "1.2.0"] + [com.roomkey/lein-v "7.1.0"]] + :monolith/inherit true + :middleware [leiningen.v/version-from-scm + leiningen.v/dependency-version-from-scm + leiningen.v/add-workspace-data] :description "kibit lein plugin" :url "https://github.com/jonase/kibit" - :resource-paths ["../kibit-common/resources"] :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} :dependencies [[org.clojure/tools.namespace "0.2.11"] - [jonase/kibit ~(clojure.string/trim-newline (slurp "../kibit-common/resources/jonase/kibit/VERSION"))]] + [gorillalabs/kibit ~(:version (clojure.edn/read-string (slurp "lein-kibit/resources/version.edn")))]] :deploy-repositories [["releases" :clojars] ["snapshots" :clojars]] + :prep-tasks [["v" "cache" "lein-kibit/resources" "edn"]] :eval-in-leiningen true) diff --git a/lein-kibit/resources/.gitkeep b/lein-kibit/resources/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/lein-kibit/src/leiningen/kibit.clj b/lein-kibit/src/leiningen/kibit.clj index bd185ee..0ed81fa 100644 --- a/lein-kibit/src/leiningen/kibit.clj +++ b/lein-kibit/src/leiningen/kibit.clj @@ -11,21 +11,20 @@ (let [src-paths (get-in project [:kibit :source-paths] ["rules"]) repositories (:repositories project) local-repo (:local-repo project) - kibit-project `{:dependencies [[jonase/kibit ~(str/trim-newline - (slurp - (io/resource - "jonase/kibit/VERSION")))]] + kibit-version (clojure.edn/read-string + (slurp (io/resource "version.edn"))) + kibit-project `{:dependencies [[gorillalabs/kibit ~(:version kibit-version)]] :source-paths ~src-paths :repositories ~repositories :local-repo ~local-repo} cwd (.toAbsolutePath (Paths/get "" (into-array String nil))) ;; This could become a transducer once we want to force a dependency on Lein 1.6.0 or higher. paths (->> (concat ;; Collect all of the possible places sources can be defined. - (:source-paths project) - [(:source-path project)] - (mapcat :source-paths (get-in project [:profiles])) - (mapcat :source-paths (get-in project [:cljsbuild :builds])) - (mapcat :source-paths (get-in project [:cljx :builds]))) + (:source-paths project) + [(:source-path project)] + (mapcat :source-paths (get-in project [:profiles])) + (mapcat :source-paths (get-in project [:cljsbuild :builds])) + (mapcat :source-paths (get-in project [:cljx :builds]))) (filter some?) ;; Remove nils ;; Convert all String paths to absolute paths (Leiningen turns root :source-paths into absolute path). (map #(.toAbsolutePath (Paths/get % (into-array String nil)))) diff --git a/project.clj b/project.clj new file mode 100644 index 0000000..f75e946 --- /dev/null +++ b/project.clj @@ -0,0 +1,24 @@ +(defproject gorillalabs/kibit "0.0.0" + :description "There's a function for that!" + :url "https://github.com/gorillalabs/kibit" + :license {:name "Eclipse Public License - v 1.0" + :url "http://www.eclipse.org/legal/epl-v10.html" + :distribution :repo + :comments "Contact if any questions"} + :plugins [[lein-monolith "1.2.0"] + [com.roomkey/lein-v "7.1.0"] + [lein-changelog/lein-changelog "0.3.2"]] + :middleware [leiningen.v/version-from-scm + leiningen.v/dependency-version-from-scm + leiningen.v/add-workspace-data] + :monolith {:inherit [:plugins] + :project-dirs ["*"]} + :aliases {"cache-version" ["do" ["v" "cache" "lein-kibit/resources" "edn"]]} + :dependencies [[org.clojure/clojure "1.10.0"]] + :release-tasks [["vcs" "assert-committed"] + ["v" "update"] ;; compute new version & tag it + ["v" "push-tags"] + ["cache-version"] + ["monolith" "each" "install"] + ["monolith" "each" "deploy" "clojars"] + ["changelog" "release"]]) \ No newline at end of file diff --git a/release.sh b/release.sh deleted file mode 100755 index 9a45a97..0000000 --- a/release.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env bash - -echo "This is just a dummy representation of what steps you need to take" -echo "It could be automated in the future" - -set -ex - -echo "Bump the version in kibit-common/resources/jonase/kibit/VERSION to a release version before running this" -pushd kibit -lein deploy -popd -pushd lein-kibit -lein deploy -popd -echo "Bump the version in kibit-common to the next SNAPSHOT"