Skip to content

Commit

Permalink
Merge pull request #54 from moosetechnology/metrics-fixing
Browse files Browse the repository at this point in the history
Metrics fixing
  • Loading branch information
alkalinan authored Sep 16, 2024
2 parents aef2771 + 9a85a7c commit 8319ca8
Show file tree
Hide file tree
Showing 64 changed files with 1,412 additions and 464 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,22 @@
A GHModelImporterTest is a test class for testing the behavior of GHModelImporter
"
Class {
#name : 'GHModelImporterTest',
#superclass : 'TestCase',
#name : #GHModelImporterTest,
#superclass : #TestCase,
#instVars : [
'importer'
],
#category : 'GitHubHealth-Model-Importer-Tests',
#package : 'GitHubHealth-Model-Importer-Tests'
#category : 'GitHubHealth-Model-Importer-Tests'
}

{ #category : 'running' }
{ #category : #running }
GHModelImporterTest >> setUp [
super setUp.

importer := GHModelImporter new
]

{ #category : 'tests' }
{ #category : #tests }
GHModelImporterTest >> testParseCommitsResult [
"we remove the id of author entries to not trigger the call to import user"

Expand Down Expand Up @@ -191,7 +190,7 @@ GHModelImporterTest >> testParseCommitsResult [
self assert: commits first committed_date isNotNil
]

{ #category : 'tests' }
{ #category : #tests }
GHModelImporterTest >> testParseCommitsResultWithSomeNullValue [
"we remove the id of author entries to not trigger the call to import user"

Expand Down Expand Up @@ -243,7 +242,7 @@ GHModelImporterTest >> testParseCommitsResultWithSomeNullValue [
self assert: commits size equals: 1
]

{ #category : 'test' }
{ #category : #test }
GHModelImporterTest >> testParsePipelinesResult [

| project |
Expand All @@ -264,7 +263,7 @@ GHModelImporterTest >> testParsePipelinesResult [
equals: (DateAndTime year: 2024 month: 01 day: 11)
]

{ #category : 'tests' }
{ #category : #tests }
GHModelImporterTest >> testParseUserResult [

| user |
Expand Down
2 changes: 1 addition & 1 deletion src/GitHubHealth-Model-Importer-Tests/package.st
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Package { #name : 'GitHubHealth-Model-Importer-Tests' }
Package { #name : #'GitHubHealth-Model-Importer-Tests' }
15 changes: 7 additions & 8 deletions src/GitHubHealth-Model-Importer/GHAPIPipelineOverview.class.st
Original file line number Diff line number Diff line change
@@ -1,33 +1,32 @@
Class {
#name : 'GHAPIPipelineOverview',
#superclass : 'Object',
#name : #GHAPIPipelineOverview,
#superclass : #Object,
#instVars : [
'total_count',
'workflow_runs'
],
#category : 'GitHubHealth-Model-Importer',
#package : 'GitHubHealth-Model-Importer'
#category : #'GitHubHealth-Model-Importer'
}

{ #category : 'accessing' }
{ #category : #accessing }
GHAPIPipelineOverview >> total_count [

^ total_count
]

{ #category : 'accessing' }
{ #category : #accessing }
GHAPIPipelineOverview >> total_count: anObject [

total_count := anObject
]

{ #category : 'accessing' }
{ #category : #accessing }
GHAPIPipelineOverview >> workflow_runs [

^ workflow_runs
]

{ #category : 'accessing' }
{ #category : #accessing }
GHAPIPipelineOverview >> workflow_runs: anObject [

workflow_runs := anObject
Expand Down
39 changes: 19 additions & 20 deletions src/GitHubHealth-Model-Importer/GHApi.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,36 @@
You can use me to extract query [GitHub REST Api](https://docs.github.com/en/rest)
"
Class {
#name : 'GHApi',
#superclass : 'Object',
#name : #GHApi,
#superclass : #Object,
#instVars : [
'baseAPIUrl',
'client'
],
#category : 'GitHubHealth-Model-Importer',
#package : 'GitHubHealth-Model-Importer'
#category : 'GitHubHealth-Model-Importer'
}

{ #category : 'api' }
{ #category : #api }
GHApi >> actionsRunOfRepo: aRepoName ofOrganization: anOrganizationName [

^ self client get:
self baseAPIUrl , '/repos/' , anOrganizationName , '/' , aRepoName
, '/actions/runs'
]

{ #category : 'accessing' }
{ #category : #accessing }
GHApi >> baseAPIUrl [

^ baseAPIUrl
]

{ #category : 'accessing' }
{ #category : #accessing }
GHApi >> baseAPIUrl: anObject [

baseAPIUrl := anObject
]

{ #category : 'api' }
{ #category : #api }
GHApi >> branchesOfRepo: aRepoName ofOrganization: anOrganizationName [

self client url:
Expand All @@ -41,19 +40,19 @@ GHApi >> branchesOfRepo: aRepoName ofOrganization: anOrganizationName [
^ self client get
]

{ #category : 'accessing' }
{ #category : #accessing }
GHApi >> client [

^ client
]

{ #category : 'accessing' }
{ #category : #accessing }
GHApi >> client: anObject [

client := anObject
]

{ #category : 'api - commits' }
{ #category : #'api - commits' }
GHApi >> commitsOfProject: aProjectId ofOrganization: organisationName [

^ self
Expand All @@ -64,7 +63,7 @@ GHApi >> commitsOfProject: aProjectId ofOrganization: organisationName [
page: nil
]

{ #category : 'api - commits' }
{ #category : #'api - commits' }
GHApi >> commitsOfProject: aProjectId ofOrganization: organisationName since: aSinceDate perPage: itemPerPage page: pageNumber [

self client url:
Expand All @@ -77,7 +76,7 @@ GHApi >> commitsOfProject: aProjectId ofOrganization: organisationName since: aS
^ self client get
]

{ #category : 'api' }
{ #category : #api }
GHApi >> contentsOfRepo: aRepoName ofOrganization: anOrganizationName inBranch: aBranchRef withPath: aPath [

self client url:
Expand All @@ -87,7 +86,7 @@ GHApi >> contentsOfRepo: aRepoName ofOrganization: anOrganizationName inBranch:
^ self client get
]

{ #category : 'initialization' }
{ #category : #initialization }
GHApi >> initialize [

self baseAPIUrl: 'https://api.github.com'.
Expand All @@ -96,31 +95,31 @@ GHApi >> initialize [
yourself)
]

{ #category : 'api' }
{ #category : #api }
GHApi >> organization: anOrganizationName [

^ self client get: self baseAPIUrl , '/orgs/' , anOrganizationName
]

{ #category : 'accessing' }
{ #category : #accessing }
GHApi >> privateToken [

^ self client request headers at: #'Authorization'
]

{ #category : 'accessing' }
{ #category : #accessing }
GHApi >> privateToken: anObject [

self client headerAt: #'Authorization' add: ('token ', anObject)
]

{ #category : 'api - repositories' }
{ #category : #'api - repositories' }
GHApi >> reposOfOrganization: anOrganizationName [

^ self reposOfOrganization: anOrganizationName perPage: nil page: nil
]

{ #category : 'api - repositories' }
{ #category : #'api - repositories' }
GHApi >> reposOfOrganization: anOrganizationName perPage: itemPerPage page: pageNumber [

self client url:
Expand All @@ -131,7 +130,7 @@ GHApi >> reposOfOrganization: anOrganizationName perPage: itemPerPage page: page
^ self client get
]

{ #category : 'api - users' }
{ #category : #'api - users' }
GHApi >> user: aUserID [

^ self client get: self baseAPIUrl , '/user/' , aUserID asString
Expand Down
15 changes: 7 additions & 8 deletions src/GitHubHealth-Model-Importer/GHApiFile.class.st
Original file line number Diff line number Diff line change
@@ -1,33 +1,32 @@
Class {
#name : 'GHApiFile',
#superclass : 'Object',
#name : #GHApiFile,
#superclass : #Object,
#instVars : [
'name',
'type'
],
#category : 'GitHubHealth-Model-Importer',
#package : 'GitHubHealth-Model-Importer'
#category : #'GitHubHealth-Model-Importer'
}

{ #category : 'accessing' }
{ #category : #accessing }
GHApiFile >> name [

^ name
]

{ #category : 'accessing' }
{ #category : #accessing }
GHApiFile >> name: anObject [

name := anObject
]

{ #category : 'accessing' }
{ #category : #accessing }
GHApiFile >> type [

^ type
]

{ #category : 'accessing' }
{ #category : #accessing }
GHApiFile >> type: anObject [

type := anObject
Expand Down
Loading

0 comments on commit 8319ca8

Please sign in to comment.