Skip to content

Commit

Permalink
Merge e13954f into e016912
Browse files Browse the repository at this point in the history
  • Loading branch information
milosmns authored Sep 30, 2023
2 parents e016912 + e13954f commit 7cf574d
Show file tree
Hide file tree
Showing 62 changed files with 1,080 additions and 82 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ org.gradle.jvmargs=-Xmx4096m
# Project properties
config.group = xyz.marinkovic.milos
config.artifact = codestats
config.version = 0.6.0
config.version = 0.7.0
config.gitHubRepoOwner = milosmns
config.gitHubRepoName = code-stats
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package calculator

import components.data.Repository
import components.metrics.CodeReviewChangeLinesAdded
import history.filter.transform.RepositoryFinishedAtTransform
import kotlinx.datetime.LocalDate

class CodeReviewChangeLinesAddedCalculator : GenericLongMetricCalculator<CodeReviewChangeLinesAdded> {
class CodeReviewChangeLinesAddedCalculator : GenericCountMetricCalculator<CodeReviewChangeLinesAdded> {

override fun calculate(repositories: List<Repository>): CodeReviewChangeLinesAdded {
val perUser = repositories
Expand Down Expand Up @@ -42,4 +44,6 @@ class CodeReviewChangeLinesAddedCalculator : GenericLongMetricCalculator<CodeRev
)
}

override fun getTimeSeriesTransform(date: LocalDate) = RepositoryFinishedAtTransform(date)

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package calculator

import components.data.Repository
import components.metrics.CodeReviewChangeLinesDeleted
import history.filter.transform.RepositoryFinishedAtTransform
import kotlinx.datetime.LocalDate

class CodeReviewChangeLinesDeletedCalculator : GenericLongMetricCalculator<CodeReviewChangeLinesDeleted> {
class CodeReviewChangeLinesDeletedCalculator : GenericCountMetricCalculator<CodeReviewChangeLinesDeleted> {

override fun calculate(repositories: List<Repository>): CodeReviewChangeLinesDeleted {
val perUser = repositories
Expand Down Expand Up @@ -42,4 +44,6 @@ class CodeReviewChangeLinesDeletedCalculator : GenericLongMetricCalculator<CodeR
)
}

override fun getTimeSeriesTransform(date: LocalDate) = RepositoryFinishedAtTransform(date)

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package calculator

import components.data.Repository
import components.metrics.CodeReviewChangeLinesTotal
import history.filter.transform.RepositoryFinishedAtTransform
import kotlinx.datetime.LocalDate

class CodeReviewChangeLinesTotalCalculator : GenericLongMetricCalculator<CodeReviewChangeLinesTotal> {
class CodeReviewChangeLinesTotalCalculator : GenericCountMetricCalculator<CodeReviewChangeLinesTotal> {

override fun calculate(repositories: List<Repository>): CodeReviewChangeLinesTotal {
val perUser = repositories
Expand Down Expand Up @@ -42,4 +44,6 @@ class CodeReviewChangeLinesTotalCalculator : GenericLongMetricCalculator<CodeRev
)
}

override fun getTimeSeriesTransform(date: LocalDate) = RepositoryFinishedAtTransform(date)

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package calculator

import components.data.Repository
import components.metrics.CodeReviewChangesAdded
import history.filter.transform.RepositoryFinishedAtTransform
import kotlinx.datetime.LocalDate

class CodeReviewChangesAddedCalculator : GenericLongMetricCalculator<CodeReviewChangesAdded> {
class CodeReviewChangesAddedCalculator : GenericCountMetricCalculator<CodeReviewChangesAdded> {

override fun calculate(repositories: List<Repository>): CodeReviewChangesAdded {
val perUser = repositories
Expand Down Expand Up @@ -42,4 +44,6 @@ class CodeReviewChangesAddedCalculator : GenericLongMetricCalculator<CodeReviewC
)
}

override fun getTimeSeriesTransform(date: LocalDate) = RepositoryFinishedAtTransform(date)

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package calculator

import components.data.Repository
import components.metrics.CodeReviewChangesModified
import history.filter.transform.RepositoryFinishedAtTransform
import kotlinx.datetime.LocalDate

class CodeReviewChangesModifiedCalculator : GenericLongMetricCalculator<CodeReviewChangesModified> {
class CodeReviewChangesModifiedCalculator : GenericCountMetricCalculator<CodeReviewChangesModified> {

override fun calculate(repositories: List<Repository>): CodeReviewChangesModified {
val perUser = repositories
Expand Down Expand Up @@ -42,4 +44,6 @@ class CodeReviewChangesModifiedCalculator : GenericLongMetricCalculator<CodeRevi
)
}

override fun getTimeSeriesTransform(date: LocalDate) = RepositoryFinishedAtTransform(date)

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package calculator

import components.data.Repository
import components.metrics.CodeReviewChangesRemoved
import history.filter.transform.RepositoryFinishedAtTransform
import kotlinx.datetime.LocalDate

class CodeReviewChangesRemovedCalculator : GenericLongMetricCalculator<CodeReviewChangesRemoved> {
class CodeReviewChangesRemovedCalculator : GenericCountMetricCalculator<CodeReviewChangesRemoved> {

override fun calculate(repositories: List<Repository>): CodeReviewChangesRemoved {
val perUser = repositories
Expand Down Expand Up @@ -42,4 +44,6 @@ class CodeReviewChangesRemovedCalculator : GenericLongMetricCalculator<CodeRevie
)
}

override fun getTimeSeriesTransform(date: LocalDate) = RepositoryFinishedAtTransform(date)

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package calculator

import components.data.Repository
import components.metrics.CodeReviewChangesTotal
import history.filter.transform.RepositoryFinishedAtTransform
import kotlinx.datetime.LocalDate

class CodeReviewChangesTotalCalculator : GenericLongMetricCalculator<CodeReviewChangesTotal> {
class CodeReviewChangesTotalCalculator : GenericCountMetricCalculator<CodeReviewChangesTotal> {

override fun calculate(repositories: List<Repository>): CodeReviewChangesTotal {
val perUser = repositories
Expand Down Expand Up @@ -42,4 +44,6 @@ class CodeReviewChangesTotalCalculator : GenericLongMetricCalculator<CodeReviewC
)
}

override fun getTimeSeriesTransform(date: LocalDate) = RepositoryFinishedAtTransform(date)

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package calculator

import components.data.Repository
import components.metrics.CodeReviewCommentsAuthored
import history.filter.transform.RepositoryCreatedAtTransform
import kotlinx.datetime.LocalDate

class CodeReviewCommentsAuthoredCalculator : GenericLongMetricCalculator<CodeReviewCommentsAuthored> {
class CodeReviewCommentsAuthoredCalculator : GenericCountMetricCalculator<CodeReviewCommentsAuthored> {

override fun calculate(repositories: List<Repository>): CodeReviewCommentsAuthored {
val perUser = repositories
Expand Down Expand Up @@ -43,4 +45,10 @@ class CodeReviewCommentsAuthoredCalculator : GenericLongMetricCalculator<CodeRev
)
}

override fun getTimeSeriesTransform(date: LocalDate) = RepositoryCreatedAtTransform(
createdAt = date,
applyToCommentsAndFeedbacks = true,
applyToCodeReviewsAndDiscussions = false,
)

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package calculator

import components.data.Repository
import components.metrics.CodeReviewCommentsReceived
import history.filter.transform.RepositoryCreatedAtTransform
import kotlinx.datetime.LocalDate

class CodeReviewCommentsReceivedCalculator : GenericLongMetricCalculator<CodeReviewCommentsReceived> {
class CodeReviewCommentsReceivedCalculator : GenericCountMetricCalculator<CodeReviewCommentsReceived> {

override fun calculate(repositories: List<Repository>): CodeReviewCommentsReceived {
@Suppress("DuplicatedCode") // false positive from DiscussionCommentsReceivedCalculator
Expand All @@ -26,4 +28,10 @@ class CodeReviewCommentsReceivedCalculator : GenericLongMetricCalculator<CodeRev
)
}

override fun getTimeSeriesTransform(date: LocalDate) = RepositoryCreatedAtTransform(
createdAt = date,
applyToCommentsAndFeedbacks = true,
applyToCodeReviewsAndDiscussions = false,
)

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package calculator

import components.data.Repository
import components.metrics.CodeReviewFeedbacksApproved
import history.filter.transform.RepositoryCreatedAtTransform
import kotlinx.datetime.LocalDate

class CodeReviewFeedbacksApprovedCalculator : GenericLongMetricCalculator<CodeReviewFeedbacksApproved> {
class CodeReviewFeedbacksApprovedCalculator : GenericCountMetricCalculator<CodeReviewFeedbacksApproved> {

override fun calculate(repositories: List<Repository>): CodeReviewFeedbacksApproved {
val perUser = repositories
Expand Down Expand Up @@ -37,4 +39,10 @@ class CodeReviewFeedbacksApprovedCalculator : GenericLongMetricCalculator<CodeRe
)
}

override fun getTimeSeriesTransform(date: LocalDate) = RepositoryCreatedAtTransform(
createdAt = date,
applyToCommentsAndFeedbacks = true,
applyToCodeReviewsAndDiscussions = false,
)

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package calculator

import components.data.Repository
import components.metrics.CodeReviewFeedbacksPostponed
import history.filter.transform.RepositoryCreatedAtTransform
import kotlinx.datetime.LocalDate

class CodeReviewFeedbacksPostponedCalculator : GenericLongMetricCalculator<CodeReviewFeedbacksPostponed> {
class CodeReviewFeedbacksPostponedCalculator : GenericCountMetricCalculator<CodeReviewFeedbacksPostponed> {

override fun calculate(repositories: List<Repository>): CodeReviewFeedbacksPostponed {
val perUser = repositories
Expand Down Expand Up @@ -37,4 +39,10 @@ class CodeReviewFeedbacksPostponedCalculator : GenericLongMetricCalculator<CodeR
)
}

override fun getTimeSeriesTransform(date: LocalDate) = RepositoryCreatedAtTransform(
createdAt = date,
applyToCommentsAndFeedbacks = true,
applyToCodeReviewsAndDiscussions = false,
)

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package calculator

import components.data.Repository
import components.metrics.CodeReviewFeedbacksRejected
import history.filter.transform.RepositoryCreatedAtTransform
import kotlinx.datetime.LocalDate

class CodeReviewFeedbacksRejectedCalculator : GenericLongMetricCalculator<CodeReviewFeedbacksRejected> {
class CodeReviewFeedbacksRejectedCalculator : GenericCountMetricCalculator<CodeReviewFeedbacksRejected> {

override fun calculate(repositories: List<Repository>): CodeReviewFeedbacksRejected {
val perUser = repositories
Expand Down Expand Up @@ -37,4 +39,10 @@ class CodeReviewFeedbacksRejectedCalculator : GenericLongMetricCalculator<CodeRe
)
}

override fun getTimeSeriesTransform(date: LocalDate) = RepositoryCreatedAtTransform(
createdAt = date,
applyToCommentsAndFeedbacks = true,
applyToCodeReviewsAndDiscussions = false,
)

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package calculator

import components.data.Repository
import components.metrics.CodeReviewFeedbacksTotal
import history.filter.transform.RepositoryCreatedAtTransform
import kotlinx.datetime.LocalDate

class CodeReviewFeedbacksTotalCalculator : GenericLongMetricCalculator<CodeReviewFeedbacksTotal> {
class CodeReviewFeedbacksTotalCalculator : GenericCountMetricCalculator<CodeReviewFeedbacksTotal> {

override fun calculate(repositories: List<Repository>): CodeReviewFeedbacksTotal {
val perUser = repositories
Expand Down Expand Up @@ -37,4 +39,10 @@ class CodeReviewFeedbacksTotalCalculator : GenericLongMetricCalculator<CodeRevie
)
}

override fun getTimeSeriesTransform(date: LocalDate) = RepositoryCreatedAtTransform(
createdAt = date,
applyToCommentsAndFeedbacks = true,
applyToCodeReviewsAndDiscussions = false,
)

}
10 changes: 9 additions & 1 deletion src/commonMain/kotlin/calculator/CodeReviewsCalculator.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package calculator

import components.data.Repository
import components.metrics.CodeReviews
import history.filter.transform.RepositoryCreatedAtTransform
import kotlinx.datetime.LocalDate

class CodeReviewsCalculator : GenericLongMetricCalculator<CodeReviews> {
class CodeReviewsCalculator : GenericCountMetricCalculator<CodeReviews> {

override fun calculate(repositories: List<Repository>): CodeReviews {
val perUser = repositories
Expand Down Expand Up @@ -32,4 +34,10 @@ class CodeReviewsCalculator : GenericLongMetricCalculator<CodeReviews> {
)
}

override fun getTimeSeriesTransform(date: LocalDate) = RepositoryCreatedAtTransform(
createdAt = date,
applyToCommentsAndFeedbacks = false,
applyToCodeReviewsAndDiscussions = true,
)

}
6 changes: 5 additions & 1 deletion src/commonMain/kotlin/calculator/CycleTimeCalculator.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ package calculator

import components.data.Repository
import components.metrics.CycleTime
import history.filter.transform.RepositoryFinishedAtTransform
import kotlinx.datetime.Instant
import kotlinx.datetime.LocalDate

class CycleTimeCalculator(private val now: Instant) : GenericLongMetricCalculator<CycleTime> {
class CycleTimeCalculator(private val now: Instant) : GenericCountMetricCalculator<CycleTime> {

override fun calculate(repositories: List<Repository>): CycleTime {
val perUser = repositories
Expand Down Expand Up @@ -42,4 +44,6 @@ class CycleTimeCalculator(private val now: Instant) : GenericLongMetricCalculato
)
}

override fun getTimeSeriesTransform(date: LocalDate) = RepositoryFinishedAtTransform(date)

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package calculator

import components.data.Repository
import components.metrics.DiscussionCommentsAuthored
import history.filter.transform.RepositoryCreatedAtTransform
import kotlinx.datetime.LocalDate

class DiscussionCommentsAuthoredCalculator : GenericLongMetricCalculator<DiscussionCommentsAuthored> {
class DiscussionCommentsAuthoredCalculator : GenericCountMetricCalculator<DiscussionCommentsAuthored> {

override fun calculate(repositories: List<Repository>): DiscussionCommentsAuthored {
val perUser = repositories
Expand Down Expand Up @@ -47,4 +49,10 @@ class DiscussionCommentsAuthoredCalculator : GenericLongMetricCalculator<Discuss
)
}

override fun getTimeSeriesTransform(date: LocalDate) = RepositoryCreatedAtTransform(
createdAt = date,
applyToCommentsAndFeedbacks = true,
applyToCodeReviewsAndDiscussions = false,
)

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package calculator

import components.data.Repository
import components.metrics.DiscussionCommentsReceived
import history.filter.transform.RepositoryCreatedAtTransform
import kotlinx.datetime.LocalDate

class DiscussionCommentsReceivedCalculator : GenericLongMetricCalculator<DiscussionCommentsReceived> {
class DiscussionCommentsReceivedCalculator : GenericCountMetricCalculator<DiscussionCommentsReceived> {

override fun calculate(repositories: List<Repository>): DiscussionCommentsReceived {
@Suppress("DuplicatedCode") // false positive from CodeReviewCommentsReceivedCalculator
Expand All @@ -26,4 +28,10 @@ class DiscussionCommentsReceivedCalculator : GenericLongMetricCalculator<Discuss
)
}

override fun getTimeSeriesTransform(date: LocalDate) = RepositoryCreatedAtTransform(
createdAt = date,
applyToCommentsAndFeedbacks = true,
applyToCodeReviewsAndDiscussions = false,
)

}
10 changes: 9 additions & 1 deletion src/commonMain/kotlin/calculator/DiscussionsCalculator.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package calculator

import components.data.Repository
import components.metrics.Discussions
import history.filter.transform.RepositoryCreatedAtTransform
import kotlinx.datetime.LocalDate

class DiscussionsCalculator : GenericLongMetricCalculator<Discussions> {
class DiscussionsCalculator : GenericCountMetricCalculator<Discussions> {

override fun calculate(repositories: List<Repository>): Discussions {
val perUser = repositories
Expand Down Expand Up @@ -42,4 +44,10 @@ class DiscussionsCalculator : GenericLongMetricCalculator<Discussions> {
)
}

override fun getTimeSeriesTransform(date: LocalDate) = RepositoryCreatedAtTransform(
createdAt = date,
applyToCommentsAndFeedbacks = false,
applyToCodeReviewsAndDiscussions = true,
)

}
Loading

0 comments on commit 7cf574d

Please sign in to comment.