Skip to content

Commit

Permalink
ported back remaining changes from http-2-next
Browse files Browse the repository at this point in the history
  • Loading branch information
HoneyryderChuck committed Jun 14, 2024
1 parent dc5ce2c commit b3b2bc1
Show file tree
Hide file tree
Showing 44 changed files with 1,479 additions and 1,649 deletions.
29 changes: 16 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: ['3.0', 3.1, 3.2, 3.3, jruby-9.4]
ruby: [2.7 ,'3.0', 3.1, 3.2, 3.3, jruby, truffleruby]

steps:
- uses: actions/checkout@v4
Expand All @@ -27,7 +27,10 @@ jobs:
bundler-cache: true

- name: Tests
env:
CI: 1
run: |
echo $(pwd)
RUBY_PLATFORM=`ruby -e 'puts RUBY_PLATFORM'`
RUBY_ENGINE=`ruby -e 'puts RUBY_ENGINE'`
if [[ "$RUBY_ENGINE" = "ruby" ]] && [[ ${RUBY_VERSION:0:1} = "3" ]] && [[ ! $RUBYOPT =~ "jit" ]]; then
Expand All @@ -36,14 +39,14 @@ jobs:
export RBS_TEST_RAISE="true"
export RBS_TEST_LOGLEVEL="error"
export RBS_TEST_OPT="-Isig -rbase64"
export RBS_TEST_TARGET="HTTP2Next*"
export RBS_TEST_TARGET="HTTP2*"
fi
ENV=CI bundle exec rake
bundle exec rake
- name: Upload coverage
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
if: always()
with:
name: coverage-report
name: coverage-report-${{matrix.ruby}}
path: coverage/

coverage:
Expand All @@ -53,27 +56,27 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: actions/download-artifact@master
with:
name: coverage-report
path: path/to/artifact

- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3
bundler-cache: true

- name: Download coverage results
uses: actions/download-artifact@v4
with:
pattern: coverage-report-*
path: coverage

- name: coverage
run: |
gem install simplecov --no-doc
ls
ls -laR coverage
find coverage -name "*resultset.json" -exec sed -i 's?/home?'`pwd`'?' {} \;
rake coverage:report
- name: Upload coverage
uses: actions/upload-artifact@v2
if: always()
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage/
Expand Down
104 changes: 98 additions & 6 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,107 @@
inherit_from: .rubocop_todo.yml

require:
- rubocop-performance

AllCops:
NewCops: enable
SuggestExtensions: false
TargetRubyVersion: 3.0
TargetRubyVersion: 2.7
DisplayCopNames: true
Exclude:
- 'vendor/bundle/**/*' # see https://github.com/rubocop/rubocop/issues/9832
- "bin/**"
- "vendor/**/*"
- "**/huffman_statemachine.rb"
- "lib/tasks/**"

Gemspec/RequireMFA:
Enabled: false

Metrics/BlockLength:
Enabled: false

Lint/EmptyWhen:
Enabled: false

Style/StringLiterals:
EnforcedStyle: double_quotes

Style/NumericPredicate:
Enabled: false

Gemspec/RequiredRubyVersion:
Enabled: false

Bundler/DuplicatedGem:
Enabled: false

Style/OptionalBooleanParameter:
Enabled: false

Style/ArgumentsForwarding:
Enabled: false

Lint/MissingSuper:
Exclude:
- 'lib/httpx/io/unix.rb'

Style/HashTransformValues:
Exclude:
- 'lib/httpx/plugins/digest_authentication.rb'

Lint/ConstantDefinitionInBlock:
Exclude:
- 'spec/**/*'

# TODO: remove this if min supported version of ruby is 2.3
Style/HashSyntax:
Enabled: false

Style/AndOr:
Enabled: false

Style/SafeNavigation:
Enabled: false

Layout/HeredocIndentation:
Exclude:
- "lib/tasks/generate_huffman_table.rb"
- "example/*"

Naming/MethodParameterName:
Enabled: false

Naming/VariableNumber:
Exclude:
- example/server.rb

Layout/LineLength:
Max: 128

Style/HashEachMethods:
Enabled: true

Style/HashTransformKeys:
Enabled: true

Style/CommentAnnotation:
Enabled: false

Style/SlicingWithRange:
Enabled: false

Lint/SuppressedException:
Exclude:
- Rakefile

Lint/EmptyBlock:
Exclude:
- spec/*

Performance/CollectionLiteralInLoop:
Exclude:
- spec/*

Performance/MethodObjectAsBlock:
Enabled: false

Metrics/CollectionLiteralLength:
Exclude:
- 'spec/**/*.rb'
- lib/http/2/header/huffman.rb
116 changes: 21 additions & 95 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,121 +1,47 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2024-06-13 02:27:14 UTC using RuboCop version 1.64.1.
# on 2016-06-09 10:57:54 -0400 using RuboCop version 0.40.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: AllowedMethods.
# AllowedMethods: enums
Lint/ConstantDefinitionInBlock:
Exclude:
- 'spec/emitter_spec.rb'

# Offense count: 3
# Configuration parameters: AllowComments, AllowEmptyLambdas.
Lint/EmptyBlock:
Exclude:
- 'spec/client_spec.rb'
- 'spec/emitter_spec.rb'
- 'spec/server_spec.rb'

# Offense count: 3
# Configuration parameters: AllowComments, AllowNil.
Lint/SuppressedException:
Exclude:
- 'Rakefile'

# Offense count: 27
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
# Offense count: 24
Metrics/AbcSize:
Max: 172
Max: 200

# Offense count: 8
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
# AllowedMethods: refine
Metrics/BlockLength:
Max: 82

# Offense count: 19
# Configuration parameters: CountBlocks.
# Offense count: 16
Metrics/BlockNesting:
Max: 6
Max: 5
Exclude:
- "lib/http/2/connection.rb"

# Offense count: 7
# Configuration parameters: CountComments, CountAsOne.
# Offense count: 5
# Configuration parameters: CountComments.
Metrics/ClassLength:
Max: 516
Max: 371

# Offense count: 2
# Configuration parameters: LengthThreshold.
Metrics/CollectionLiteralLength:
Exclude:
- 'lib/http/2/header/huffman.rb'
- 'lib/http/2/header/huffman_statemachine.rb'
Metrics/ModuleLength:
Max: 120

# Offense count: 14
# Configuration parameters: AllowedMethods, AllowedPatterns.
# Offense count: 12
Metrics/CyclomaticComplexity:
Max: 60

# Offense count: 33
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
# Offense count: 29
# Configuration parameters: CountComments.
Metrics/MethodLength:
Max: 132
Max: 134

# Offense count: 1
# Configuration parameters: CountComments, CountAsOne.
Metrics/ModuleLength:
Max: 113

# Offense count: 1
# Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
# Configuration parameters: CountKeywordArgs.
Metrics/ParameterLists:
Max: 7

# Offense count: 12
# Configuration parameters: AllowedMethods, AllowedPatterns.
# Offense count: 10
Metrics/PerceivedComplexity:
Max: 48
Max: 50

# Offense count: 6
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
# AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to
Naming/MethodParameterName:
Exclude:
- 'lib/http/2/connection.rb'
- 'lib/http/2/extensions.rb'
- 'lib/http/2/header/compressor.rb'
- 'lib/http/2/header/decompressor.rb'

# Offense count: 1
# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns.
# SupportedStyles: snake_case, normalcase, non_integer
# AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64
Naming/VariableNumber:
Exclude:
- 'example/server.rb'

# Offense count: 10
# Configuration parameters: AllowedConstants.
# Offense count: 4
Style/Documentation:
Exclude:
- 'spec/**/*'
- 'test/**/*'
- 'example/helper.rb'
- 'example/upgrade_server.rb'
- 'lib/http/2/error.rb'
- 'lib/http/2/extensions.rb'
- 'lib/http/2/flow_buffer.rb'
- 'lib/http/2/header/decompressor.rb'
- 'lib/http/2/header/encoding_context.rb'
- 'tasks/generate_huffman_table.rb'

# Offense count: 1
# Configuration parameters: AllowedMethods.
# AllowedMethods: respond_to_missing?
Style/OptionalBooleanParameter:
Exclude:
- 'lib/http/2/flow_buffer.rb'
Enabled: false
11 changes: 11 additions & 0 deletions .simplecov
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# frozen_string_literal: true

SimpleCov.start do
command_name "Spec"
add_filter "/.bundle/"
add_filter "/vendor/"
add_filter "/spec/"
add_filter "/lib/http/2/base64"
coverage_dir "coverage"
minimum_coverage(RUBY_ENGINE == "truffleruby" ? 85 : 90)
end
28 changes: 16 additions & 12 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,31 +1,35 @@
# frozen_string_literal: true

source 'https://rubygems.org'
source "https://rubygems.org"

gemspec

gem 'rake', require: false
gem "rake", require: false

group :development do
gem 'pry'
gem 'pry-byebug', platform: :mri
gem 'rubocop'
gem 'rubocop-performance'
gem "pry"
gem "pry-byebug", platform: :mri
if RUBY_VERSION >= "3.0.0"
gem "rubocop"
gem "rubocop-performance"
end
end

group :docs do
gem 'yard'
gem "yard"
end

group :test do
gem 'rspec'
gem 'simplecov', require: false
gem "rspec"
gem "simplecov", require: false
end

group :types do
platform :mri do
gem 'rbs'
gem 'steep'
gem 'typeprof'
if RUBY_VERSION >= "3.0.0"
gem "rbs"
gem "steep"
gem "typeprof"
end
end
end
Loading

0 comments on commit b3b2bc1

Please sign in to comment.