Skip to content

Commit f415477

Browse files
authored
Merge pull request #73 from dotemacs/tidy-up
Tidy up namespaces, doc strings, and whitespaces.
2 parents e8dded8 + 7b5d0b6 commit f415477

20 files changed

+74
-87
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,11 @@ To analyze our VCS data we need to define a temporal period of interest. Over ti
6868

6969
The first options is the legacy format used in Your Code As A Crime Scene. Use the `-c git` parse option when [Running Code Maat](#running-code-maat).
7070

71-
git log --pretty=format:'[%h] %aN %ad %s' --date=short --numstat --after=YYYY-MM-DD
71+
git log --pretty=format:'[%h] %aN %ad %s' --date=short --numstat --after=YYYY-MM-DD > logfile.log
7272

7373
There's a second supported Git format as well. It's more tolerant and faster to parse, so please prefer it over the plain `git` format described above. Use the `-c git2` parse option when [Running Code Maat](#running-code-maat).
7474

75-
git log --all --numstat --date=short --pretty=format:'--%h--%ad--%aN' --no-renames --after=YYYY-MM-DD
75+
git log --all --numstat --date=short --pretty=format:'--%h--%ad--%aN' --no-renames --after=YYYY-MM-DD > logfile.log
7676

7777
Many codebases include third-party content or non-code artefacts, which might generate noise in the analyses.
7878
You can exclude such content via git's pathspecs that limit paths on the command line.
@@ -91,7 +91,7 @@ To exclude multiple folders, you just append more pathspecs:
9191
#### Generate a Perforce log file using the following command:
9292

9393
p4 changes -s submitted -m 5000 //depot/project/... | cut -d ' ' -f 2 | xargs -I commitid -n1 sh -c 'p4 describe -s commitid | grep -v "^\s*$" && echo ""'
94-
94+
9595
#### Generate a TFS log file using the following command from a Developer command-prompt:
9696
###### Note: The TFS CLI tool does not support custom date formatting. The parser currently only supports the en-us default: Friday, January 1, 2016 1:12:35 PM - you may need to adjust your system locale settings before using the following command.
9797

@@ -118,9 +118,9 @@ When invoked with `-h`, Code Maat prints its usage:
118118
adam$ java -jar code-maat-0.9.0.jar
119119
This is Code Maat, a program used to collect statistics from a VCS.
120120
Version: 0.9.0-SNAPSHOT
121-
121+
122122
Usage: program-name -l log-file [options]
123-
123+
124124
Options:
125125
-l, --log LOG Log file with input data
126126
-c, --version-control VCS Input vcs module type: supports svn, git, git2, hg, p4, or tfs

src/code_maat/analysis/authors.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
(ds/-order-by [:n-authors :n-revs] order-fn))))
6868

6969
(defn all-authors
70-
[ds options]
70+
[ds]
7171
(->> ds
7272
all
7373
(ds/-dataset [:author])

src/code_maat/analysis/code_age.clj

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66
(ns code-maat.analysis.code-age
77
(:require [code-maat.dataset.dataset :as ds]
88
[code-maat.parsers.time-parser :as tp]
9-
[clj-time.core :as tc]
10-
[clojure.string :as str]
11-
[code-maat.analysis.math :as math]))
9+
[clj-time.core :as tc]))
1210

1311
;;; The following analysis is inspired by Dan North's presentation
1412
;;; on keeping a short software half-life.
@@ -72,4 +70,3 @@
7270
(entities-by-latest-modification (time-now options))
7371
(ds/-dataset [:entity :age-months])
7472
(ds/-order-by [:age-months] :asc)))
75-

src/code_maat/analysis/commit_messages.clj

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,14 @@
55

66
(ns code-maat.analysis.commit-messages
77
(:require [code-maat.dataset.dataset :as dataset]
8-
[incanter.core :as incanter]
9-
[code-maat.analysis.math :as math]))
8+
[incanter.core :as incanter]))
109

1110
;;; This module helps you analyze version-control data
1211
;;; based on commit messages.
1312
;;; Our commit messages contain information about our process and
1413
;;; the kind of work we do.
1514
;;; For example, we can use that information to extract
16-
;;; statistics on bug distributions. Note that this data is
15+
;;; statistics on bug distributions. Note that this data is
1716
;;; heuristics, not absolute truths (for that you need to mine
1817
;;; your bug tracking system).
1918
;;;

src/code_maat/analysis/communication.clj

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
[code-maat.analysis.effort :as effort]
99
[clojure.math.combinatorics :as combo]
1010
[code-maat.analysis.math :as m]
11-
[clojure.math.numeric-tower :as math]
12-
[incanter.core :as incanter]))
11+
[clojure.math.numeric-tower :as math]))
1312

1413
;;; This module attempts to give some heuristics on
1514
;;; the communication needs of a project.
@@ -34,7 +33,7 @@
3433
;;; give us a fast way to look-up the total number of
3534
;;; commits for an author.
3635

37-
(defn- authorship-combos
36+
(defn- authorship-combos
3837
[authors]
3938
(combo/selections authors 2))
4039

@@ -89,7 +88,7 @@
8988
shared work by the authors on different entities.
9089
Returns a dataset containing pairs of all permutations
9190
of authors with a (heuristic) communication strength
92-
value for each pair."
91+
value for each pair."
9392
[ds options]
9493
(->>
9594
(effort/as-revisions-per-author ds options)
@@ -99,4 +98,3 @@
9998
with-commit-stats
10099
(ds/-dataset [:author :peer :shared :average :strength])
101100
(ds/-order-by [:strength :author] :desc)))
102-

src/code_maat/analysis/coupling_algos.clj

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@
66
(ns code-maat.analysis.coupling-algos
77
(:require [clojure.math.combinatorics :as combo]
88
[code-maat.dataset.dataset :as ds]
9-
[code-maat.analysis.math :as m]
10-
[clojure.math.numeric-tower :as math])
11-
(:use incanter.core))
9+
[clojure.math.numeric-tower :as math]
10+
[incanter.core :as incanter]))
1211

1312
;;; This module contains the shared algorithms for the
1413
;;; different coupling measures.
@@ -35,13 +34,13 @@
3534
(->
3635
(combo/selections entities 2)
3736
drop-mirrored-modules))
38-
37+
3938
(defn as-entities-by-revision
4039
"Extracts the change set per revision
4140
from an Incanter dataset."
4241
[ds]
4342
(->>
44-
($ [:rev :entity] ds) ; minimal
43+
(incanter/$ [:rev :entity] ds) ; minimal
4544
(ds/-group-by :rev)
4645
(map second)))
4746

@@ -69,7 +68,7 @@
6968
its number of revisions as value.
7069
This is used when calculating the degree
7170
of coupling later."
72-
[all-co-changing]
71+
[all-co-changing]
7372
(->
7473
(mapcat modules-in-one-rev all-co-changing)
7574
frequencies))
@@ -89,10 +88,10 @@
8988
(map as-co-changing-modules)))
9089

9190
(defn coupling-frequencies
92-
[co-changing]
9391
"Returns a map with pairs of coupled
9492
modules (pairs) as keyes and their
9593
number of shared revisions as value."
94+
[co-changing]
9695
(->
9796
(apply concat co-changing)
9897
drop-duplicates ; remember: included to get the right total revisions

src/code_maat/analysis/effort.clj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
(ns code-maat.analysis.effort
77
(:require [code-maat.dataset.dataset :as ds]
8-
[incanter.core :as incanter]
98
[clojure.math.numeric-tower :as m]
109
[code-maat.analysis.math :as math]))
1110

src/code_maat/analysis/logical_coupling.clj

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
(:require [code-maat.analysis.coupling-algos :as c]
88
[code-maat.dataset.dataset :as ds]
99
[code-maat.analysis.math :as m]
10-
[clojure.math.numeric-tower :as math])
11-
(:use incanter.core))
10+
[clojure.math.numeric-tower :as math]
11+
[incanter.core :as incanter]))
1212

1313
;;; This module calculates the logical coupling of all modules.
1414
;;;
@@ -48,11 +48,10 @@
4848
the number of shared commits between coupled entities divided
4949
by the average number of total commits for the coupled entities."
5050
([ds options]
51-
(by-degree ds options :desc))
51+
(by-degree ds options :desc))
5252
([ds options order-fn]
53-
(->>
54-
(partial c/within-threshold? options)
55-
(as-logical-coupling-measure ds options)
56-
(ds/-dataset [:entity :coupled :degree :average-revs])
57-
($order [:degree :average-revs] order-fn))))
58-
53+
(->>
54+
(partial c/within-threshold? options)
55+
(as-logical-coupling-measure ds options)
56+
(ds/-dataset [:entity :coupled :degree :average-revs])
57+
(incanter/$order [:degree :average-revs] order-fn))))

src/code_maat/analysis/math.clj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
;;; Distributed under the GNU General Public License v3.0,
44
;;; see http://www.gnu.org/licenses/gpl.html
55

6-
(ns code-maat.analysis.math
7-
(:require [clojure.math.numeric-tower :as m]))
6+
(ns code-maat.analysis.math)
87

98
(defn average [& vals]
109
(/

src/code_maat/analysis/sum_of_coupling.clj

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
(ns code-maat.analysis.sum-of-coupling
77
(:require [code-maat.dataset.dataset :as ds]
8-
[code-maat.analysis.coupling-algos :as c])
9-
(:use incanter.core))
8+
[code-maat.analysis.coupling-algos :as c]
9+
[incanter.core :as incanter]))
1010

1111
;;; This module calculates the sum of the temporal coupling for each module.
1212
;;;
@@ -38,8 +38,8 @@
3838
(mapcat counted-entities)))
3939

4040
(defn as-soc
41-
"Calculates a Sum of Coupling for each entity in
42-
the dataset that passes the threshold for minimum
41+
"Calculates a Sum of Coupling for each entity in
42+
the dataset that passes the threshold for minimum
4343
number of revisions."
4444
[ds {:keys [min-revs]}]
4545
(->> ds
@@ -48,17 +48,17 @@
4848
(update-in acc [e] (fnil + 0) n))
4949
{})
5050
(into [])
51-
(filter (fn [[e n]]
51+
(filter (fn [[e n]]
5252
(> n min-revs)))))
5353

5454
(defn by-degree
5555
"Calculates the sum of coupling. Returns a seq
5656
sorted in descending order (default) or an optional,
5757
custom sorting criterion."
5858
([ds options]
59-
(by-degree ds options :desc))
59+
(by-degree ds options :desc))
6060
([ds options order-fn]
61-
(->>
62-
(as-soc ds options)
63-
(ds/-dataset [:entity :soc])
64-
($order [:soc :entity] order-fn))))
61+
(->>
62+
(as-soc ds options)
63+
(ds/-dataset [:entity :soc])
64+
(incanter/$order [:soc :entity] order-fn))))

0 commit comments

Comments
 (0)