ljharb / repo-report

CLI to list all repos a user has access to, and report on their configuration in aggregate.
MIT License
24 stars 11 forks source link

Refactor to make adding new metrics easier. #58

Closed rosekamallove closed 2 years ago

rosekamallove commented 2 years ago

We can probably create a file say metrics.js and then add an object to it containing all the metric-dependent code.

It may look like:

const metrics = {
  metricNames: [...orderedMetricNames],
  permissions: { ...metricPermissions },
  extractionMethods: { ...extractionMethods },
  schemaForValidation: { ...typesOfMetrics },
};
rosekamallove commented 2 years ago

@ljharb should we also add the GraphQL Query in the same file too?

ljharb commented 2 years ago

Let’s start with just the metrics - maybe the graphql query can be constructed dynamically from the one list of metrics?

rosekamallove commented 2 years ago

The names are different in the metricNames array we would have to add a lot of checks. Maybe I can think of a solution. For now I'll just refactor the metricsNames extractMethods & permissions

ljharb commented 2 years ago

Done in #60.