Skip to content

Commit

Permalink
Merge pull request #271 from PabloLec/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
PabloLec committed Oct 28, 2023
2 parents ad14e67 + 9092aa5 commit 0e0eb30
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/main/graphql/schema/github/GetRepos.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ query GetTopRepos($query : String!, $cursor: String) {
name
target {
... on Commit {
pushedDate
authoredDate
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/graphql/schema/github/GetUpdateDate.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ query GetUpdateDate($ids: [ID!]!) {
defaultBranchRef {
target {
... on Commit {
pushedDate
authoredDate
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/graphql/schema/github/UpdateRepos.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ query UpdateRepos($ids: [ID!]!) {
name
target {
... on Commit {
pushedDate
authoredDate
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/graphql/schema/github/schema.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/main/kotlin/api/ApiManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class ApiManager(private val mongoManager: MongoManager, var languages: Set<Lang
logger.error { " 403: Rate limit exceeded" }
break
}
logger.error { " $language | $e " }
logger.error(e) { " $language | Error in API query " }
break
}

Expand Down Expand Up @@ -110,7 +110,7 @@ class ApiManager(private val mongoManager: MongoManager, var languages: Set<Lang
val apiResponse = fetcher.fetchReposToUpdate(it)
addAll(apiResponse.repos)
} catch (e: Exception) {
logger.error { "Update error: $e " }
logger.error(e) { "Update error" }
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/main/kotlin/api/Fetcher.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Fetcher {
try {
add(Repository.fromEdge(it!!))
} catch (e: Exception) {
logger.error { "Error while parsing edge $it: ${e.message}" }
logger.error(e) { "Error while parsing edge $it" }
}
}
}
Expand All @@ -52,7 +52,7 @@ class Fetcher {
try {
add(Repository.fromNode(it!!))
} catch (e: Exception) {
logger.error { "Error while parsing node $it: $e - ${e.message}" }
logger.error(e) { "Error while parsing node $it" }
}
}
}
Expand All @@ -71,7 +71,7 @@ class Fetcher {
response = client.query(GetUpdateDateQuery(repos.map { it.ghid })).execute()
if (response.errors != null) logger.error { "Response errors: ${response.errors}" }
} catch (e: Exception) {
logger.error { "Error while fetching update dates: ${e.message}" }
logger.error(e) { "Error while fetching update dates" }
return emptySet()
}

Expand All @@ -81,11 +81,11 @@ class Fetcher {
add(
Pair(
it!!.onRepository!!.id,
it.onRepository!!.defaultBranchRef!!.target!!.onCommit!!.pushedDate.toString()
it.onRepository!!.defaultBranchRef!!.target!!.onCommit!!.authoredDate.toString()
)
)
} catch (e: Exception) {
logger.error { "Error while parsing node $it: $e - ${e.message}" }
logger.error(e) { "Error while parsing node $it" }
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/loc/GitCount.kt
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class GitCount(val language: Language, val repo: Repository) {
lineCount += result.lineCount
parsedLength += result.parsedLength
} catch (e: VirtualMachineError) {
logger.error { "Error counting ${repo.url} file ${file.name} ${e.message}" }
logger.error(e) { "Error counting ${repo.url} file ${file.name}" }
lineCount += file.readText().lines().size
parsedLength += file.readText().length
} finally {
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/models/Repository.kt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ data class Repository(
node.onRepository.name.trim(),
node.onRepository.description?.trim() ?: "",
node.onRepository.createdAt.toDate(),
node.onRepository.defaultBranchRef!!.target!!.onCommit!!.pushedDate!!.toDate(),
node.onRepository.defaultBranchRef!!.target!!.onCommit!!.authoredDate.toDate(),
node.onRepository.stargazers.totalCount,
node.onRepository.url as String,
node.onRepository.defaultBranchRef.name,
Expand Down Expand Up @@ -82,7 +82,7 @@ data class Repository(
edge.node.onRepository!!.name.trim(),
edge.node.onRepository.description?.trim() ?: "",
edge.node.onRepository.createdAt.toDate(),
edge.node.onRepository.defaultBranchRef!!.target!!.onCommit!!.pushedDate!!.toDate(),
edge.node.onRepository.defaultBranchRef!!.target!!.onCommit!!.authoredDate!!.toDate(),
edge.node.onRepository.stargazers.totalCount,
edge.node.onRepository.url as String,
edge.node.onRepository.defaultBranchRef.name,
Expand Down
6 changes: 3 additions & 3 deletions src/test/kotlin/mocks/GraphQL.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ val testEdgeNewRepo = GetTopReposQuery.Edge(
target = GetTopReposQuery.Target(
"",
onCommit = GetTopReposQuery.OnCommit(
pushedDate = "2021-01-01T00:00:00Z"
authoredDate = "2021-01-01T00:00:00Z"
)
)

Expand Down Expand Up @@ -74,7 +74,7 @@ val testEdgeRepoWithFewStars = GetTopReposQuery.Edge(
target = GetTopReposQuery.Target(
"",
onCommit = GetTopReposQuery.OnCommit(
pushedDate = "2021-01-01T00:00:00Z"
authoredDate = "2021-01-01T00:00:00Z"
)
)
),
Expand Down Expand Up @@ -111,7 +111,7 @@ val testNodeRepoToUpdate = listOf(
target = UpdateReposQuery.Target(
"",
onCommit = UpdateReposQuery.OnCommit(
pushedDate = "2021-01-01T00:00:00Z"
authoredDate = "2021-01-01T00:00:00Z"
)
)
),
Expand Down

0 comments on commit 0e0eb30

Please sign in to comment.