From b34def144d1c2338d14337805cc9f2c53524dc83 Mon Sep 17 00:00:00 2001 From: nick evans Date: Wed, 22 Jul 2026 09:46:12 -0400 Subject: [PATCH 1/4] =?UTF-8?q?=F0=9F=94=A8=20Update=20simplecov=20config?= =?UTF-8?q?=20for=20v1.0=20syntax?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/lib/helper.rb | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/test/lib/helper.rb b/test/lib/helper.rb index 0977b2e8..67f12960 100644 --- a/test/lib/helper.rb +++ b/test/lib/helper.rb @@ -11,21 +11,22 @@ SimpleCov.start do command_name "Net::IMAP tests" enable_coverage :branch + enable_coverage :eval primary_coverage :branch - enable_coverage_for_eval - - add_filter "/test/" - add_filter "/rakelib/" - - add_group "Parser", %w[lib/net/imap/response_parser.rb - lib/net/imap/response_parser] - add_group "Config", %w[lib/net/imap/config.rb - lib/net/imap/config] - add_group "SASL", %w[lib/net/imap/sasl.rb - lib/net/imap/sasl - lib/net/imap/authenticators.rb] - add_group "StringPrep", %w[lib/net/imap/stringprep.rb - lib/net/imap/stringprep] + + skip "/test/" + skip "/rakelib/" + cover "lib/**/*.rb" + + group "Parser", %w[lib/net/imap/response_parser.rb + lib/net/imap/response_parser] + group "Config", %w[lib/net/imap/config.rb + lib/net/imap/config] + group "SASL", %w[lib/net/imap/sasl.rb + lib/net/imap/sasl + lib/net/imap/authenticators.rb] + group "StringPrep", %w[lib/net/imap/stringprep.rb + lib/net/imap/stringprep] end end From cd9f50c5d5ca887632b0f507870d5817b67e0d4e Mon Sep 17 00:00:00 2001 From: nick evans Date: Wed, 22 Jul 2026 09:46:57 -0400 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=94=A8=20Update=20simplecov=20groups?= =?UTF-8?q?=20so=20nothing=20is=20ungrouped?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/lib/helper.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/lib/helper.rb b/test/lib/helper.rb index 67f12960..1f298974 100644 --- a/test/lib/helper.rb +++ b/test/lib/helper.rb @@ -11,6 +11,7 @@ SimpleCov.start do command_name "Net::IMAP tests" enable_coverage :branch + enable_coverage :method enable_coverage :eval primary_coverage :branch @@ -20,11 +21,27 @@ group "Parser", %w[lib/net/imap/response_parser.rb lib/net/imap/response_parser] + + group "Client", %w[lib/net/imap.rb + lib/net/imap/connection_state.rb + lib/net/imap/deprecated_client_options.rb + lib/net/imap/errors.rb + lib/net/imap/response_reader.rb] + group "Config", %w[lib/net/imap/config.rb lib/net/imap/config] + + group "Data Types", %w[lib/net/imap/flags.rb + lib/net/imap/sequence_set.rb] + + [%r{lib/net/imap/\w*_data\.rb}, + %r{lib/net/imap/\w*_result.rb}, + %r{lib/net/imap/data_\w+\.rb}] + group "SASL", %w[lib/net/imap/sasl.rb lib/net/imap/sasl + lib/net/imap/sasl_adapter.rb lib/net/imap/authenticators.rb] + group "StringPrep", %w[lib/net/imap/stringprep.rb lib/net/imap/stringprep] end From 39a267ffd0d57580cbe17bab7cb2ab3dd11fe0c2 Mon Sep 17 00:00:00 2001 From: nick evans Date: Wed, 22 Jul 2026 13:38:24 -0400 Subject: [PATCH 3/4] =?UTF-8?q?=E2=9C=85=F0=9F=94=A8=20Change=20CI=20simpl?= =?UTF-8?q?ecov=20minimum=20coverage=20handling?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `joshmfrankel/simplecov-check-action` is broken with simplecov v1.0. And simplecov v1.0 also added a new way to handle minimum coverage requirements. So I've taken this opportunity to ratchet up all of the minimum requirements. --- .github/workflows/test.yml | 9 ------- test/lib/helper.rb | 55 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 301906e5..3642e2cc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -36,12 +36,3 @@ jobs: - name: Run test run: bundle exec rake test timeout-minutes: 5 # _should_ finish in under a minute - - - uses: joshmfrankel/simplecov-check-action@main - if: ${{ matrix.os == 'ubuntu-latest' && github.event_name != 'pull_request' && - !startsWith(matrix.ruby, 'truffleruby') && !startsWith(matrix.ruby, 'jruby') }} - with: - check_job_name: "SimpleCov - ${{ matrix.ruby }}" - minimum_suite_coverage: 90 - minimum_file_coverage: 40 # TODO: increase this after switching to SASL::AuthenticationExchange - github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/test/lib/helper.rb b/test/lib/helper.rb index 1f298974..c087c3e8 100644 --- a/test/lib/helper.rb +++ b/test/lib/helper.rb @@ -44,6 +44,61 @@ group "StringPrep", %w[lib/net/imap/stringprep.rb lib/net/imap/stringprep] + + break if ENV.fetch("SIMPLECOV_DISABLE_MINIMUM_COVERAGE", "") != "" + + coverage(:line) do + minimum 95 + + minimum_per_group 98, only: "Config" + minimum_per_group 97, only: "StringPrep" + minimum_per_group 97, only: "SASL" + minimum_per_group 95, only: "Data Types" + minimum_per_group 94, only: "Parser" + minimum_per_group 92, only: "Client" + + minimum_per_file 90 + minimum_per_file 87, only: "lib/net/imap/sasl/authenticators.rb" + minimum_per_file 86, only: "lib/net/imap/config/attr_type_coercion.rb" + minimum_per_file 84, only: "lib/net/imap/authenticators.rb" + minimum_per_file 80, only: "lib/net/imap/response_data.rb" + minimum_per_file 55, only: "lib/net/imap/search_result.rb" + end + + coverage(:branch) do + minimum 80 + + minimum_per_group 92, only: "Data Types" + minimum_per_group 87, only: "Config" + minimum_per_group 83, only: "Client" + minimum_per_group 81, only: "Parser" + minimum_per_group 76, only: "SASL" + minimum_per_group 73, only: "StringPrep" + + minimum_per_file 65 + minimum_per_file 62, only: "lib/net/imap/sasl/scram_authenticator.rb" + minimum_per_file 50, only: "lib/net/imap/sasl/authenticators.rb" + minimum_per_file 50, only: "lib/net/imap/config/attr_accessors.rb" + end + + coverage(:method) do + minimum 88 + + minimum_per_group 100, only: "Config" + minimum_per_group 92, only: "Data Types" + minimum_per_group 90, only: "StringPrep" + minimum_per_group 88, only: "Client" + minimum_per_group 83, only: "Parser" + minimum_per_group 82, only: "SASL" + + minimum_per_file 66 + minimum_per_file 64, only: "lib/net/imap/response_parser/parser_utils.rb" + minimum_per_file 57, only: "lib/net/imap/sasl/authenticators.rb" + minimum_per_file 50, only: "lib/net/imap/authenticators.rb" + minimum_per_file 50, only: "lib/net/imap/sasl/anonymous_authenticator.rb" + minimum_per_file 36, only: "lib/net/imap/sasl/protocol_adapters.rb" + minimum_per_file 20, only: "lib/net/imap/response_data.rb" + end end end From 416a12083aa8c11331ce76de00e4eec7d76081de Mon Sep 17 00:00:00 2001 From: nick evans Date: Wed, 22 Jul 2026 15:54:21 -0400 Subject: [PATCH 4/4] =?UTF-8?q?=E2=9C=85=20Move=20simplecov=20config=20int?= =?UTF-8?q?o=20.simplecov?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I think this was originally in test/lib/helper.rb for some strange reason having to do with circular dependencies or some-such. But, now that simplecov v1.0 has pulled in the HTML and JSON formatters as part of the core gem, that's no longer an issue. --- .simplecov | 97 +++++++++++++++++++++++++++++++++++++++++++ test/lib/helper.rb | 100 +-------------------------------------------- 2 files changed, 98 insertions(+), 99 deletions(-) create mode 100644 .simplecov diff --git a/.simplecov b/.simplecov new file mode 100644 index 00000000..3b249850 --- /dev/null +++ b/.simplecov @@ -0,0 +1,97 @@ +SimpleCov.formatters = [ + SimpleCov::Formatter::HTMLFormatter, + SimpleCov::Formatter::JSONFormatter, +] + +SimpleCov.configure do + command_name "Net::IMAP tests" + enable_coverage :branch + enable_coverage :method + enable_coverage :eval + primary_coverage :branch + + skip "/test/" + skip "/rakelib/" + cover "lib/**/*.rb" + + group "Parser", %w[lib/net/imap/response_parser.rb + lib/net/imap/response_parser] + + group "Client", %w[lib/net/imap.rb + lib/net/imap/connection_state.rb + lib/net/imap/deprecated_client_options.rb + lib/net/imap/errors.rb + lib/net/imap/response_reader.rb] + + group "Config", %w[lib/net/imap/config.rb + lib/net/imap/config] + + group "Data Types", %w[lib/net/imap/flags.rb + lib/net/imap/sequence_set.rb] + + [%r{lib/net/imap/\w*_data\.rb}, + %r{lib/net/imap/\w*_result.rb}, + %r{lib/net/imap/data_\w+\.rb}] + + group "SASL", %w[lib/net/imap/sasl.rb + lib/net/imap/sasl + lib/net/imap/sasl_adapter.rb + lib/net/imap/authenticators.rb] + + group "StringPrep", %w[lib/net/imap/stringprep.rb + lib/net/imap/stringprep] + + if ENV.fetch("SIMPLECOV_DISABLE_MINIMUM_COVERAGE", "") == "" + coverage(:line) do + minimum 95 + + minimum_per_group 98, only: "Config" + minimum_per_group 97, only: "StringPrep" + minimum_per_group 97, only: "SASL" + minimum_per_group 95, only: "Data Types" + minimum_per_group 94, only: "Parser" + minimum_per_group 92, only: "Client" + + minimum_per_file 90 + minimum_per_file 87, only: "lib/net/imap/sasl/authenticators.rb" + minimum_per_file 86, only: "lib/net/imap/config/attr_type_coercion.rb" + minimum_per_file 84, only: "lib/net/imap/authenticators.rb" + minimum_per_file 80, only: "lib/net/imap/response_data.rb" + minimum_per_file 55, only: "lib/net/imap/search_result.rb" + end + + coverage(:branch) do + minimum 80 + + minimum_per_group 92, only: "Data Types" + minimum_per_group 87, only: "Config" + minimum_per_group 83, only: "Client" + minimum_per_group 81, only: "Parser" + minimum_per_group 76, only: "SASL" + minimum_per_group 73, only: "StringPrep" + + minimum_per_file 65 + minimum_per_file 62, only: "lib/net/imap/sasl/scram_authenticator.rb" + minimum_per_file 50, only: "lib/net/imap/sasl/authenticators.rb" + minimum_per_file 50, only: "lib/net/imap/config/attr_accessors.rb" + end + + coverage(:method) do + minimum 88 + + minimum_per_group 100, only: "Config" + minimum_per_group 92, only: "Data Types" + minimum_per_group 90, only: "StringPrep" + minimum_per_group 88, only: "Client" + minimum_per_group 83, only: "Parser" + minimum_per_group 82, only: "SASL" + + minimum_per_file 66 + minimum_per_file 64, only: "lib/net/imap/response_parser/parser_utils.rb" + minimum_per_file 57, only: "lib/net/imap/sasl/authenticators.rb" + minimum_per_file 50, only: "lib/net/imap/authenticators.rb" + minimum_per_file 50, only: "lib/net/imap/sasl/anonymous_authenticator.rb" + minimum_per_file 36, only: "lib/net/imap/sasl/protocol_adapters.rb" + minimum_per_file 20, only: "lib/net/imap/response_data.rb" + end + end +end diff --git a/test/lib/helper.rb b/test/lib/helper.rb index c087c3e8..cbbcef18 100644 --- a/test/lib/helper.rb +++ b/test/lib/helper.rb @@ -1,105 +1,7 @@ if !(ENV["SIMPLECOV_DISABLE"] in /\A(1|y(es)?|t(rue)?)\z/i) && RUBY_ENGINE == "ruby" # C Ruby only - require "simplecov" - - SimpleCov.formatters = [ - SimpleCov::Formatter::HTMLFormatter, - SimpleCov::Formatter::JSONFormatter, - ] - - SimpleCov.start do - command_name "Net::IMAP tests" - enable_coverage :branch - enable_coverage :method - enable_coverage :eval - primary_coverage :branch - - skip "/test/" - skip "/rakelib/" - cover "lib/**/*.rb" - - group "Parser", %w[lib/net/imap/response_parser.rb - lib/net/imap/response_parser] - - group "Client", %w[lib/net/imap.rb - lib/net/imap/connection_state.rb - lib/net/imap/deprecated_client_options.rb - lib/net/imap/errors.rb - lib/net/imap/response_reader.rb] - - group "Config", %w[lib/net/imap/config.rb - lib/net/imap/config] - - group "Data Types", %w[lib/net/imap/flags.rb - lib/net/imap/sequence_set.rb] + - [%r{lib/net/imap/\w*_data\.rb}, - %r{lib/net/imap/\w*_result.rb}, - %r{lib/net/imap/data_\w+\.rb}] - - group "SASL", %w[lib/net/imap/sasl.rb - lib/net/imap/sasl - lib/net/imap/sasl_adapter.rb - lib/net/imap/authenticators.rb] - - group "StringPrep", %w[lib/net/imap/stringprep.rb - lib/net/imap/stringprep] - - break if ENV.fetch("SIMPLECOV_DISABLE_MINIMUM_COVERAGE", "") != "" - - coverage(:line) do - minimum 95 - - minimum_per_group 98, only: "Config" - minimum_per_group 97, only: "StringPrep" - minimum_per_group 97, only: "SASL" - minimum_per_group 95, only: "Data Types" - minimum_per_group 94, only: "Parser" - minimum_per_group 92, only: "Client" - - minimum_per_file 90 - minimum_per_file 87, only: "lib/net/imap/sasl/authenticators.rb" - minimum_per_file 86, only: "lib/net/imap/config/attr_type_coercion.rb" - minimum_per_file 84, only: "lib/net/imap/authenticators.rb" - minimum_per_file 80, only: "lib/net/imap/response_data.rb" - minimum_per_file 55, only: "lib/net/imap/search_result.rb" - end - - coverage(:branch) do - minimum 80 - - minimum_per_group 92, only: "Data Types" - minimum_per_group 87, only: "Config" - minimum_per_group 83, only: "Client" - minimum_per_group 81, only: "Parser" - minimum_per_group 76, only: "SASL" - minimum_per_group 73, only: "StringPrep" - - minimum_per_file 65 - minimum_per_file 62, only: "lib/net/imap/sasl/scram_authenticator.rb" - minimum_per_file 50, only: "lib/net/imap/sasl/authenticators.rb" - minimum_per_file 50, only: "lib/net/imap/config/attr_accessors.rb" - end - - coverage(:method) do - minimum 88 - - minimum_per_group 100, only: "Config" - minimum_per_group 92, only: "Data Types" - minimum_per_group 90, only: "StringPrep" - minimum_per_group 88, only: "Client" - minimum_per_group 83, only: "Parser" - minimum_per_group 82, only: "SASL" - - minimum_per_file 66 - minimum_per_file 64, only: "lib/net/imap/response_parser/parser_utils.rb" - minimum_per_file 57, only: "lib/net/imap/sasl/authenticators.rb" - minimum_per_file 50, only: "lib/net/imap/authenticators.rb" - minimum_per_file 50, only: "lib/net/imap/sasl/anonymous_authenticator.rb" - minimum_per_file 36, only: "lib/net/imap/sasl/protocol_adapters.rb" - minimum_per_file 20, only: "lib/net/imap/response_data.rb" - end - end + SimpleCov.start end require "test/unit"