Skip to content

Commit

Permalink
Remove rules analyzer
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiodomingues committed Apr 7, 2024
1 parent 9502c0b commit 12852e6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 89 deletions.
6 changes: 2 additions & 4 deletions src/clj_depend/analyzer.clj
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
(ns clj-depend.analyzer
(:require [clj-depend.analyzers.circular-dependency :as analyzers.circular-dependency]
[clj-depend.analyzers.layer :as analyzers.layer]
[clj-depend.analyzers.rule :as analyzers.rule]))
[clj-depend.analyzers.layer :as analyzers.layer]))

(defn- violations
[config dependencies-by-namespace namespace]
(let [dependencies (get dependencies-by-namespace namespace)
circular-dependency-violations (analyzers.circular-dependency/analyze namespace dependencies dependencies-by-namespace)
layer-violations (analyzers.layer/analyze config namespace dependencies)
rule-violations (analyzers.rule/analyze config namespace dependencies)]
layer-violations (analyzers.layer/analyze config namespace dependencies)]
(not-empty (concat circular-dependency-violations layer-violations rule-violations))))

(defn analyze
Expand Down
45 changes: 0 additions & 45 deletions src/clj_depend/analyzers/rule.clj

This file was deleted.

15 changes: 5 additions & 10 deletions test/clj_depend/analyzer_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@
[matcher-combinators.matchers :as m]))

(deftest analyze-test
(testing "should not return violations when there are no circular dependencies and no layers/rules violated"
(testing "should not return violations when there are no circular dependencies and no layers violated"
(is (empty? (analyzer/analyze {:config {:layers {}
:rules []}
:dependencies-by-namespace {'foo.a.bar #{}
'foo.b.bar #{'foo.a.bar}
'foo.any #{'foo.a.bar}
'foo.a-test #{'lib.x.y.z}}}))))
'foo.any #{'foo.a.bar}}}))))

(testing "should return violations when there are circular dependencies or layers/rules violated"
(testing "should return violations when there are circular dependencies or layers violated"
(is (match? (m/in-any-order [{:namespace 'foo.a.bar
:dependency-namespace 'foo.any
:message "Circular dependency between \"foo.a.bar\" and \"foo.any\""}
Expand All @@ -24,15 +23,11 @@
:layer :b
:dependency-namespace 'foo.a.bar
:dependency-layer :a
:message "\"foo.b.bar\" should not depend on \"foo.a.bar\" (layer \":b\" on \":a\")"}
{:namespace 'foo.a-test
:dependency-namespace 'lib.x.y.z
:message "\"foo.a-test\" should not depend on \"lib.x.y.z\""}])
:message "\"foo.b.bar\" should not depend on \"foo.a.bar\" (layer \":b\" on \":a\")"}])
(analyzer/analyze {:config {:layers {:a {:defined-by ".*\\.a\\..*"
:accesses-layers #{}}
:b {:defined-by ".*\\.b\\..*"
:accesses-layers #{}}}
:rules [{:namespaces #{'foo.a-test} :should-not-depend-on #{'lib.x.y.z}}]}
:accesses-layers #{}}}}
:dependencies-by-namespace {'foo.a.bar #{'foo.any}
'foo.b.bar #{'foo.a.bar}
'foo.any #{'foo.a.bar}
Expand Down
30 changes: 0 additions & 30 deletions test/clj_depend/analyzers/rule_test.clj

This file was deleted.

0 comments on commit 12852e6

Please sign in to comment.