-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from moosetechnology/GLPH-importer-new-changes
Lot of changes comming from analysis code of Berger-Levrault
- Loading branch information
Showing
47 changed files
with
4,255 additions
and
227 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Use the official smalltalkci image from Docker Hub | ||
FROM hpiswa/smalltalkci | ||
|
||
# Set environment variables | ||
ENV ORIGIN_IMAGE_NAME=Moose64-11 | ||
ENV IMAGE_NAME=PharoServer | ||
|
||
# Set the working directory | ||
WORKDIR /usr/src/app | ||
|
||
# Copy your Smalltalk project files into the container | ||
COPY . . | ||
|
||
# Run the CI script commands | ||
RUN smalltalkci -s "${ORIGIN_IMAGE_NAME}" .smalltalk.ston | ||
RUN mkdir ${IMAGE_NAME} | ||
RUN mv /root/smalltalkCI-master/_builds/* ./${IMAGE_NAME} | ||
RUN mv ./${IMAGE_NAME}/*/* ./${IMAGE_NAME} | ||
RUN mv ${IMAGE_NAME}/TravisCI.changes ${IMAGE_NAME}/${IMAGE_NAME}.changes | ||
RUN mv ${IMAGE_NAME}/TravisCI.image ${IMAGE_NAME}/${IMAGE_NAME}.image | ||
RUN rm ${IMAGE_NAME}/build_status.txt | ||
RUN rm -rf ${IMAGE_NAME}/vm | ||
|
||
# Expose any ports the application might need (if applicable) | ||
# EXPOSE 8080 | ||
|
||
# Set the command to run your Smalltalk application | ||
CMD ["/root/smalltalkCI-master/_cache/vms/Moose64-11/pharo", "--headless", "PharoServer/PharoServer.image", "st", "./launchAnalyze.st"] | ||
# the output csv files will be under /root/*.csv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
|glphModel glphApi glhImporter beforeExp duringExp usersWithProjects gme| | ||
|
||
"This example set up and run a GitProjectHealth metrics over two period of time of a given set of users and their projects. | ||
It ouputs a csv files containing : churn code, commits frequencies, code addition and deletion, comments added (e.g. // # /**/ ), avg delay before first churn and merge request duration. | ||
" | ||
|
||
"load githealth project into your image" | ||
Metacello new | ||
repository: 'github://moosetechnology/GitProjectHealth:GLPH-importer-new-changes/src'; | ||
baseline: 'GitLabHealth'; | ||
onConflict: [ :ex | ex useIncoming ]; | ||
onUpgrade: [ :ex | ex useIncoming ]; | ||
onDowngrade: [ :ex | ex useLoaded ]; | ||
ignoreImage; | ||
load. | ||
|
||
"set up a log at your root" | ||
TinyLogger default | ||
addFileLoggerNamed: 'pharo-code-churn.log'. | ||
|
||
"new model instance" | ||
glphModel := GLPHEModel new. | ||
|
||
"new API class instance" | ||
glphApi := GLPHApi new | ||
privateToken: '<YOUR_TOKEN_KEY>'; | ||
baseAPIUrl:'https://gitlab.com/api/v4'; | ||
yourself. | ||
|
||
"new importer instance" | ||
glhImporter := GLPHModelImporter new | ||
glhApi: glphApi; | ||
glhModel: glphModel; | ||
withFiles: false; | ||
withCommitDiffs: true. | ||
|
||
"setting up the period to compare (e.g. before a experience and during an experience)" | ||
beforeExp := { | ||
#since -> ('1 march 2023' asDate). | ||
#until -> ('24 may 2023' asDate). | ||
} asDictionary . | ||
duringExp := { | ||
#since -> ('1 march 2024' asDate). | ||
#until -> ('24 may 2024' asDate). | ||
} asDictionary . | ||
|
||
usersWithProjects := { | ||
" 'dev nameA' -> { projectID1 . projectID2 }." | ||
" 'dev nameB' -> { projectID3 . projectID2 }." | ||
'John Do' -> { 14 . 543 . 2455 }. | ||
} asDictionary. | ||
|
||
|
||
gme := GitMetricExporter new glhImporter: glhImporter; | ||
initEntitiesFromUserProjects: usersWithProjects; | ||
beforeDic: beforeExp; duringDic: duringExp; label: 'GitLabHealth'. | ||
|
||
"select among the following calendar class (at least one) " | ||
gme exportOver: { Date . Week . Month . Year .}. | ||
|
||
"the output files are located at 'FileLocator home/*.csv' " | ||
Smalltalk snapshot: true andQuit: true. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
src/GLPHExtended-Model-Extension/GLPHEAddition.extension.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Extension { #name : #GLPHEAddition } | ||
|
||
{ #category : #'*GLPHExtended-Model-Extension' } | ||
GLPHEAddition >> isAddition [ | ||
^ true | ||
|
||
] | ||
|
||
{ #category : #'*GLPHExtended-Model-Extension' } | ||
GLPHEAddition >> isDeletion [ | ||
|
||
^ false | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
Extension { #name : #GLPHEChange } | ||
|
||
{ #category : #'*GLPHExtended-Model-Extension' } | ||
GLPHEChange class >> createFrom: aDiffLine [ | ||
"Factory a Change from a loc" | ||
|
||
| aChange | | ||
aChange := nil. | ||
(aDiffLine beginsWith: #'@@') ifTrue: [ | ||
| infos | | ||
aChange := GLPHELineOfCode newFromLoCRange: aDiffLine. | ||
|
||
infos := (aDiffLine splitOn: '@@') copyWithoutFirst. | ||
infos := aDiffLine splitOn: ' ' ]. | ||
^ aChange | ||
] | ||
|
||
{ #category : #'*GLPHExtended-Model-Extension' } | ||
GLPHEChange >> isAddition [ | ||
|
||
^ false | ||
] | ||
|
||
{ #category : #'*GLPHExtended-Model-Extension' } | ||
GLPHEChange >> isDeletion [ | ||
|
||
^ false | ||
] | ||
|
||
{ #category : #'*GLPHExtended-Model-Extension' } | ||
GLPHEChange >> name [ | ||
|
||
^ sourceCode | ||
] | ||
|
||
{ #category : #'*GLPHExtended-Model-Extension' } | ||
GLPHEChange class >> newFrom: aDiffLine [ | ||
"Factory a Change from a loc" | ||
|
||
| aChange code| | ||
aChange := GLPHELineOfCode new. | ||
|
||
code := aDiffLine. | ||
(aDiffLine beginsWith: #'@@') ifTrue: [ | ||
code := (aDiffLine splitOn: '@@') copyWithoutFirst second. | ||
]. | ||
(aDiffLine trim beginsWith: #+) ifTrue: [ aChange := GLPHEAddition new. ]. | ||
(aDiffLine trim beginsWith: #-) ifTrue: [ aChange := GLPHEDeletion new. ]. | ||
|
||
aChange sourceCode: code. | ||
|
||
^ aChange | ||
] |
11 changes: 11 additions & 0 deletions
11
src/GLPHExtended-Model-Extension/GLPHEDeletion.extension.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Extension { #name : #GLPHEDeletion } | ||
|
||
{ #category : #'*GLPHExtended-Model-Extension' } | ||
GLPHEDeletion >> isAddition [ | ||
^ false | ||
] | ||
|
||
{ #category : #'*GLPHExtended-Model-Extension' } | ||
GLPHEDeletion >> isDeletion [ | ||
^ true. | ||
] |
19 changes: 19 additions & 0 deletions
19
src/GLPHExtended-Model-Extension/GLPHEDiffRange.extension.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Extension { #name : #GLPHEDiffRange } | ||
|
||
{ #category : #'*GLPHExtended-Model-Extension' } | ||
GLPHEDiffRange >> name [ | ||
|
||
^ '[ OG: ' , originalLineRange , ' | NEW: ' , newLineRange , ']' | ||
] | ||
|
||
{ #category : #'*GLPHExtended-Model-Extension' } | ||
GLPHEDiffRange class >> newFrom: aLine [ | ||
|range infos rangesInfo | | ||
range := GLPHEDiffRange new. | ||
infos := (aLine splitOn: '@@') copyWithoutFirst. | ||
rangesInfo := infos first trim splitOn: ' '. | ||
range originalLineRange: rangesInfo first. | ||
range newLineRange: rangesInfo second . | ||
|
||
^ range. | ||
] |
22 changes: 22 additions & 0 deletions
22
src/GLPHExtended-Model-Extension/GLPHELineOfCode.extension.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Extension { #name : #GLPHELineOfCode } | ||
|
||
{ #category : #'*GLPHExtended-Model-Extension' } | ||
GLPHELineOfCode class >> newFrom: aDiffLine [ | ||
|
||
| aLoC infos ranges | | ||
infos := (aDiffLine splitOn: '@@') copyWithoutFirst. | ||
aLoC := GLPHELineOfCode new. | ||
aLoC sourceCode: infos second. | ||
^ aLoC. | ||
] | ||
|
||
{ #category : #'*GLPHExtended-Model-Extension' } | ||
GLPHELineOfCode class >> newFromLoCRange: aDiffLine [ | ||
|aLoC infos ranges| | ||
infos := (aDiffLine splitOn: '@@') copyWithoutFirst. | ||
ranges := infos first splitOn: ','. | ||
aLoC := GLPHELineOfCode new. | ||
aLoC originalLineRange: ranges first. | ||
aLoC newLineRange: 1. | ||
aLoC lineOfCode: infos second. | ||
] |
9 changes: 9 additions & 0 deletions
9
src/GLPHExtended-Model-Extension/GLPHEMergeRequest.extension.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Extension { #name : #GLPHEMergeRequest } | ||
|
||
{ #category : #'*GLPHExtended-Model-Extension' } | ||
GLPHEMergeRequest >> name [ | ||
|
||
<FMProperty: #name type: #String> | ||
<FMComment: 'Basic name of the entity, not full reference.'> | ||
^ title | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Package { #name : #'GLPHExtended-Model-Extension' } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.