diff --git a/.rubocop.yml b/.rubocop.yml index 32a76ec77..dfae7c52d 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -7,10 +7,12 @@ AllCops: SuggestExtensions: false TargetRubyVersion: 2.6 -#- Pending Cops as of 1.22.0 ---------------------------------------------# +#- Pending Cops as of 1.26.0 ---------------------------------------------# Gemspec/DateAssignment: # (new in 1.10) Enabled: true +Gemspec/RequireMFA: # new in 1.23 + Enabled: true Layout/SpaceBeforeBrackets: # (new in 1.7) Enabled: true Lint/AmbiguousAssignment: # (new in 1.7) @@ -53,6 +55,10 @@ Lint/UnexpectedBlockArity: # (new in 1.5) Enabled: true Lint/UnmodifiedReduceAccumulator: # (new in 1.1) Enabled: true +Lint/UselessRuby2Keywords: # new in 1.23 + Enabled: true +Naming/BlockForwarding: # new in 1.24 + Enabled: true Naming/InclusiveLanguage: # (new in 1.18) Enabled: true Security/IoMethods: # new in 1.22 @@ -65,6 +71,10 @@ Style/DocumentDynamicEvalDefinition: # (new in 1.1) Enabled: true Style/EndlessMethod: # (new in 1.8) Enabled: true +Style/FileRead: # new in 1.24 + Enabled: true +Style/FileWrite: # new in 1.24 + Enabled: true Style/HashConversion: # (new in 1.10) Enabled: true Style/HashExcept: # (new in 1.7) @@ -73,16 +83,22 @@ Style/IfWithBooleanLiteralBranches: # (new in 1.9) Enabled: true Style/InPatternThen: # (new in 1.16) Enabled: true +Style/MapToHash: # new in 1.24 + Enabled: true Style/MultilineInPatternThen: # (new in 1.16) Enabled: true Style/NegatedIfElseCondition: # (new in 1.2) Enabled: true +Style/NestedFileDirname: # new in 1.26 + Enabled: true Style/NilLambda: # (new in 1.3) Enabled: true Style/NumberedParameters: # new in 1.22 Enabled: true Style/NumberedParametersLimit: # new in 1.22 Enabled: true +Style/OpenStructUse: # new in 1.23 + Enabled: true Style/QuotedSymbols: # (new in 1.16) Enabled: true Style/RedundantArgument: # (new in 1.4) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e3280fef..617f43023 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## Master +## 0.14.2 ##### Breaking @@ -16,7 +16,7 @@ [John Fairhurst](https://github.com/johnfairh) [#900](https://github.com/realm/jazzy/issues/900) -* Support Swift 5.6. +* Support Swift 5.6. The bundled `sourcekitten` is a universal binary. [John Fairhurst](https://github.com/johnfairh) ##### Bug Fixes diff --git a/Gemfile.lock b/Gemfile.lock index 3b1cdaee0..3497187ce 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - jazzy (0.14.1) + jazzy (0.14.2) cocoapods (~> 1.5) mustache (~> 1.1) open4 (~> 1.3) @@ -15,9 +15,9 @@ PATH GEM remote: https://rubygems.org/ specs: - CFPropertyList (3.0.4) + CFPropertyList (3.0.5) rexml - activesupport (6.1.4.1) + activesupport (6.1.5) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) @@ -31,7 +31,7 @@ GEM ast (2.4.2) atomos (0.1.3) bacon (1.2.0) - claide (1.0.3) + claide (1.1.0) claide-plugins (0.9.2) cork nap @@ -39,10 +39,10 @@ GEM clintegracon (0.7.0) colored (~> 1.2) diffy - cocoapods (1.11.2) + cocoapods (1.11.3) addressable (~> 2.8) claide (>= 1.0.2, < 2.0) - cocoapods-core (= 1.11.2) + cocoapods-core (= 1.11.3) cocoapods-deintegrate (>= 1.0.3, < 2.0) cocoapods-downloader (>= 1.4.0, < 2.0) cocoapods-plugins (>= 1.0.0, < 2.0) @@ -57,7 +57,7 @@ GEM nap (~> 1.0) ruby-macho (>= 1.0, < 3.0) xcodeproj (>= 1.21.0, < 2.0) - cocoapods-core (1.11.2) + cocoapods-core (1.11.3) activesupport (>= 5.0, < 7) addressable (~> 2.8) algoliasearch (~> 1.0) @@ -83,7 +83,7 @@ GEM colored2 (~> 3.1) crack (0.4.5) rexml - danger (8.4.0) + danger (8.4.5) claide (~> 1.0) claide-plugins (>= 0.9.2) colored2 (~> 3.1) @@ -98,18 +98,19 @@ GEM terminal-table (>= 1, < 4) diffy (3.4.0) escape (0.0.4) - ethon (0.14.0) + ethon (0.15.0) ffi (>= 1.15.0) - faraday (1.8.0) + faraday (1.10.0) faraday-em_http (~> 1.0) faraday-em_synchrony (~> 1.0) faraday-excon (~> 1.1) - faraday-httpclient (~> 1.0.1) + faraday-httpclient (~> 1.0) + faraday-multipart (~> 1.0) faraday-net_http (~> 1.0) - faraday-net_http_persistent (~> 1.1) + faraday-net_http_persistent (~> 1.0) faraday-patron (~> 1.0) faraday-rack (~> 1.0) - multipart-post (>= 1.2, < 3) + faraday-retry (~> 1.0) ruby2_keywords (>= 0.0.4) faraday-em_http (1.0.0) faraday-em_synchrony (1.0.0) @@ -117,27 +118,30 @@ GEM faraday-http-cache (2.2.0) faraday (>= 0.8) faraday-httpclient (1.0.1) + faraday-multipart (1.0.3) + multipart-post (>= 1.2, < 3) faraday-net_http (1.0.1) faraday-net_http_persistent (1.2.0) faraday-patron (1.0.0) faraday-rack (1.0.0) - ffi (1.15.4) + faraday-retry (1.0.3) + ffi (1.15.5) fourflusher (2.3.1) fuzzy_match (2.0.4) gh_inspector (1.1.3) - git (1.9.1) + git (1.10.2) rchardet (~> 1.8) hashdiff (1.0.1) httpclient (2.8.3) - i18n (1.8.10) + i18n (1.10.0) concurrent-ruby (~> 1.0) - json (2.5.1) + json (2.6.1) kramdown (2.3.1) rexml kramdown-parser-gfm (1.1.0) kramdown (~> 2.0) liferaft (0.0.6) - minitest (5.14.4) + minitest (5.15.0) mocha (1.13.0) mocha-on-bacon (0.2.3) mocha (>= 0.13.0) @@ -148,34 +152,34 @@ GEM nap (1.1.0) netrc (0.11.0) no_proxy_fix (0.1.2) - octokit (4.21.0) + octokit (4.22.0) faraday (>= 0.9) sawyer (~> 0.8.0, >= 0.5.3) open4 (1.3.4) parallel (1.21.0) - parser (3.0.2.0) + parser (3.1.1.0) ast (~> 2.4.1) prettybacon (0.0.2) bacon (~> 1.2) public_suffix (4.0.6) - rainbow (3.0.0) + rainbow (3.1.1) rake (13.0.6) rchardet (1.8.0) redcarpet (3.5.1) - regexp_parser (2.1.1) + regexp_parser (2.2.1) rexml (3.2.5) - rouge (3.26.1) - rubocop (1.22.0) + rouge (3.28.0) + rubocop (1.26.0) parallel (~> 1.10) - parser (>= 3.0.0.0) + parser (>= 3.1.0.0) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml - rubocop-ast (>= 1.12.0, < 2.0) + rubocop-ast (>= 1.16.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.12.0) - parser (>= 3.0.1.1) + rubocop-ast (1.16.0) + parser (>= 3.1.1.0) ruby-macho (2.5.1) ruby-progressbar (1.11.0) ruby2_keywords (0.0.5) @@ -205,7 +209,7 @@ GEM colored2 (~> 3.1) nanaimo (~> 0.3.0) rexml (~> 3.2.4) - zeitwerk (2.4.2) + zeitwerk (2.5.4) PLATFORMS ruby diff --git a/jazzy.gemspec b/jazzy.gemspec index cad5b7de1..fefddf548 100644 --- a/jazzy.gemspec +++ b/jazzy.gemspec @@ -10,7 +10,7 @@ Gem::Specification.new do |spec| spec.email = ['jp@jpsim.com'] spec.summary = 'Soulful docs for Swift & Objective-C.' spec.description = 'Soulful docs for Swift & Objective-C. ' \ - "Run in your Xcode project's root directory for " \ + "Run in your SPM or Xcode project's root directory for " \ 'instant HTML docs.' spec.homepage = 'https://github.com/realm/jazzy' spec.license = 'MIT' @@ -32,4 +32,5 @@ Gem::Specification.new do |spec| spec.add_development_dependency 'rake', '~> 13.0' spec.required_ruby_version = '>= 2.6.3' + spec.metadata['rubygems_mfa_required'] = 'true' end diff --git a/lib/jazzy/gem_version.rb b/lib/jazzy/gem_version.rb index bd3f00526..c6f5319b3 100644 --- a/lib/jazzy/gem_version.rb +++ b/lib/jazzy/gem_version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Jazzy - VERSION = '0.14.1' unless defined? Jazzy::VERSION + VERSION = '0.14.2' unless defined? Jazzy::VERSION end diff --git a/lib/jazzy/highlighter.rb b/lib/jazzy/highlighter.rb index 2320d98bf..32bcae732 100644 --- a/lib/jazzy/highlighter.rb +++ b/lib/jazzy/highlighter.rb @@ -2,18 +2,6 @@ require 'rouge' -# While Rouge is downlevel (Rouge PR#1715 unreleased) -module Rouge - module Lexers - class Swift - prepend :root do - rule(/\b(?:async|await|isolated)\b/, Keyword) - rule(/\b(?:actor|nonisolated)\b/, Keyword::Declaration) - end - end - end -end - module Jazzy # This module helps highlight code module Highlighter diff --git a/lib/jazzy/search_builder.rb b/lib/jazzy/search_builder.rb index d13a8c4bf..7f843f598 100644 --- a/lib/jazzy/search_builder.rb +++ b/lib/jazzy/search_builder.rb @@ -6,17 +6,15 @@ def self.build(source_module, output_dir) decls = source_module.all_declarations.select do |d| d.type && d.name && !d.name.empty? end - index = decls.map do |d| + index = decls.to_h do |d| [d.url, { name: d.name, abstract: d.abstract && d.abstract.split(/\n/).map(&:strip).first, - parent_name: d.parent_in_code && d.parent_in_code.name, + parent_name: d.parent_in_code&.name, }.reject { |_, v| v.nil? || v.empty? }] - end.to_h - File.open(File.join(output_dir, 'search.json'), 'w') do |f| - f.write(index.to_json) end + File.write(File.join(output_dir, 'search.json'), index.to_json) end end end diff --git a/spec/integration_spec.rb b/spec/integration_spec.rb index 0d3a95e74..04b120ead 100644 --- a/spec/integration_spec.rb +++ b/spec/integration_spec.rb @@ -85,9 +85,8 @@ def configure_cocoapods # Transform produced databases to csv c.transform_produced '**/*.dsidx' do |path| - File.open("#{path}.csv", 'w') do |file| - file.write `sqlite3 -header -csv #{path} "select * from searchIndex;"` - end + File.write("#{path}.csv", + `sqlite3 -header -csv #{path} "select * from searchIndex;"`) end # Now that we're comparing the CSV, we don't care about the binary c.ignores '**/*.dsidx'