Skip to content

Commit

Permalink
Add repository language metric
Browse files Browse the repository at this point in the history
Signed-off-by: CreativeNick <[email protected]>
  • Loading branch information
CreativeNick committed Aug 5, 2024
1 parent 538a8b2 commit 8b4132a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions scripts/metricsLib/metrics_definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
# Metrics that save a resource to a file
RESOURCE_METRICS = []

# Predominant Languages Endpoint (ex. https://api.github.com/repos/chaoss/augur/languages)
LANGUAGE_ENDPOINT = "https://api.github.com/repos/chaoss/augur/languages"

REPO_GITHUB_GRAPHQL_QUERY = """
query ($repo: String!, $owner: String!) {
repository(name: $repo, owner: $owner) {
Expand Down Expand Up @@ -116,6 +119,16 @@
{"total_project_blank_lines": ["blank_lines"],
"average_blank_lines": ["avg_blank_lines"]}))

SIMPLE_METRICS.append(ListMetric("repositoryLanguages",
["owner", "repo"],
LANGUAGE_ENDPOINT,
{"languages": None},
token=TOKEN))

SIMPLE_METRICS.append(GraphQLMetric("githubGraphqlSimpleCounts", ["repo", "owner"],
REPO_GITHUB_GRAPHQL_QUERY,
github_graphql_simple_counts_metric_map, token=TOKEN))

REPOMETRICS_ENDPOINT = "https://raw.githubusercontent.com/{owner}/{repo}/main/code.json"
repometrics_values = {"project_type": "project_type", "user_input": "user_input", "project_fisma_level": "project_fisma_level",
"group": "group", "subset_in_healthcare": "subset_in_healthcare", "user_type": "user_type",
Expand Down

0 comments on commit 8b4132a

Please sign in to comment.