1222 Commits

Author SHA1 Message Date
Douglas Eichelberger
37015b6b08 Change to pluralize, port more call sites 2023-02-27 20:17:33 -08:00
Douglas Eichelberger
0438a3a538 Draft implementation to replace ActiveSupport inflections 2023-02-27 20:17:33 -08:00
Mike McQuaid
6db7732fa3
Merge pull request #14821 from issyl0/support-date-ranges-in-pr-reviews-query
dev-cmd/contributions: Support date ranges in PR reviews query
2023-02-28 00:06:41 +00:00
Issy Long
a2d31faa72
dev-cmd/contributions: Support date ranges in PR reviews query
- Now `brew contributions --from=2023-02-23 --to=2023-02-26` works to limit the
  results for reviews. I forgot this in the original implementation, again,
  ugh.
2023-02-26 23:34:53 +00:00
Issy Long
214e2102c3
utils/github: Remove unnecessary .delete_prefix("/")
- This workaround was originally added in 2020. I have confirmed with
  https://api.github.com/search/code?q=brew+language%3Aruby+org:Homebrew that
  the `path` string no longer has a leading `/`.
2023-02-26 15:27:02 +00:00
Issy Long
550599d03b
utils/github: Switch check_fork_exists to fork_exists?
- It's Ruby style convention that methods that return only booleans end with a
  question mark.
2023-02-26 15:26:07 +00:00
Issy Long
591afa8ee0
utils/github: Appease brew style line length 2023-02-25 22:27:48 +00:00
Issy Long
99d2bb9a53
utils/github: Use search_results_items method for code search 2023-02-25 22:01:12 +00:00
Issy Long
8c75eab88a
dev-cmd/contributions: Count PR reviews since they're super important
- The search APIs don't have that high a rate limit but we shouldn't need to
  worry about that too much because, to get counts, the JSON response comes
  with a `total_count` number.
2023-02-25 19:10:17 +00:00
Mike McQuaid
e95ce6967a
brew style --fix 2023-02-24 13:50:07 +00:00
Mike McQuaid
d7029e95cd
Merge pull request #14769 from dduugg/enable-types
Enable typing in Cask::Artifact
2023-02-23 18:02:44 +00:00
Issy Long
28a2a6ea43
utils/github: Add date filtering to the commit author API query
- I missed this off the original implementation - oops. This gives parity with
  the `git log` implementation.
2023-02-22 23:01:38 +00:00
Issy Long
dd140ea717
utils/github/api: Smarter pagination in paginate_rest
- The `API_MAX_PAGES` value is 50, so for pages 1 to 50, the
  `paginate_rest` method was making an API call even if there was no
  data past, for example, page 8.
- This made `brew contributions --user=issyl0` take 11 minutes, since we
  made 50 API calls _per repo_ even if it was unnecessary, burning down
  our API allowance.
- Instead, stop looping if we detect that there's no data in `result`.
- This probably needs more testing for other parts of Homebrew that rely
  on `paginate_rest` and the different shapes of data it outputs.
2023-02-22 17:53:46 +00:00
Douglas Eichelberger
29c6baeed1 Enable typing in Cask::Artifact 2023-02-22 09:11:29 -08:00
Issy Long
93ce211ebd
Merge pull request #14737 from issyl0/api-commits-for-person
dev-cmd/contributions: Use GitHub APIs for commit author info
2023-02-22 14:12:16 +00:00
Mike McQuaid
792ec7fc85
utils/analytics: tweaks constants.
This enables easier usage in `brew formula-analytics`.
2023-02-21 17:07:01 +00:00
Issy Long
c9e6b81b4b
utils/github: API.paginate_rest handles extra query params
- Functionally it doesn't matter that the URL will have an `&` at the
  end if `additional_query_params` is `nil`, because it doesn't affect
  the URL at all.
2023-02-21 11:06:30 +00:00
Mike McQuaid
98d9f28307
Merge pull request #14739 from issyl0/rubocop-disable-all-metrics
rubocop: Entirely disable `Metrics` cops
2023-02-21 09:16:28 +00:00
Mike McQuaid
f0fbeba2ef
Merge pull request #14723 from carlocab/zlib-mtime
utils/gzip: set `mtime = 1` when `mtime == 0`.
2023-02-21 09:04:55 +00:00
Issy Long
298bb65dfb
rubocop: Entirely disable Metrics cops
- These are arbitrary length limits that had a load of disables in code.
- The limits were only increasing over time rather than decreasing.
- Fixing the problematic code to be shorter would take a long time for
  questionable gain since the problem has been around so long.
2023-02-21 00:34:17 +00:00
Issy Long
d3827b12f2
dev-cmd/contributions: Use GitHub APIs for commit author info
- Using `git log` was brittle with name changes and email address changes for
  contributors over the years unless we made a Git `mailmap` file which brings
  with it its own updatedness overhead.
- Let's use the GitHub commits API (importantly _not_ the search API) so that
  we can give it a username and it will return contributions associated with
  every email address on that user's account:
  https://docs.github.com/en/rest/commits/commits?apiVersion=2022-11-28#list-commits--parameters.
- This is quite significantly slower, but it's worth it for correctness
  especially when we get to all maintainers' contributions (in a separate PR).
- The commits API does not (yet?) support trailers or commit "committer"s, just
  authors.
2023-02-20 23:24:54 +00:00
Carlo Cabrera
55c75618fc
utils/gzip: set mtime = 1 when mtime == 0.
This allows us to bottle formulae whose source modified time is indeed
`0`.

Needed for Homebrew/homebrew-core#123724.
2023-02-20 22:02:58 +08:00
Mike McQuaid
aaec4014fd
Merge pull request #14710 from issyl0/rubocop-excludes
rubocop: Clean up some `Exclude`s
2023-02-20 09:51:11 +00:00
Mike McQuaid
57844530a9
analytics: remove UUID.
We don't use this at all with InfluxDB and don't need it any more for GA
so let's just remove it.
2023-02-20 09:05:15 +00:00
Issy Long
f8654bd363
rubocop: In-line disables of Metrics/{Module,Block,Class}Length
- We're not going to make the really long things be any shorter any time soon.
- The instructions in issue 14685 say, pragmatically, "disable all the rubocop
  rules we're never going to realistically fix e.g. Metrics/ClassLength". But
  that felt like a slippery slope to more _really_ long modules/classes/blocks,
  and the limits are here for a reason.
2023-02-19 16:33:23 +00:00
Mike McQuaid
ad1213a7da
utils/analytics: make on_request a proper boolean.
Otherwise when it's `false` it's being turned into a `true` value.
2023-02-16 17:51:42 +00:00
Mike McQuaid
a83fef7b41
utils/analytics: cleanup data.
Based on reviewing InfluxDB buckets.
2023-02-16 13:15:04 +00:00
Mike McQuaid
ef8ad10741
utils/analytics: fix BuildError reporting.
Need to ensure we call the correct methods to avoid duplicates.
2023-02-16 12:59:46 +00:00
Mike McQuaid
e42cae19a5
Merge pull request #14647 from MikeMcQuaid/report_influxdb_default
analytics: report to InfluxDB by default.
2023-02-15 19:19:41 +00:00
Mike McQuaid
dfd4cd9b0c
analytics: update token.
We've deleted the old data and added a new bucket with a new token.
2023-02-15 17:32:34 +00:00
Mike McQuaid
769a8c5001
analytics: report to InfluxDB by default.
Now that this is ready: let's roll it out to everyone in 4.0.0.
2023-02-15 17:27:02 +00:00
Mike McQuaid
c5252817c2
analytics: refactor InfluxDB/Google handling. 2023-02-15 16:34:50 +00:00
Sean Molenaar
50e9247da4
fix: add better keys and fuller values to influxDB analytics 2023-02-15 14:12:05 +01:00
Bo Anderson
7ef0c48362
Fix analytics handling when core/cask taps are untapped 2023-02-15 05:31:08 +00:00
EricFromCanada
dfc9906184
internal messaging fixes 2023-02-10 23:17:16 -05:00
anatawa12
cd045b53e8
fix(utils/github): failure with fine-granted api tokens 2023-02-11 00:06:28 +09:00
Michael Cho
3beca4f691
utils/github: get artifact from last run 2023-02-08 18:22:58 -08:00
Bo Anderson
2bb5cdaaa9
Merge pull request #14523 from issyl0/gist-logs-better-token-permissions-message
cmd/gist-logs: On 404, the PAT probably needs more permissions
2023-02-07 01:32:10 +00:00
Issy Long
87348dc179
Apply suggestions from code review
Co-authored-by: Bo Anderson <mail@boanderson.me>
2023-02-07 02:05:46 +01:00
Mike McQuaid
6c27021211
Merge pull request #14525 from SMillerDev/master
analytics: stop sending analytics in tests
2023-02-06 21:28:29 +01:00
Issy Long
41b143deec
cmd/gist-logs: On 404, the PAT probably needs more permissions
- This 404 error is from GitHub, and GitHub doesn't give us any more
  informations about scopes for the gist endpoint (for some reason). But we can
  safely assume, as it happens a lot, that "Error: Not Found" (404) is because
  the user hasn't granted their `HOMEBREW_GITHUB_API_TOKEN` the `gist` scope.

Before:

```shell
$ HOMEBREW_GITHUB_API_TOKEN=<token_without_gist_scope> brew gist-logs -p logrotate
Error: Not Found
```

After:

```shell
❯ HOMEBREW_GITHUB_API_TOKEN=<token_without_gist_scope> brew gist-logs logrotate
Error: Your GitHub API token likely doesn't have the `gist` scope.
Create a GitHub personal access token:
https://github.com/settings/tokens/new?scopes=gist&description=Homebrew
echo 'export HOMEBREW_GITHUB_API_TOKEN=your_token_here' >> ~/.zshrc
```
2023-02-06 17:00:02 +01:00
Sean Molenaar
61e5e19bdb
analytics: fix spelling
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
Co-authored-by: Eric Knibbe <enk3@outlook.com>
2023-02-06 16:56:25 +01:00
Sean Molenaar
10e3c522f7
analytics: stop sending analytics in tests 2023-02-06 16:28:34 +01:00
Bo Anderson
83b23e6d5e
Fix license handling for API formulae 2023-02-06 10:09:40 +00:00
Xuehai Pan
4322e57dd0 utils/curl: make --show-error optional 2023-02-04 13:05:41 +00:00
Francois-Xavier Coudert
2b07d0d5bb analytics: fix URL typo 2023-01-26 21:24:50 +01:00
Mike McQuaid
3be12ca066
Merge pull request #14396 from apainintheneck/add-closed-pr-check-to-bump-cmds
Add closed PR check to bump cmds
2023-01-23 13:35:52 +00:00
apainintheneck
a8ee2b7746 Add closed PR check to bump cmds
Currently we only check for closed PRs in
`bump-cask-pr`. This adds that check to `bump`
and `bump-formula-pr`. The idea is that this
check can warn users about already updated
packages or those that can't be updated
easily and should be updated manually instead.
2023-01-20 18:46:07 -08:00
Sean Molenaar
59ebdab2b7
analytics: switch to InfluxDB for logging 2023-01-19 18:15:27 +01:00
Caleb Xu
c75adc8238
utils/gzip: introduce new module 2023-01-06 22:58:22 -05:00