From e31d848e7500bf6be6358de0c54fe43a765bbba4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ana=20Mar=C3=ADa=20Mart=C3=ADnez=20G=C3=B3mez?= Date: Mon, 29 Apr 2019 16:26:13 +0200 Subject: [PATCH 1/2] Add rake tasks for Rubocop To always run rubocop with the same options (specially important when regenerating the todo file). It creates the following three tasks: rake rubocop # Run RuboCop on the whole project rake rubocop:auto_correct # Auto-correct RuboCop offenses rake rubocop:auto_gen_config # Generate .rubocop_todo.yml --- lib/tasks/.capitalize_colors.rake.swp | Bin 0 -> 12288 bytes lib/tasks/.data.rake.swp | Bin 0 -> 12288 bytes lib/tasks/.rubocop.rake.swp | Bin 0 -> 12288 bytes lib/tasks/rubocop.rake | 16 ++++++++++++++++ 4 files changed, 16 insertions(+) create mode 100644 lib/tasks/.capitalize_colors.rake.swp create mode 100644 lib/tasks/.data.rake.swp create mode 100644 lib/tasks/.rubocop.rake.swp create mode 100644 lib/tasks/rubocop.rake diff --git a/lib/tasks/.capitalize_colors.rake.swp b/lib/tasks/.capitalize_colors.rake.swp new file mode 100644 index 0000000000000000000000000000000000000000..abe1fd8c5ed3aec30c343f0a8506c775e5b3b554 GIT binary patch literal 12288 zcmeI2PiqrF7>B1Kc&b)Cczv4+u^^jP!InTzDkAvjl6n%uWamw~WU{;L%m!MDdezUO zUqKI^ya;{)!Qz+jr0;AtG)*C5Z_01r$*{9CznOV*3VC}Q&mKOe?Pya;TT$xQR{6Yh z{)hVcLMffxD{T)01TWmu&i$1+S~}kYmHU9dS&<23=F^k48Q;kzyJ)u01UtY4E(Y!$@R|FSG-pDOLKkwhzdEit z?3y&G?4AiS4Ou`l10ilMxk~6rK$T83$-S5K`$=3{zfYFOY|om0obxEeoYf*p7{{jw2?<(2@CBYEQk)f$w*^FtMO78jN|g$Ss-YZEtyz1#JI(Cavd5v@ zCh!IN0otCp(k}ovz5z!#Q_(vddxHP?C0X2Rd*VR#jP&1G&pfX`k5`J~$>}ezd`{=W zGXmpnA^tvFf4%$aAL8jvA*7Xl^@U^l(YdgyD;1_{rR}!}IG$=Zt0&{UQuDFVld+T4 zUNugolVK_MRtH!aoi~{P6Ie~)l=$HNGpD`H#`+q)`_ArabKYeFOn?b60Vco%m;e)C z0!-kgBH)S>;yZNoO4n7;%_jzPcgYhIU;<2l2`~XBzyz286JP>NfC(@GCh$KbAX6c3 zy)MN18z>(C|L_0)fBcpZzeB%3kDwo*0!pFRpx@pU;#cTr=q&WtDIxxZoN zfC(@GCh*@7P&O4r?dS1KRMf7b^~?IUN@?S+bgtBs+Nr~}b(s6nyZGQvQtGUVaa$di>=K_ zr=!ER7@aMLl6G;S3DCOV(8iFhjnUcSU!9P)xW3rr|17tz^wpG6^r^(VzB6SCRaRkP z>QWkgM{Oa<1q+1riQ%lf4QW>%_>aqAnDDLcXnibxkFCnYJy#%)g9G zX_*&3NxT#zqDa|&UFLRM$XPHiF;})^Ol0kXHrDsYV8muaNXp3OJg`K0cSAEt&H_vezbaw1dP1!H# z(v>pVLu<|aOh3))swR3jU-@+(YEW;#KPa*>1^(uY^@qadR^8T>!)=bUyi|H><2|*& z^E^Cn@N5s<7u}Qk4G!a!Iw$f@f$*olDrBN4@^94pb1F6{EAu@+s`0l^a+ Jkt=H@{sCxx*8~6n literal 0 HcmV?d00001 diff --git a/lib/tasks/.rubocop.rake.swp b/lib/tasks/.rubocop.rake.swp new file mode 100644 index 0000000000000000000000000000000000000000..b22e6cd37c364fafd5521258a0ebe28f5d6de415 GIT binary patch literal 12288 zcmeI&y>8P`6bJBACI-F{3`_?)7zW!dNT`a`i2*UNM8E7(&;gzomb!V*7ra-xlQzHy+))&s)hR>2;3i!^tmCW~aW> z&!H@q0e4o1x2GmDFZ$^%^TT zz(WW?V1>YGx^;7NqkUoh+Eu=I;o*vR@dyGCfB*y_009U<00I#B-vmOnMz6J~6J25F zyK(KWvHOYv0uX=z1Rwwb2tWV=5P$##AOL}5C}46TK11|I)BgXz{Qdv!EYVlZXU!+g zf#$u&X;^bbb6Imq^F!x;)EsEuY2Iq)>m5T692o)-fB*y_009U<00Izz00fREAT}rF zwy8UDRVbYGyv>iJIL-@Sm1Y`ejXRl8@Bg-DM#uVV4Z z?8h8+tMTDNx^wA0(*zff#A}INn{c zQkx*0bbAhh%Uv>^lo8DxDw7E>%hT$JYI)uiwfsJ1+P2XT+M2bNb>6MrOWn$cy0D`` NS*V>UdmQRU=oe!mxn}?X literal 0 HcmV?d00001 diff --git a/lib/tasks/rubocop.rake b/lib/tasks/rubocop.rake new file mode 100644 index 00000000..41ae0865 --- /dev/null +++ b/lib/tasks/rubocop.rake @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +require 'rubocop/rake_task' + +namespace :rubocop do + desc 'Generate .rubocop_todo.yml' + task :auto_gen_config do + sh 'rubocop --display-cop-names --auto-gen-config --auto-gen-only-exclude' + end +end + +desc 'Run RuboCop on the whole project' +RuboCop::RakeTask.new(:rubocop) do |task| + task.patterns = [] + task.options = ['--display-cop-names'] +end From 33e11e3efa9ecbcdb76b93fba79d9a0d1b8e5c73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ana=20Mar=C3=ADa=20Mart=C3=ADnez=20G=C3=B3mez?= Date: Mon, 29 Apr 2019 16:31:29 +0200 Subject: [PATCH 2/2] Regenerate the todo file It is a good idea to do this once in a while, so that files that used to have offenses but don't have them anymore are not excluded and to decrease the maximums in the metric cops. --- .rubocop_todo.yml | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index d7c30a27..42d0b459 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,12 +1,13 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2019-03-08 16:06:53 +0000 using RuboCop version 0.65.0. +# on 2019-04-29 14:27:51 +0000 using RuboCop version 0.66.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: 351 +# Cop supports --auto-correct. Capybara/CurrentPathExpectation: Exclude: - 'spec/features/base_controller_spec.rb' @@ -77,7 +78,7 @@ Layout/EmptyLinesAroundExceptionHandlingKeywords: # Offense count: 52 # Cop supports --auto-correct. -# Configuration parameters: AllowForAlignment, ForceEqualSignAlignment. +# Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment. Layout/ExtraSpacing: Exclude: - 'Guardfile' @@ -181,7 +182,7 @@ Layout/MultilineHashBraceLayout: Layout/MultilineMethodCallBraceLayout: Enabled: false -# Offense count: 53 +# Offense count: 56 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, IndentationWidth. # SupportedStyles: aligned, indented, indented_relative_to_receiver @@ -402,15 +403,15 @@ Lint/UnusedMethodArgument: Exclude: - 'config/initializers/fuckups.rb' -# Offense count: 138 +# Offense count: 136 Metrics/AbcSize: - Max: 74 + Max: 70 -# Offense count: 312 +# Offense count: 314 # Configuration parameters: CountComments, ExcludedMethods. # ExcludedMethods: refine Metrics/BlockLength: - Max: 1347 + Max: 1344 # Offense count: 1 # Configuration parameters: CountBlocks, Max. @@ -517,7 +518,7 @@ RSpec/AnyInstance: - 'spec/controllers/proposals_controller_spec.rb' - 'spec/controllers/tracks_controller_spec.rb' -# Offense count: 314 +# Offense count: 315 # Configuration parameters: Prefixes. # Prefixes: when, with, without RSpec/ContextWording: @@ -636,7 +637,7 @@ RSpec/FilePath: - 'spec/models/comment_spec.rb' - 'spec/models/openid.rb' -# Offense count: 170 +# Offense count: 171 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle. # SupportedStyles: implicit, each, example @@ -709,7 +710,7 @@ RSpec/LeadingSubject: - 'spec/models/conference_spec.rb' - 'spec/models/ticket_spec.rb' -# Offense count: 50 +# Offense count: 55 RSpec/LetSetup: Enabled: false @@ -730,6 +731,7 @@ RSpec/MultipleExpectations: Max: 97 # Offense count: 387 +# Configuration parameters: IgnoreSharedExamples. RSpec/NamedSubject: Exclude: - 'spec/models/conference_spec.rb' @@ -923,7 +925,7 @@ Rails/HasManyOrHasOneDependent: - 'app/models/vday.rb' - 'app/models/vposition.rb' -# Offense count: 249 +# Offense count: 251 # Cop supports --auto-correct. # Configuration parameters: Include. # Include: spec/**/*, test/**/* @@ -1028,7 +1030,8 @@ Rails/SkipsModelValidations: - 'lib/tasks/user.rake' - 'spec/controllers/conferences_controller_spec.rb' -# Offense count: 49 +# Offense count: 48 +# Cop supports --auto-correct. # Configuration parameters: EnforcedStyle. # SupportedStyles: strict, flexible Rails/TimeZone: @@ -1040,7 +1043,6 @@ Rails/TimeZone: - 'db/migrate/20180313012253_add_timestamps_to_tickets.rb' - 'lib/tasks/dump_db.rake' - 'spec/controllers/admin/comments_controller_spec.rb' - - 'spec/controllers/admin/programs_controller_spec.rb' - 'spec/factories/users.rb' - 'spec/models/conference_spec.rb' @@ -1167,7 +1169,7 @@ Style/HashSyntax: Style/IfUnlessModifier: Enabled: false -# Offense count: 8 +# Offense count: 10 # Cop supports --auto-correct. Style/LineEndConcatenation: Exclude: @@ -1457,7 +1459,7 @@ Style/WordArray: EnforcedStyle: percent MinSize: 8 -# Offense count: 2887 +# Offense count: 2864 # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. # URISchemes: http, https Metrics/LineLength: