Skip to content

Commit

Permalink
Merge branch '4-stable' into early-2x
Browse files Browse the repository at this point in the history
  • Loading branch information
nickfloyd committed Jun 30, 2022
2 parents 7ca7243 + 054a94a commit 1a3de39
Show file tree
Hide file tree
Showing 161 changed files with 4,343 additions and 3,879 deletions.
16 changes: 13 additions & 3 deletions .github/workflows/octokit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,26 @@ jobs:
ruby-version: ${{ matrix.ruby }}
- name: Setup .netrc
run: chmod 600 spec/fixtures/.netrc
- name: Ruby 2.5 needs a newer RubyGems to support frozen-string-literal
if: ${{ matrix.ruby == '2.5' }}
- name: Ruby 2.5 and earlier need a newer RubyGems to support frozen-string-literal
if: ${{ matrix.ruby == '2.5' || matrix.ruby == '2.4' || matrix.ruby == '2.3' }}
run: gem update --system 2.7.11
- name: Install dependencies
run: |
bundle config set path .bundle/gems
bundle config set without development
bundle install --jobs 4 --retry 3
- name: Test with RSpec
- name: Test with RSpec with frozen string literals enabled
env:
GITHUB_CI: 1
RUBYOPT: --enable-frozen-string-literal
run: bundle exec rspec -w
if: ${{ matrix.ruby != '2.3' }}
- name: Test with RSpec without frozen string literals enabled
env:
GITHUB_CI: 1
run: bundle exec rspec -w
if: ${{ matrix.ruby == '2.3' }}
- name: Lint with Rubocop
env:
GITHUB_CI: 1
run: bundle exec rubocop
21 changes: 20 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
inherit_from: .rubocop_todo.yml

AllCops:
TargetRubyVersion: 2.3
Metrics/BlockLength:
Exclude:
spec/**/*_spec.rb
- spec/**/*_spec.rb
Layout/BlockAlignment:
Exclude:
# This file is causing Rubocop to error - see <https://github.com/octokit/octokit.rb/runs/6779545664>
# for an example
- Guardfile
Lint/RaiseException:
Enabled: true
Lint/StructNewOverride:
Enabled: true
Style/HashEachMethods:
Enabled: true
Style/HashTransformKeys:
Enabled: true
Style/HashTransformValues:
Enabled: true
239 changes: 239 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,239 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2022-06-07 18:42:36 +0100 using RuboCop version 0.81.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 1
# Configuration parameters: Include.
# Include: **/*.gemspec
Gemspec/RequiredRubyVersion:
Exclude:
- 'octokit.gemspec'

# Offense count: 4
Lint/AmbiguousOperator:
Exclude:
- 'lib/octokit/client.rb'
- 'lib/octokit/client/pub_sub_hubbub.rb'
- 'lib/octokit/connection.rb'

# Offense count: 13
# Configuration parameters: AllowSafeAssignment.
Lint/AssignmentInCondition:
Exclude:
- 'lib/octokit/client/contents.rb'
- 'lib/octokit/client/feeds.rb'
- 'lib/octokit/client/gists.rb'
- 'lib/octokit/client/organizations.rb'
- 'lib/octokit/client/releases.rb'
- 'lib/octokit/client/stats.rb'
- 'lib/octokit/connection.rb'
- 'lib/octokit/error.rb'
- 'lib/octokit/response/raise_error.rb'

# Offense count: 20
# Configuration parameters: AllowComments.
Lint/SuppressedException:
Exclude:
- 'Rakefile'
- 'spec/helper.rb'
- 'spec/octokit/client/actions_secrets_spec.rb'
- 'spec/octokit/client/commits_spec.rb'
- 'spec/octokit/client/deployments_spec.rb'
- 'spec/octokit/client/hooks_spec.rb'
- 'spec/octokit/client/issues_spec.rb'
- 'spec/octokit/client/reactions_spec.rb'
- 'spec/octokit/client/refs_spec.rb'
- 'spec/octokit/client/repositories_spec.rb'
- 'spec/octokit/client/repository_invitations_spec.rb'
- 'spec/octokit/client/source_import_spec.rb'

# Offense count: 31
Lint/UselessAssignment:
Exclude:
- 'spec/octokit/client/actions_secrets_spec.rb'
- 'spec/octokit/client/actions_workflow_runs_spec.rb'
- 'spec/octokit/client/apps_spec.rb'
- 'spec/octokit/client/hooks_spec.rb'
- 'spec/octokit/client/organizations_spec.rb'
- 'spec/octokit/client/rate_limit_spec.rb'
- 'spec/octokit/client/releases_spec.rb'
- 'spec/octokit/client/repositories_spec.rb'
- 'spec/octokit/client/stats_spec.rb'
- 'spec/octokit/client_spec.rb'
- 'spec/octokit/enterprise_admin_client/search_indexing_spec.rb'
- 'spec/octokit/enterprise_admin_client/users_spec.rb'
- 'spec/octokit/enterprise_management_console_client/management_console_spec.rb'

# Offense count: 1
# Configuration parameters: CheckForMethodsWithNoSideEffects.
Lint/Void:
Exclude:
- 'lib/octokit/repo_arguments.rb'

# Offense count: 16
# Configuration parameters: IgnoredMethods.
Metrics/AbcSize:
Max: 33

# Offense count: 1
# Configuration parameters: CountComments, ExcludedMethods.
# ExcludedMethods: refine
Metrics/BlockLength:
Max: 102

# Offense count: 1
# Configuration parameters: CountBlocks.
Metrics/BlockNesting:
Max: 4

# Offense count: 2
# Configuration parameters: CountComments.
Metrics/ClassLength:
Max: 160

# Offense count: 7
# Configuration parameters: IgnoredMethods.
Metrics/CyclomaticComplexity:
Max: 18

# Offense count: 29
# Configuration parameters: CountComments, ExcludedMethods.
Metrics/MethodLength:
Max: 26

# Offense count: 4
# Configuration parameters: CountComments.
Metrics/ModuleLength:
Max: 217

# Offense count: 4
# Configuration parameters: CountKeywordArgs.
Metrics/ParameterLists:
Max: 9

# Offense count: 6
# Configuration parameters: IgnoredMethods.
Metrics/PerceivedComplexity:
Max: 13

# Offense count: 1
Naming/AccessorMethodName:
Exclude:
- 'lib/octokit/enterprise_management_console_client/management_console.rb'

# Offense count: 1
# Configuration parameters: ForbiddenDelimiters.
# ForbiddenDelimiters: (?-mix:(^|\s)(EO[A-Z]{1}|END)(\s|$))
Naming/HeredocDelimiterNaming:
Exclude:
- 'lib/octokit/preview.rb'

# Offense count: 1
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
# AllowedNames: io, id, to, by, on, in, at, ip, db, os, pp
Naming/MethodParameterName:
Exclude:
- 'lib/octokit/client/legacy_search.rb'

# Offense count: 9
# Configuration parameters: AllowedChars.
Style/AsciiComments:
Exclude:
- 'lib/octokit/client/contents.rb'
- 'lib/octokit/client/gists.rb'
- 'lib/octokit/client/licenses.rb'
- 'lib/octokit/client/organizations.rb'
- 'lib/octokit/client/repositories.rb'
- 'lib/octokit/client/stats.rb'
- 'lib/octokit/client/users.rb'
- 'lib/octokit/middleware/follow_redirects.rb'

# Offense count: 484
Style/CommentedKeyword:
Enabled: false

# Offense count: 3
Style/Documentation:
Exclude:
- 'spec/**/*'
- 'test/**/*'
- 'lib/octokit/client/actions_workflow_runs.rb'
- 'lib/octokit/client/users.rb'
- 'lib/octokit/enterprise_management_console_client/management_console.rb'

# Offense count: 7
Style/DoubleNegation:
Exclude:
- 'lib/octokit/authentication.rb'
- 'lib/octokit/client/repositories.rb'
- 'lib/octokit/configurable.rb'
- 'spec/helper.rb'

# Offense count: 7
# Configuration parameters: MinBodyLength.
Style/GuardClause:
Exclude:
- 'lib/octokit.rb'
- 'lib/octokit/client/feeds.rb'
- 'lib/octokit/error.rb'
- 'lib/octokit/repository.rb'
- 'lib/octokit/response/feed_parser.rb'
- 'lib/octokit/response/raise_error.rb'

# Offense count: 1
# Configuration parameters: AllowIfModifier.
Style/IfInsideElse:
Exclude:
- 'lib/octokit/connection.rb'

# Offense count: 22
# Cop supports --auto-correct.
Style/IfUnlessModifier:
Exclude:
- 'lib/octokit.rb'
- 'lib/octokit/client.rb'
- 'lib/octokit/client/authorizations.rb'
- 'lib/octokit/client/commits.rb'
- 'lib/octokit/client/organizations.rb'
- 'lib/octokit/client/repositories.rb'
- 'lib/octokit/default.rb'
- 'lib/octokit/enterprise_management_console_client/management_console.rb'
- 'lib/octokit/error.rb'
- 'lib/octokit/repository.rb'
- 'spec/helper.rb'

# Offense count: 1
Style/MultilineTernaryOperator:
Exclude:
- 'lib/octokit/client/contents.rb'

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: AutoCorrect, EnforcedStyle, IgnoredMethods.
# SupportedStyles: predicate, comparison
Style/NumericPredicate:
Exclude:
- 'spec/**/*'
- 'lib/octokit/connection.rb'

# Offense count: 1
Style/StructInheritance:
Exclude:
- 'lib/octokit/rate_limit.rb'

# Offense count: 1
# Cop supports --auto-correct.
Style/WhileUntilModifier:
Exclude:
- 'spec/octokit/client/source_import_spec.rb'

# Offense count: 1290
# Cop supports --auto-correct.
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# URISchemes: http, https
Layout/LineLength:
Max: 517
6 changes: 3 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ faraday_version = ENV.fetch('FARADAY_VERSION', '~> 2.0')

gem 'faraday', faraday_version

if faraday_version.start_with?("~> 2")
gem 'faraday-retry'
if faraday_version.start_with?('~> 2')
gem 'faraday-multipart'
gem 'faraday-retry'
end

group :test, :development do
gem 'pry-byebug'
gem 'redcarpet'
gem 'rubocop'
gem 'rubocop', '0.81'
end

gemspec
8 changes: 5 additions & 3 deletions Guardfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
guard "rspec", :cmd => "bundle exec rspec" do
# frozen_string_literal: true

guard 'rspec', cmd: 'bundle exec rspec' do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch("spec/helper.rb") { "spec" }
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch('spec/helper.rb') { 'spec' }
end
21 changes: 12 additions & 9 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@

1. Create a list of all the changes since the prior release
1. Compare the latest release to master using https://github.com/octokit/octokit.rb/compare/`${latest}`...master
1. Open the linked pull requests from all the `Merge pull request #...` commits
1. For all non-documentation PRs, copy title (including pull request number) into markdown list items
1. (optional, but nice) Sort into logical buckets, like "support for additional endpoints", "enhancements", "bugfixes"
1. Reorganize to put the pull request number at the start of the line
1. Ensure there are no breaking changes _(if there are breaking changes you'll need to create a release branch without those changes or bump the major version)_
1. Update the version
2. Open the linked pull requests from all the `Merge pull request #...` commits
3. For all non-documentation PRs, copy title (including pull request number) into markdown list items
4. (optional, but nice) Sort into logical buckets, like "support for additional endpoints", "enhancements", "bugfixes"
5. Reorganize to put the pull request number at the start of the line
2. Ensure there are no breaking changes _(if there are breaking changes you'll need to create a release branch without those changes or bump the major version)_
3. Update the version
1. Update the constant in `lib/octokit/version.rb`
1. Commit and push directly to master
1. Run the `script/release` script to cut a release
1. Draft a new release at https://github.com/octokit/octokit.rb/releases/new containing the curated changelog
2. Commit the version change and push directly to master
4. (Optional) Run `script/release` with no parameters to execute a dry run of a release
5. Run the `script/release -r` script to cut a release (this will run `script/validate` to perform the permission check)
6. Draft a new release at https://github.com/octokit/octokit.rb/releases/new containing the curated changelog

----

## Prerequisites

Expand Down
8 changes: 5 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# frozen_string_literal: true

require 'bundler'
Bundler::GemHelper.install_tasks

require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)

task :test => :spec
task :default => :spec
task test: :spec
task default: :spec

namespace :doc do
begin
Expand All @@ -14,7 +16,7 @@ namespace :doc do
task.files = ['README.md', 'LICENSE.md', 'lib/**/*.rb']
task.options = [
'--output-dir', 'doc/yard',
'--markup', 'markdown',
'--markup', 'markdown'
]
end
rescue LoadError
Expand Down
12 changes: 12 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Security Policy

Thanks for helping make GitHub Open Source Software safe for everyone.

GitHub takes the security of our software products and services seriously, including all of the open source code repositories managed through our GitHub organizations, such as [Octokit](https://github.com/octokit).

Even though [open source repositories are outside of the scope of our bug bounty program](https://bounty.github.com/index.html#scope) and therefore not eligible for bounty rewards, we want to make sure that your finding gets passed along to the maintainers of this project for remediation.


## Reporting a Vulnerability

Since this source is part of [Octokit](https://github.com/octokit) (a GitHub organization) we ask that you follow the guidelines [here](https://github.com/github/.github/blob/master/SECURITY.md#reporting-security-issues) to report anything that you might've found.

0 comments on commit 1a3de39

Please sign in to comment.