Skip to content
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

Fix build/release issues #228

Closed
wants to merge 16 commits into from
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
12 changes: 7 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
language: clojure
lein: 2.9.1
install:
- "pushd kibit"
- "lein deps"
- "popd"
- "LEIN_USE_BOOTCLASSPATH=no lein cache-version"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think LEIN_USE_BOOTCLASSPATH=no could be set once as an environment variable?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, if we are going to add a makefile, can we use those make commands here?

- "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
30 changes: 23 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you change gorrillalabs -> jonase here, and in the other places it was used?

13 changes: 13 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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
Expand Down
13 changes: 0 additions & 13 deletions install.sh

This file was deleted.

1 change: 0 additions & 1 deletion kibit-common/resources/jonase/kibit/VERSION

This file was deleted.

30 changes: 18 additions & 12 deletions kibit/project.clj
Original file line number Diff line number Diff line change
@@ -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)
12 changes: 9 additions & 3 deletions lein-kibit/project.clj
Original file line number Diff line number Diff line change
@@ -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)
Empty file added lein-kibit/resources/.gitkeep
Empty file.
17 changes: 8 additions & 9 deletions lein-kibit/src/leiningen/kibit.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you match indentation here?

(slurp (io/resource "version.edn")))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If any user of kibit has a file called version.edn at the root of their classpath then there will be conflicts between this one and that one. It would be good to be able to move it to jonase/kibit/version.edn to avoid the risk of conflicts.

kibit-project `{:dependencies [[gorillalabs/kibit ~(:version kibit-version)]]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be neat if lein-v could also print out the group and artifact ID, so it didn't need to be hard-coded here.

: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))))
Expand Down
24 changes: 24 additions & 0 deletions project.clj
Original file line number Diff line number Diff line change
@@ -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"]])
15 changes: 0 additions & 15 deletions release.sh

This file was deleted.