aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2020-07-14 22:37:13 -0400
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2020-07-17 23:01:33 -0400
commitc164c402a1899ffd2b2caba541b51e05855e94b8 (patch)
tree8afc8bae44518036e4d9e4b3b6db5eae9f1de056
parent12ed6da4fe4dc014c230ebbc857cfc698347ea2f (diff)
downloadguix-c164c402a1899ffd2b2caba541b51e05855e94b8.tar
guix-c164c402a1899ffd2b2caba541b51e05855e94b8.tar.gz
gnu: ruby-rubocop: Update to 0.88.0.
* gnu/packages/patches/ruby-rubocop-break-dependency-cycle.patch: New file. * gnu/local.mk (dist_patch_DATA): Register patch. * gnu/packages/ruby.scm (ruby-rubocop): Update to 0.88.0. [origin]: Use git-fetch. Apply the newly added patch. [arguments]: Set #:test-target to "default". Remove #:tests?, enabling tests. [phases]{remove-problematic-tests, disable-bundler, set-home, make-adoc-files-writable}: New phases. Replace the 'replace-git-ls-files phase. [native-inputs]: Add ruby-bump, ruby-pry, ruby-rspec, ruby-test-queue, ruby-webmock-2 and ruby-yard. [propagated-inputs]: Remove ruby-powerpack and ruby-jaro-winkler. Add ruby-regexp-parser, ruby-rexml and ruby-rubocop-ast.
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/patches/ruby-rubocop-break-dependency-cycle.patch101
-rw-r--r--gnu/packages/ruby.scm68
3 files changed, 160 insertions, 10 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index b3811a473f..e8915990bc 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1513,6 +1513,7 @@ dist_patch_DATA = \
%D%/packages/patches/racket-store-checksum-override.patch \
%D%/packages/patches/retroarch-disable-online-updater.patch \
%D%/packages/patches/ruby-rack-ignore-failing-test.patch \
+ %D%/packages/patches/ruby-rubocop-break-dependency-cycle.patch\
%D%/packages/patches/ruby-sanitize-system-libxml.patch \
%D%/packages/patches/ruby-tzinfo-data-ignore-broken-test.patch\
%D%/packages/patches/runc-CVE-2019-5736.patch \
diff --git a/gnu/packages/patches/ruby-rubocop-break-dependency-cycle.patch b/gnu/packages/patches/ruby-rubocop-break-dependency-cycle.patch
new file mode 100644
index 0000000000..035a98fa33
--- /dev/null
+++ b/gnu/packages/patches/ruby-rubocop-break-dependency-cycle.patch
@@ -0,0 +1,101 @@
+From ff3f00b7f33332ebf1c3c05abc4a781684775b3c Mon Sep 17 00:00:00 2001
+From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
+Date: Tue, 14 Jul 2020 11:50:12 -0400
+Subject: [PATCH] config: Drop rubocop-performance, rubocop-rspec requirements.
+
+This patch removes Rubocop extensions from Rubocop's closure to break
+a dependency cycle with itself.
+
+* .rubocop.yml: Remove rubocop-performance and rubocop-rspec and their
+corresponding directives.
+* .rubocop_todo.yml: Likewise.
+---
+ .rubocop.yml | 15 ---------------
+ .rubocop_todo.yml | 44 --------------------------------------------
+ 2 files changed, 59 deletions(-)
+
+diff --git a/.rubocop.yml b/.rubocop.yml
+index 4f05d5be2..f12ef7c06 100644
+--- a/.rubocop.yml
++++ b/.rubocop.yml
+@@ -3,8 +3,6 @@
+ inherit_from: .rubocop_todo.yml
+ require:
+ - rubocop/cop/internal_affairs
+- - rubocop-performance
+- - rubocop-rspec
+
+ AllCops:
+ NewCops: enable
+@@ -106,16 +104,3 @@ Metrics/ClassLength:
+ Metrics/ModuleLength:
+ Exclude:
+ - 'spec/**/*.rb'
+-
+-RSpec/FilePath:
+- Exclude:
+- - spec/rubocop/formatter/junit_formatter_spec.rb
+-
+-RSpec/PredicateMatcher:
+- EnforcedStyle: explicit
+-
+-RSpec/MessageSpies:
+- EnforcedStyle: receive
+-
+-RSpec/NestedGroups:
+- Max: 7
+diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
+index 3f72042d1..fa637cd42 100644
+--- a/.rubocop_todo.yml
++++ b/.rubocop_todo.yml
+@@ -24,47 +24,3 @@ Metrics/MethodLength:
+ # Configuration parameters: CountComments.
+ Metrics/ModuleLength:
+ Max: 132
+-
+-# Offense count: 10
+-RSpec/AnyInstance:
+- Exclude:
+- - 'spec/rubocop/cli_spec.rb'
+- - 'spec/rubocop/cop/lint/duplicate_methods_spec.rb'
+- - 'spec/rubocop/cop/team_spec.rb'
+- - 'spec/rubocop/target_finder_spec.rb'
+-
+-# Offense count: 981
+-# Configuration parameters: Prefixes.
+-# Prefixes: when, with, without
+-RSpec/ContextWording:
+- Enabled: false
+-
+-# Offense count: 3810
+-# Configuration parameters: Max.
+-RSpec/ExampleLength:
+- Enabled: false
+-
+-# Offense count: 38
+-RSpec/ExpectOutput:
+- Exclude:
+- - 'spec/rubocop/cli/cli_auto_gen_config_spec.rb'
+- - 'spec/rubocop/cli/cli_options_spec.rb'
+- - 'spec/rubocop/config_spec.rb'
+- - 'spec/rubocop/cop/cop_spec.rb'
+- - 'spec/rubocop/formatter/disabled_config_formatter_spec.rb'
+- - 'spec/rubocop/formatter/formatter_set_spec.rb'
+- - 'spec/rubocop/options_spec.rb'
+- - 'spec/rubocop/rake_task_spec.rb'
+- - 'spec/rubocop/result_cache_spec.rb'
+- - 'spec/rubocop/target_finder_spec.rb'
+-
+-# Offense count: 434
+-RSpec/MultipleExpectations:
+- Max: 25
+-
+-# Offense count: 5
+-RSpec/SubjectStub:
+- Exclude:
+- - 'spec/rubocop/config_spec.rb'
+- - 'spec/rubocop/formatter/json_formatter_spec.rb'
+- - 'spec/rubocop/formatter/progress_formatter_spec.rb'
+--
+2.27.0
+
diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index 0fae903592..8b87449d7d 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -6664,25 +6664,73 @@ run.")
(define-public ruby-rubocop
(package
(name "ruby-rubocop")
- (version "0.77.0")
+ (version "0.88.0")
(source
(origin
- (method url-fetch)
- (uri (rubygems-uri "rubocop" version))
+ (method git-fetch) ;no tests in distributed gem
+ (uri (git-reference
+ (url "https://github.com/rubocop-hq/rubocop.git")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
(sha256
(base32
- "0m88b1bgbhmmbdnz2xv6n0il0j4q5qm9jbc0vf1zsaxmxqp06nx9"))))
+ "1d06893jp8pd85fvgp5d16vqcf31bafi430v4f4y746ihyvhzz5r"))
+ (patches (search-patches "ruby-rubocop-break-dependency-cycle.patch"))))
(build-system ruby-build-system)
(arguments
- '(;; No included tests
- #:tests? #f))
+ '(#:test-target "default"
+ #:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'remove-problematic-tests
+ ;; These tests depend on Rubocop extensions, which cannot be
+ ;; included as they cause a dependency cycle with Rubocop itself.
+ (lambda _
+ (delete-file "spec/rubocop/config_loader_spec.rb")
+ (substitute* "Gemfile"
+ ((".*'rubocop-performance'.*") "")
+ ((".*'rubocop-rspec'.*") ""))
+ ;; Prevent "Unnecessary disabling of RSpec/* (unknown cop)"
+ ;; errors.
+ (substitute* (find-files "spec/rubocop/cop/" "_spec\\.rb$")
+ (("# (rubocop:(enable|disable) RSpec.*)" _ what)
+ (string-append "# Disabled: " what)))
+ #t))
+ (add-after 'unpack 'disable-bundler
+ (lambda _
+ (substitute* "Rakefile"
+ (("Bundler\\.setup.*") "nil\n"))
+ #t))
+ (replace 'replace-git-ls-files
+ (lambda _
+ (substitute* "rubocop.gemspec"
+ (("`git ls-files(.*)`" _ files)
+ (format #f "`find ~a -type f| sort`" files)))
+ #t))
+ (add-before 'check 'set-home
+ (lambda _
+ (setenv "HOME" (getcwd))
+ #t))
+ (add-before 'check 'make-adoc-files-writable
+ (lambda _
+ (let ((adoc-files (find-files "docs/modules/ROOT/pages"
+ "\\.adoc$")))
+ (for-each make-file-writable adoc-files))
+ #t)))))
+ (native-inputs
+ `(("ruby-bump" ,ruby-bump)
+ ("ruby-pry" ,ruby-pry)
+ ("ruby-rspec" ,ruby-rspec)
+ ("ruby-test-queue" ,ruby-test-queue)
+ ("ruby-webmock" ,ruby-webmock-2)
+ ("ruby-yard" ,ruby-yard)))
(propagated-inputs
- `(("ruby-parser" ,ruby-parser)
- ("ruby-powerpack" ,ruby-powerpack)
+ `(("ruby-parallel" ,ruby-parallel)
+ ("ruby-parser" ,ruby-parser)
("ruby-rainbow" ,ruby-rainbow)
+ ("ruby-regexp-parser" ,ruby-regexp-parser)
+ ("ruby-rexml" ,ruby-rexml)
+ ("ruby-rubocop-ast" ,ruby-rubocop-ast)
("ruby-progressbar" ,ruby-progressbar)
- ("ruby-parallel" ,ruby-parallel)
- ("ruby-jaro-winkler" ,ruby-jaro-winkler)
("ruby-unicode-display-width" ,ruby-unicode-display-width)))
(synopsis "Ruby code style checking tool")
(description