Commit f6bea424cc02156e7f45459df3e09dfd27d67692

Authored by Stephen Crosby
2 parents 8bab6910 5e9ea72f
Exists in master and in 1 other branch production

Merge pull request #963 from rud/chore/install-rubocop

Install rubocop - auto-validating syntax checking
.rubocop.yml 0 → 100644
... ... @@ -0,0 +1,5 @@
  1 +---
  2 +inherit_from: .rubocop_todo.yml
  3 +
  4 +AllCops:
  5 + RunRailsCops: true
... ...
.rubocop_todo.yml 0 → 100644
... ... @@ -0,0 +1,736 @@
  1 +# This configuration was generated by
  2 +# `rubocop --auto-gen-config`
  3 +# on 2015-10-12 09:35:47 +0200 using RuboCop version 0.34.2.
  4 +# The point is for the user to remove these configuration records
  5 +# one by one as the offenses are removed from the code base.
  6 +# Note that changes in the inspected code, or installation of new
  7 +# versions of RuboCop, may require this file to be generated again.
  8 +
  9 +# Offense count: 37
  10 +Metrics/AbcSize:
  11 + Max: 55
  12 +
  13 +# Offense count: 5
  14 +# Configuration parameters: CountComments.
  15 +Metrics/ClassLength:
  16 + Max: 203
  17 +
  18 +# Offense count: 5
  19 +Metrics/CyclomaticComplexity:
  20 + Max: 11
  21 +
  22 +# Offense count: 457
  23 +# Configuration parameters: AllowURI, URISchemes.
  24 +Metrics/LineLength:
  25 + Max: 239
  26 +
  27 +# Offense count: 29
  28 +# Configuration parameters: CountComments.
  29 +Metrics/MethodLength:
  30 + Max: 41
  31 +
  32 +# Offense count: 3
  33 +Metrics/PerceivedComplexity:
  34 + Max: 12
  35 +
  36 +# Offense count: 2
  37 +# Cop supports --auto-correct.
  38 +Performance/Sample:
  39 + Exclude:
  40 + - 'lib/tasks/errbit/demo.rake'
  41 + - 'spec/fabricators/backtrace_fabricator.rb'
  42 +
  43 +# Offense count: 2
  44 +# Cop supports --auto-correct.
  45 +Performance/StringReplacement:
  46 + Exclude:
  47 + - 'app/models/notification_services/gtalk_service.rb'
  48 + - 'lib/hoptoad/v2.rb'
  49 +
  50 +# Offense count: 1
  51 +# Cop supports --auto-correct.
  52 +# Configuration parameters: EnforcedStyle, SupportedStyles, Include.
  53 +Rails/ActionFilter:
  54 + Exclude:
  55 + - 'app/controllers/notices_controller.rb'
  56 +
  57 +# Offense count: 4
  58 +# Cop supports --auto-correct.
  59 +# Configuration parameters: Include.
  60 +Rails/FindBy:
  61 + Exclude:
  62 + - 'app/models/app.rb'
  63 + - 'app/models/error_report.rb'
  64 + - 'app/models/user.rb'
  65 +
  66 +# Offense count: 16
  67 +# Configuration parameters: Include.
  68 +Rails/Output:
  69 + Exclude:
  70 + - 'app/interactors/notice_refingerprinter.rb'
  71 + - 'app/interactors/problem_recacher.rb'
  72 + - 'db/seeds.rb'
  73 +
  74 +# Offense count: 14
  75 +# Configuration parameters: EnforcedStyle, SupportedStyles.
  76 +Rails/TimeZone:
  77 + Exclude:
  78 + - 'app/models/problem.rb'
  79 + - 'lib/tasks/errbit/demo.rake'
  80 + - 'spec/controllers/api/v1/notices_controller_spec.rb'
  81 + - 'spec/controllers/problems_controller_spec.rb'
  82 + - 'spec/models/error_report_spec.rb'
  83 + - 'spec/models/problem_spec.rb'
  84 + - 'spec/views/apps/index.html.haml_spec.rb'
  85 + - 'spec/views/users/show.html.haml_spec.rb'
  86 +
  87 +# Offense count: 12
  88 +# Configuration parameters: Include.
  89 +Rails/Validation:
  90 + Exclude:
  91 + - 'app/models/app.rb'
  92 + - 'app/models/comment.rb'
  93 + - 'app/models/deploy.rb'
  94 + - 'app/models/err.rb'
  95 + - 'app/models/notice.rb'
  96 + - 'app/models/problem.rb'
  97 + - 'app/models/user.rb'
  98 +
  99 +# Offense count: 2
  100 +# Cop supports --auto-correct.
  101 +# Configuration parameters: EnforcedStyle, SupportedStyles.
  102 +Style/AccessModifierIndentation:
  103 + Enabled: false
  104 +
  105 +# Offense count: 3
  106 +# Cop supports --auto-correct.
  107 +Style/Alias:
  108 + Exclude:
  109 + - 'app/decorators/issue_tracker_field_decorator.rb'
  110 + - 'app/models/app.rb'
  111 +
  112 +# Offense count: 8
  113 +# Cop supports --auto-correct.
  114 +# Configuration parameters: EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle, SupportedLastArgumentHashStyles.
  115 +Style/AlignHash:
  116 + Exclude:
  117 + - 'app/models/app.rb'
  118 + - 'spec/controllers/apps_controller_spec.rb'
  119 + - 'spec/controllers/comments_controller_spec.rb'
  120 + - 'spec/controllers/problems_controller_spec.rb'
  121 + - 'spec/models/problem_spec.rb'
  122 +
  123 +# Offense count: 7
  124 +# Cop supports --auto-correct.
  125 +# Configuration parameters: EnforcedStyle, SupportedStyles.
  126 +Style/AlignParameters:
  127 + Exclude:
  128 + - 'app/helpers/apps_helper.rb'
  129 + - 'app/models/app.rb'
  130 + - 'app/models/notification_services/gtalk_service.rb'
  131 + - 'app/models/problem.rb'
  132 + - 'config/initializers/devise.rb'
  133 +
  134 +# Offense count: 2
  135 +# Cop supports --auto-correct.
  136 +# Configuration parameters: EnforcedStyle, SupportedStyles.
  137 +Style/AndOr:
  138 + Exclude:
  139 + - 'app/controllers/users_controller.rb'
  140 + - 'app/models/error_report.rb'
  141 +
  142 +# Offense count: 105
  143 +# Cop supports --auto-correct.
  144 +# Configuration parameters: EnforcedStyle, SupportedStyles, ProceduralMethods, FunctionalMethods, IgnoredMethods.
  145 +Style/BlockDelimiters:
  146 + Enabled: false
  147 +
  148 +# Offense count: 2
  149 +# Cop supports --auto-correct.
  150 +Style/BlockEndNewline:
  151 + Exclude:
  152 + - 'spec/models/error_report_spec.rb'
  153 + - 'spec/views/apps/show.atom.builder_spec.rb'
  154 +
  155 +# Offense count: 49
  156 +# Cop supports --auto-correct.
  157 +# Configuration parameters: EnforcedStyle, SupportedStyles.
  158 +Style/BracesAroundHashParameters:
  159 + Enabled: false
  160 +
  161 +# Offense count: 15
  162 +# Configuration parameters: EnforcedStyle, SupportedStyles.
  163 +Style/ClassAndModuleChildren:
  164 + Exclude:
  165 + - 'app/controllers/api/v1/notices_controller.rb'
  166 + - 'app/controllers/api/v1/problems_controller.rb'
  167 + - 'app/controllers/api/v1/stats_controller.rb'
  168 + - 'app/controllers/api/v3/notices_controller.rb'
  169 + - 'app/controllers/users/omniauth_callbacks_controller.rb'
  170 + - 'app/models/notification_services/campfire_service.rb'
  171 + - 'app/models/notification_services/flowdock_service.rb'
  172 + - 'app/models/notification_services/gtalk_service.rb'
  173 + - 'app/models/notification_services/hipchat_service.rb'
  174 + - 'app/models/notification_services/hoiio_service.rb'
  175 + - 'app/models/notification_services/hubot_service.rb'
  176 + - 'app/models/notification_services/pushover_service.rb'
  177 + - 'app/models/notification_services/slack_service.rb'
  178 + - 'app/models/notification_services/webhook_service.rb'
  179 + - 'config/initializers/overrides.rb'
  180 +
  181 +# Offense count: 1
  182 +# Cop supports --auto-correct.
  183 +# Configuration parameters: EnforcedStyle, SupportedStyles.
  184 +Style/ClassCheck:
  185 + Exclude:
  186 + - 'app/helpers/navigation_helper.rb'
  187 +
  188 +# Offense count: 1
  189 +# Cop supports --auto-correct.
  190 +Style/ClosingParenthesisIndentation:
  191 + Exclude:
  192 + - 'app/models/problem.rb'
  193 +
  194 +# Offense count: 23
  195 +Style/ConstantName:
  196 + Exclude:
  197 + - 'app/models/notification_service.rb'
  198 + - 'app/models/notification_services/campfire_service.rb'
  199 + - 'app/models/notification_services/flowdock_service.rb'
  200 + - 'app/models/notification_services/gtalk_service.rb'
  201 + - 'app/models/notification_services/hipchat_service.rb'
  202 + - 'app/models/notification_services/hoiio_service.rb'
  203 + - 'app/models/notification_services/hubot_service.rb'
  204 + - 'app/models/notification_services/pushover_service.rb'
  205 + - 'app/models/notification_services/slack_service.rb'
  206 + - 'app/models/notification_services/webhook_service.rb'
  207 +
  208 +# Offense count: 11
  209 +# Cop supports --auto-correct.
  210 +Style/DeprecatedHashMethods:
  211 + Exclude:
  212 + - 'lib/airbrake_api/v3/notice_parser.rb'
  213 + - 'lib/hoptoad/v2.rb'
  214 + - 'spec/lib/airbrake_api/v3/notice_parser_spec.rb'
  215 +
  216 +# Offense count: 70
  217 +# Configuration parameters: Exclude.
  218 +Style/Documentation:
  219 + Enabled: false
  220 +
  221 +# Offense count: 7
  222 +# Cop supports --auto-correct.
  223 +# Configuration parameters: EnforcedStyle, SupportedStyles.
  224 +Style/DotPosition:
  225 + Enabled: false
  226 +
  227 +# Offense count: 6
  228 +Style/DoubleNegation:
  229 + Exclude:
  230 + - 'Gemfile'
  231 + - 'app/controllers/apps_controller.rb'
  232 + - 'app/helpers/apps_helper.rb'
  233 + - 'app/models/app.rb'
  234 +
  235 +# Offense count: 5
  236 +Style/EachWithObject:
  237 + Exclude:
  238 + - 'app/decorators/issue_tracker_type_decorator.rb'
  239 + - 'app/helpers/application_helper.rb'
  240 + - 'app/models/notice.rb'
  241 + - 'app/models/notice_fingerprinter.rb'
  242 + - 'lib/recurse.rb'
  243 +
  244 +# Offense count: 14
  245 +# Cop supports --auto-correct.
  246 +# Configuration parameters: AllowAdjacentOneLineDefs.
  247 +Style/EmptyLineBetweenDefs:
  248 + Exclude:
  249 + - 'app/controllers/apps_controller.rb'
  250 + - 'app/controllers/users_controller.rb'
  251 + - 'app/models/notification_service.rb'
  252 + - 'spec/decorators/issue_tracker_decorator_spec.rb'
  253 + - 'spec/decorators/issue_tracker_type_decorator_spec.rb'
  254 + - 'spec/views/problems/show.html.haml_spec.rb'
  255 +
  256 +# Offense count: 13
  257 +# Cop supports --auto-correct.
  258 +Style/EmptyLines:
  259 + Exclude:
  260 + - 'app/controllers/api/v1/stats_controller.rb'
  261 + - 'app/controllers/application_controller.rb'
  262 + - 'app/decorators/issue_tracker_field_decorator.rb'
  263 + - 'app/models/app.rb'
  264 + - 'app/models/problem.rb'
  265 + - 'config/deploy/production.example.rb'
  266 + - 'lib/tasks/errbit/demo.rake'
  267 + - 'script/rspec-queue-mongoid.rb'
  268 + - 'spec/acceptance/app_regenerate_api_key_spec.rb'
  269 +
  270 +# Offense count: 9
  271 +# Cop supports --auto-correct.
  272 +Style/EmptyLinesAroundAccessModifier:
  273 + Exclude:
  274 + - 'app/controllers/apps_controller.rb'
  275 + - 'app/controllers/comments_controller.rb'
  276 + - 'app/decorators/backtrace_line_decorator.rb'
  277 + - 'app/helpers/application_helper.rb'
  278 + - 'app/models/backtrace.rb'
  279 + - 'app/models/comment.rb'
  280 + - 'lib/hoptoad.rb'
  281 + - 'lib/hoptoad/v2.rb'
  282 + - 'lib/overrides/hoptoad_notifier/hoptoad_notifier.rb'
  283 +
  284 +# Offense count: 28
  285 +# Cop supports --auto-correct.
  286 +# Configuration parameters: EnforcedStyle, SupportedStyles.
  287 +Style/EmptyLinesAroundBlockBody:
  288 + Enabled: false
  289 +
  290 +# Offense count: 26
  291 +# Cop supports --auto-correct.
  292 +# Configuration parameters: EnforcedStyle, SupportedStyles.
  293 +Style/EmptyLinesAroundClassBody:
  294 + Enabled: false
  295 +
  296 +# Offense count: 2
  297 +# Cop supports --auto-correct.
  298 +Style/EmptyLinesAroundMethodBody:
  299 + Exclude:
  300 + - 'app/models/notification_services/hoiio_service.rb'
  301 + - 'app/models/notification_services/pushover_service.rb'
  302 +
  303 +# Offense count: 9
  304 +# Cop supports --auto-correct.
  305 +# Configuration parameters: EnforcedStyle, SupportedStyles.
  306 +Style/EmptyLinesAroundModuleBody:
  307 + Exclude:
  308 + - 'app/helpers/application_helper.rb'
  309 + - 'app/helpers/form_helper.rb'
  310 + - 'app/helpers/hash_helper.rb'
  311 + - 'app/helpers/navigation_helper.rb'
  312 + - 'app/helpers/sort_helper.rb'
  313 +
  314 +# Offense count: 22
  315 +# Cop supports --auto-correct.
  316 +# Configuration parameters: AllowForAlignment.
  317 +Style/ExtraSpacing:
  318 + Enabled: false
  319 +
  320 +# Offense count: 2
  321 +# Configuration parameters: Exclude.
  322 +Style/FileName:
  323 + Exclude:
  324 + - 'config/initializers/cve-2013-0156.rb'
  325 + - 'script/rspec-queue-mongoid.rb'
  326 +
  327 +# Offense count: 4
  328 +# Cop supports --auto-correct.
  329 +# Configuration parameters: EnforcedStyle, SupportedStyles.
  330 +Style/FirstParameterIndentation:
  331 + Exclude:
  332 + - 'app/models/issue_tracker.rb'
  333 + - 'spec/decorators/backtrace_decorator_spec.rb'
  334 + - 'spec/decorators/issue_tracker_type_decorator_spec.rb'
  335 +
  336 +# Offense count: 8
  337 +# Configuration parameters: EnforcedStyle, SupportedStyles.
  338 +Style/FormatString:
  339 + Exclude:
  340 + - 'app/decorators/backtrace_line_decorator.rb'
  341 + - 'app/helpers/problems_helper.rb'
  342 + - 'spec/views/apps/edit.html.haml_spec.rb'
  343 + - 'spec/views/problems/show.html.haml_spec.rb'
  344 + - 'spec/views/users/show.html.haml_spec.rb'
  345 +
  346 +# Offense count: 27
  347 +# Configuration parameters: MinBodyLength.
  348 +Style/GuardClause:
  349 + Enabled: false
  350 +
  351 +# Offense count: 1168
  352 +# Cop supports --auto-correct.
  353 +# Configuration parameters: EnforcedStyle, SupportedStyles, UseHashRocketsWithSymbolValues.
  354 +Style/HashSyntax:
  355 + Enabled: false
  356 +
  357 +# Offense count: 6
  358 +# Cop supports --auto-correct.
  359 +# Configuration parameters: MaxLineLength.
  360 +Style/IfUnlessModifier:
  361 + Exclude:
  362 + - 'app/controllers/api/v1/stats_controller.rb'
  363 + - 'app/controllers/application_controller.rb'
  364 + - 'app/controllers/problems_controller.rb'
  365 + - 'app/models/notice.rb'
  366 + - 'app/models/user.rb'
  367 +
  368 +# Offense count: 5
  369 +# Cop supports --auto-correct.
  370 +Style/IndentArray:
  371 + Exclude:
  372 + - 'app/models/notification_services/gtalk_service.rb'
  373 + - 'app/models/notification_services/hoiio_service.rb'
  374 + - 'app/models/notification_services/pushover_service.rb'
  375 + - 'app/models/notification_services/slack_service.rb'
  376 + - 'spec/models/notification_service/slack_service_spec.rb'
  377 +
  378 +# Offense count: 72
  379 +# Cop supports --auto-correct.
  380 +# Configuration parameters: EnforcedStyle, SupportedStyles.
  381 +Style/IndentHash:
  382 + Enabled: false
  383 +
  384 +# Offense count: 27
  385 +# Cop supports --auto-correct.
  386 +# Configuration parameters: EnforcedStyle, SupportedStyles.
  387 +Style/IndentationConsistency:
  388 + Exclude:
  389 + - 'app/controllers/apps_controller.rb'
  390 + - 'app/controllers/comments_controller.rb'
  391 + - 'app/controllers/deploys_controller.rb'
  392 + - 'app/controllers/users_controller.rb'
  393 + - 'app/helpers/application_helper.rb'
  394 + - 'app/models/app.rb'
  395 + - 'app/models/comment.rb'
  396 + - 'app/models/deploy.rb'
  397 + - 'app/models/problem.rb'
  398 + - 'app/models/watcher.rb'
  399 + - 'lib/hoptoad.rb'
  400 +
  401 +# Offense count: 1
  402 +# Cop supports --auto-correct.
  403 +# Configuration parameters: Width.
  404 +Style/IndentationWidth:
  405 + Exclude:
  406 + - 'app/controllers/notices_controller.rb'
  407 +
  408 +# Offense count: 6
  409 +# Cop supports --auto-correct.
  410 +Style/Lambda:
  411 + Exclude:
  412 + - 'app/models/app.rb'
  413 + - 'app/models/problem.rb'
  414 + - 'config/load.rb'
  415 + - 'spec/models/notice_observer_spec.rb'
  416 +
  417 +# Offense count: 17
  418 +# Cop supports --auto-correct.
  419 +Style/LeadingCommentSpace:
  420 + Exclude:
  421 + - 'app/models/notification_services/gtalk_service.rb'
  422 + - 'spec/controllers/api/v1/notices_controller_spec.rb'
  423 + - 'spec/controllers/api/v1/problems_controller_spec.rb'
  424 + - 'spec/models/fabricators_spec.rb'
  425 + - 'spec/models/notification_service/campfire_service_spec.rb'
  426 + - 'spec/models/notification_service/gtalk_service_spec.rb'
  427 + - 'spec/models/notification_service/hoiio_service_spec.rb'
  428 + - 'spec/models/notification_service/pushover_service_spec.rb'
  429 +
  430 +# Offense count: 6
  431 +# Cop supports --auto-correct.
  432 +Style/MethodCallParentheses:
  433 + Exclude:
  434 + - 'spec/controllers/api/v1/notices_controller_spec.rb'
  435 + - 'spec/controllers/api/v1/problems_controller_spec.rb'
  436 +
  437 +# Offense count: 3
  438 +# Cop supports --auto-correct.
  439 +# Configuration parameters: EnforcedStyle, SupportedStyles.
  440 +Style/MethodDefParentheses:
  441 + Enabled: false
  442 +
  443 +# Offense count: 7
  444 +# Cop supports --auto-correct.
  445 +Style/MultilineBlockLayout:
  446 + Exclude:
  447 + - 'lib/tasks/errbit/demo.rake'
  448 + - 'spec/fabricators/issue_tracker_fabricator.rb'
  449 + - 'spec/interactors/user_destroy_spec.rb'
  450 + - 'spec/models/app_spec.rb'
  451 + - 'spec/models/error_report_spec.rb'
  452 + - 'spec/views/apps/show.atom.builder_spec.rb'
  453 +
  454 +# Offense count: 10
  455 +# Cop supports --auto-correct.
  456 +# Configuration parameters: EnforcedStyle, SupportedStyles.
  457 +Style/MultilineOperationIndentation:
  458 + Enabled: false
  459 +
  460 +# Offense count: 1
  461 +# Cop supports --auto-correct.
  462 +Style/NegatedIf:
  463 + Exclude:
  464 + - 'app/controllers/apps_controller.rb'
  465 +
  466 +# Offense count: 2
  467 +# Cop supports --auto-correct.
  468 +Style/ParallelAssignment:
  469 + Exclude:
  470 + - 'app/models/problem.rb'
  471 + - 'spec/models/app_spec.rb'
  472 +
  473 +# Offense count: 5
  474 +# Cop supports --auto-correct.
  475 +# Configuration parameters: PreferredDelimiters.
  476 +Style/PercentLiteralDelimiters:
  477 + Exclude:
  478 + - 'app/controllers/api/v1/notices_controller.rb'
  479 + - 'app/controllers/api/v1/problems_controller.rb'
  480 + - 'app/controllers/problems_searcher.rb'
  481 + - 'spec/models/notice_spec.rb'
  482 +
  483 +# Offense count: 1
  484 +# Cop supports --auto-correct.
  485 +Style/PerlBackrefs:
  486 + Exclude:
  487 + - 'spec/acceptance/reset_password_token.rb'
  488 +
  489 +# Offense count: 3
  490 +# Cop supports --auto-correct.
  491 +Style/Proc:
  492 + Exclude:
  493 + - 'app/models/notice.rb'
  494 + - 'app/models/problem.rb'
  495 +
  496 +# Offense count: 2
  497 +# Configuration parameters: SupportedStyles.
  498 +Style/RaiseArgs:
  499 + EnforcedStyle: compact
  500 +
  501 +# Offense count: 13
  502 +# Cop supports --auto-correct.
  503 +Style/RedundantSelf:
  504 + Exclude:
  505 + - 'app/models/app.rb'
  506 + - 'app/models/issue_tracker.rb'
  507 + - 'app/models/notification_service.rb'
  508 + - 'app/models/problem.rb'
  509 + - 'lib/configurator.rb'
  510 +
  511 +# Offense count: 3
  512 +# Cop supports --auto-correct.
  513 +# Configuration parameters: EnforcedStyle, SupportedStyles, AllowInnerSlashes.
  514 +Style/RegexpLiteral:
  515 + Exclude:
  516 + - 'app/models/app.rb'
  517 + - 'config/initializers/ssl_enforcer.rb'
  518 + - 'config/load.rb'
  519 +
  520 +# Offense count: 2
  521 +# Cop supports --auto-correct.
  522 +# Configuration parameters: AllowAsExpressionSeparator.
  523 +Style/Semicolon:
  524 + Exclude:
  525 + - 'app/decorators/issue_tracker_type_decorator.rb'
  526 + - 'app/models/notice_fingerprinter.rb'
  527 +
  528 +# Offense count: 6
  529 +# Cop supports --auto-correct.
  530 +# Configuration parameters: EnforcedStyle, SupportedStyles.
  531 +Style/SignalException:
  532 + Exclude:
  533 + - 'app/controllers/notices_controller.rb'
  534 + - 'app/interactors/problem_merge.rb'
  535 + - 'app/models/problem.rb'
  536 + - 'lib/airbrake_api/v3/notice_parser.rb'
  537 + - 'lib/hoptoad.rb'
  538 +
  539 +# Offense count: 4
  540 +# Configuration parameters: Methods.
  541 +Style/SingleLineBlockParams:
  542 + Exclude:
  543 + - 'app/helpers/application_helper.rb'
  544 + - 'app/helpers/form_helper.rb'
  545 + - 'app/models/notice_fingerprinter.rb'
  546 + - 'lib/hoptoad/v2.rb'
  547 +
  548 +# Offense count: 19
  549 +# Cop supports --auto-correct.
  550 +# Configuration parameters: AllowIfMethodIsEmpty.
  551 +Style/SingleLineMethods:
  552 + Exclude:
  553 + - 'app/models/notification_service.rb'
  554 + - 'spec/decorators/issue_tracker_decorator_spec.rb'
  555 + - 'spec/decorators/issue_tracker_type_decorator_spec.rb'
  556 + - 'spec/errbit_plugin/mock_issue_tracker.rb'
  557 + - 'spec/views/problems/show.html.haml_spec.rb'
  558 +
  559 +# Offense count: 11
  560 +# Cop supports --auto-correct.
  561 +Style/SingleSpaceBeforeFirstArg:
  562 + Exclude:
  563 + - 'app/models/comment.rb'
  564 + - 'config/application.rb'
  565 + - 'spec/fabricators/app_fabricator.rb'
  566 + - 'spec/fabricators/comment_fabricator.rb'
  567 + - 'spec/fabricators/notice_fabricator.rb'
  568 + - 'spec/fabricators/user_fabricator.rb'
  569 +
  570 +# Offense count: 43
  571 +# Cop supports --auto-correct.
  572 +Style/SpaceAfterComma:
  573 + Enabled: false
  574 +
  575 +# Offense count: 2
  576 +# Cop supports --auto-correct.
  577 +# Configuration parameters: EnforcedStyle, SupportedStyles.
  578 +Style/SpaceAroundEqualsInParameterDefault:
  579 + Enabled: false
  580 +
  581 +# Offense count: 28
  582 +# Cop supports --auto-correct.
  583 +# Configuration parameters: MultiSpaceAllowedForOperators.
  584 +Style/SpaceAroundOperators:
  585 + Exclude:
  586 + - 'app/controllers/api/v1/problems_controller.rb'
  587 + - 'app/helpers/application_helper.rb'
  588 + - 'app/helpers/apps_helper.rb'
  589 + - 'app/helpers/hash_helper.rb'
  590 + - 'app/models/issue_tracker.rb'
  591 + - 'app/models/notification_service.rb'
  592 + - 'config/load.rb'
  593 + - 'spec/controllers/problems_controller_spec.rb'
  594 + - 'spec/models/notice_observer_spec.rb'
  595 +
  596 +# Offense count: 27
  597 +# Cop supports --auto-correct.
  598 +# Configuration parameters: EnforcedStyle, SupportedStyles.
  599 +Style/SpaceBeforeBlockBraces:
  600 + Enabled: false
  601 +
  602 +# Offense count: 1
  603 +# Cop supports --auto-correct.
  604 +Style/SpaceBeforeComma:
  605 + Exclude:
  606 + - 'app/decorators/backtrace_line_decorator.rb'
  607 +
  608 +# Offense count: 3
  609 +# Cop supports --auto-correct.
  610 +Style/SpaceBeforeComment:
  611 + Exclude:
  612 + - 'spec/controllers/api/v1/problems_controller_spec.rb'
  613 +
  614 +# Offense count: 75
  615 +# Cop supports --auto-correct.
  616 +# Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
  617 +Style/SpaceInsideBlockBraces:
  618 + Enabled: false
  619 +
  620 +# Offense count: 26
  621 +# Cop supports --auto-correct.
  622 +Style/SpaceInsideBrackets:
  623 + Exclude:
  624 + - 'app/helpers/apps_helper.rb'
  625 + - 'app/models/issue.rb'
  626 + - 'app/models/notice_fingerprinter.rb'
  627 + - 'app/models/notification_services/gtalk_service.rb'
  628 + - 'config/initializers/devise.rb'
  629 + - 'lib/tasks/errbit/database.rake'
  630 + - 'spec/lib/configurator_spec.rb'
  631 + - 'spec/models/issue_spec.rb'
  632 +
  633 +# Offense count: 189
  634 +# Cop supports --auto-correct.
  635 +# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SupportedStyles.
  636 +Style/SpaceInsideHashLiteralBraces:
  637 + Enabled: false
  638 +
  639 +# Offense count: 23
  640 +# Cop supports --auto-correct.
  641 +Style/SpaceInsideParens:
  642 + Exclude:
  643 + - 'spec/controllers/api/v1/problems_controller_spec.rb'
  644 + - 'spec/controllers/comments_controller_spec.rb'
  645 + - 'spec/controllers/problems_controller_spec.rb'
  646 + - 'spec/interactors/problem_merge_spec.rb'
  647 + - 'spec/mailers/mailer_spec.rb'
  648 + - 'spec/models/notice_observer_spec.rb'
  649 + - 'spec/models/notice_spec.rb'
  650 +
  651 +# Offense count: 9
  652 +# Cop supports --auto-correct.
  653 +# Configuration parameters: EnforcedStyle, SupportedStyles.
  654 +Style/SpaceInsideStringInterpolation:
  655 + Exclude:
  656 + - 'app/models/issue.rb'
  657 + - 'app/models/notification_service.rb'
  658 + - 'app/models/notification_services/flowdock_service.rb'
  659 + - 'app/models/notification_services/hoiio_service.rb'
  660 + - 'spec/controllers/problems_controller_spec.rb'
  661 +
  662 +# Offense count: 873
  663 +# Cop supports --auto-correct.
  664 +# Configuration parameters: EnforcedStyle, SupportedStyles.
  665 +Style/StringLiterals:
  666 + Enabled: false
  667 +
  668 +# Offense count: 1
  669 +# Cop supports --auto-correct.
  670 +# Configuration parameters: EnforcedStyle, SupportedStyles.
  671 +Style/StringLiteralsInInterpolation:
  672 + Enabled: false
  673 +
  674 +# Offense count: 3
  675 +# Cop supports --auto-correct.
  676 +# Configuration parameters: IgnoredMethods.
  677 +Style/SymbolProc:
  678 + Exclude:
  679 + - 'app/controllers/users/omniauth_callbacks_controller.rb'
  680 + - 'app/models/deploy.rb'
  681 + - 'spec/models/deploy_spec.rb'
  682 +
  683 +# Offense count: 21
  684 +# Cop supports --auto-correct.
  685 +# Configuration parameters: EnforcedStyle, SupportedStyles.
  686 +Style/TrailingBlankLines:
  687 + Enabled: false
  688 +
  689 +# Offense count: 13
  690 +# Cop supports --auto-correct.
  691 +# Configuration parameters: EnforcedStyleForMultiline, SupportedStyles.
  692 +Style/TrailingComma:
  693 + Exclude:
  694 + - 'app/controllers/deploys_controller.rb'
  695 + - 'app/helpers/problems_helper.rb'
  696 + - 'app/models/notification_services/hipchat_service.rb'
  697 + - 'app/models/problem.rb'
  698 + - 'config/deploy.example.rb'
  699 + - 'config/initializers/action_mailer.rb'
  700 + - 'config/load.rb'
  701 + - 'lib/tasks/errbit/demo.rake'
  702 + - 'spec/decorators/issue_tracker_type_decorator_spec.rb'
  703 + - 'spec/initializers/action_mailer_spec.rb'
  704 + - 'spec/initializers/devise_spec.rb'
  705 +
  706 +# Offense count: 9
  707 +# Cop supports --auto-correct.
  708 +Style/TrailingWhitespace:
  709 + Exclude:
  710 + - 'app/models/notification_service.rb'
  711 + - 'app/models/notification_services/gtalk_service.rb'
  712 + - 'config/initializers/cve-2013-0156.rb'
  713 +
  714 +# Offense count: 2
  715 +Style/UnlessElse:
  716 + Exclude:
  717 + - 'app/controllers/problems_searcher.rb'
  718 +
  719 +# Offense count: 1
  720 +# Cop supports --auto-correct.
  721 +Style/UnneededPercentQ:
  722 + Exclude:
  723 + - 'spec/models/notice_spec.rb'
  724 +
  725 +# Offense count: 6
  726 +# Cop supports --auto-correct.
  727 +Style/WhenThen:
  728 + Exclude:
  729 + - 'app/models/problem.rb'
  730 + - 'lib/hoptoad.rb'
  731 +
  732 +# Offense count: 10
  733 +# Cop supports --auto-correct.
  734 +# Configuration parameters: WordRegex.
  735 +Style/WordArray:
  736 + MinSize: 11
... ...
.travis.yml
... ... @@ -15,7 +15,9 @@ before_script:
15 15 - mkdir /tmp/data
16 16 - ${PWD}/mongodb-linux-x86_64-2.6.10/bin/mongod --dbpath /tmp/data --bind_ip 127.0.0.1 --auth &> /dev/null &
17 17 - bundle exec rake errbit:bootstrap
18   -script: bundle exec rspec
  18 +script:
  19 + - bundle exec rspec
  20 + - bundle exec rubocop --lint
19 21 matrix:
20 22 allow_failures:
21 23 - rvm: rbx-2
... ...
Gemfile
... ... @@ -68,6 +68,7 @@ group :development, :test do
68 68 gem 'pry-rails'
69 69 gem 'pry-byebug', platforms: [:mri]
70 70 gem 'quiet_assets'
  71 + gem 'rubocop', require: false
71 72 end
72 73  
73 74 group :development do
... ...
Gemfile.lock
... ... @@ -45,6 +45,9 @@ GEM
45 45 builder
46 46 multi_json
47 47 arel (6.0.3)
  48 + ast (2.1.0)
  49 + astrolabe (1.3.1)
  50 + parser (~> 2.2)
48 51 bcrypt (3.1.10)
49 52 bcrypt (3.1.10-java)
50 53 better_errors (2.1.1)
... ... @@ -226,6 +229,8 @@ GEM
226 229 omniauth (~> 1.2)
227 230 origin (2.1.1)
228 231 orm_adapter (0.5.0)
  232 + parser (2.2.3.0)
  233 + ast (>= 1.1, < 3.0)
229 234 pjax_rails (0.4.0)
230 235 jquery-rails
231 236 railties (>= 3.2, < 5.0)
... ... @@ -235,6 +240,7 @@ GEM
235 240 multi_json (~> 1.0)
236 241 websocket-driver (>= 0.2.0)
237 242 power_assert (0.2.3)
  243 + powerpack (0.1.1)
238 244 premailer (1.8.4)
239 245 css_parser (>= 1.3.6)
240 246 htmlentities (>= 4.0.0)
... ... @@ -293,6 +299,7 @@ GEM
293 299 activesupport (= 4.2.3)
294 300 rake (>= 0.8.7)
295 301 thor (>= 0.18.1, < 2.0)
  302 + rainbow (2.0.0)
296 303 raindrops (0.13.0)
297 304 rake (10.4.2)
298 305 ref (1.0.5)
... ... @@ -332,6 +339,13 @@ GEM
332 339 rspec-mocks (~> 3.3.0)
333 340 rspec-support (~> 3.3.0)
334 341 rspec-support (3.3.0)
  342 + rubocop (0.34.2)
  343 + astrolabe (~> 1.3)
  344 + parser (>= 2.2.2.5, < 3.0)
  345 + powerpack (~> 0.1)
  346 + rainbow (>= 1.99.1, < 3.0)
  347 + ruby-progressbar (~> 1.4)
  348 + ruby-progressbar (1.7.5)
335 349 rushover (0.3.0)
336 350 json
337 351 rest-client
... ... @@ -461,6 +475,7 @@ DEPENDENCIES
461 475 rspec-activemodel-mocks
462 476 rspec-its
463 477 rspec-rails (~> 3.0)
  478 + rubocop
464 479 rushover
465 480 sass-rails
466 481 test-unit
... ... @@ -472,3 +487,6 @@ DEPENDENCIES
472 487 useragent
473 488 xmpp4r
474 489 yajl-ruby
  490 +
  491 +BUNDLED WITH
  492 + 1.10.6
... ...
Rakefile
... ... @@ -10,5 +10,5 @@ begin
10 10 RSpec::Core::RakeTask.new(:spec)
11 11 task :default => :spec
12 12 rescue LoadError
13   - # no rspec available
  13 + warn "Notice: no rspec tasks available in this environment"
14 14 end
... ...
app/controllers/api/v1/stats_controller.rb
... ... @@ -6,7 +6,7 @@ class Api::V1::StatsController &lt; ApplicationController
6 6 before_action :require_api_key_or_authenticate_user!
7 7  
8 8 def app
9   - if problem = @app.problems.order_by(:last_notice_at.desc).first
  9 + if (problem = @app.problems.order_by(:last_notice_at.desc).first)
10 10 @last_error_time = problem.last_notice_at
11 11 end
12 12  
... ... @@ -28,7 +28,7 @@ class Api::V1::StatsController &lt; ApplicationController
28 28  
29 29 def require_api_key_or_authenticate_user!
30 30 if params[:api_key].present?
31   - if @app = App.where(:api_key => params[:api_key]).first
  31 + if (@app = App.where(:api_key => params[:api_key]).first)
32 32 return true
33 33 end
34 34 end
... ...
app/controllers/apps_controller.rb
... ... @@ -94,7 +94,7 @@ class AppsController &lt; ApplicationController
94 94  
95 95 def initialize_subclassed_notification_service
96 96 # set the app's notification service
97   - if params[:app][:notification_service_attributes] && notification_type = params[:app][:notification_service_attributes][:type]
  97 + if params[:app][:notification_service_attributes] && (notification_type = params[:app][:notification_service_attributes][:type])
98 98 available_notification_classes = [NotificationService] + NotificationService.subclasses
99 99 notification_class = available_notification_classes.detect{|c| c.name == notification_type}
100 100 if !notification_class.nil?
... ... @@ -112,7 +112,7 @@ class AppsController &lt; ApplicationController
112 112  
113 113 # email_at_notices is edited as a string, and stored as an array.
114 114 def parse_email_at_notices_or_set_default
115   - if params[:app] && val = params[:app][:email_at_notices]
  115 + if params[:app] && (val = params[:app][:email_at_notices])
116 116 # Sanitize negative values, split on comma,
117 117 # strip, parse as integer, remove all '0's.
118 118 # If empty, set as default and show an error message.
... ... @@ -127,7 +127,7 @@ class AppsController &lt; ApplicationController
127 127 end
128 128  
129 129 def parse_notice_at_notices_or_set_default
130   - if params[:app][:notification_service_attributes] && val = params[:app][:notification_service_attributes][:notify_at_notices]
  130 + if params[:app][:notification_service_attributes] && (val = params[:app][:notification_service_attributes][:notify_at_notices])
131 131 # Sanitize negative values, split on comma,
132 132 # strip, parse as integer, remove all '0's.
133 133 # If empty, set as default and show an error message.
... ...
app/controllers/problems_controller.rb
... ... @@ -128,7 +128,6 @@ class ProblemsController &lt; ApplicationController
128 128  
129 129 def search
130 130 ps = Problem.search(params[:search]).for_apps(app_scope).in_env(params[:environment]).all_else_unresolved(params[:all_errs]).ordered_by(params_sort, params_order)
131   - selected_problems = params[:problems] || []
132 131 self.problems = ps.page(params[:page]).per(current_user.per_page)
133 132 respond_to do |format|
134 133 format.html { render :index }
... ...
app/controllers/users/omniauth_callbacks_controller.rb
... ... @@ -5,7 +5,7 @@ class Users::OmniauthCallbacksController &lt; Devise::OmniauthCallbacksController
5 5 github_user = User.where(:github_login => github_login).first
6 6 github_site_title = Errbit::Config.github_site_title
7 7  
8   - if github_user.nil? && github_org_id = Errbit::Config.github_org_id
  8 + if github_user.nil? && (github_org_id = Errbit::Config.github_org_id)
9 9 # See if they are a member of the organization that we have access for
10 10 # If they are, automatically create an account
11 11 client = Octokit::Client.new(access_token: github_token)
... ...
app/helpers/application_helper.rb
... ... @@ -7,7 +7,7 @@ module ApplicationHelper
7 7 RiCal.Calendar do |cal|
8 8 notices.each_with_index do |notice,idx|
9 9 cal.event do |event|
10   - event.summary = "#{idx+1} #{notice.message.to_s}"
  10 + event.summary = "#{idx+1} #{notice.message}"
11 11 event.description = notice.url if notice.url
12 12 event.dtstart = notice.created_at.utc
13 13 event.dtend = notice.created_at.utc + 60.minutes
... ... @@ -23,7 +23,7 @@ module ApplicationHelper
23 23 RiCal.Calendar { |cal|
24 24 deploys.each_with_index do |deploy,idx|
25 25 cal.event do |event|
26   - event.summary = "#{idx+1} #{deploy.repository.to_s}"
  26 + event.summary = "#{idx+1} #{deploy.repository}"
27 27 event.description = deploy.revision.to_s
28 28 event.dtstart = deploy.created_at.utc
29 29 event.dtend = deploy.created_at.utc + 60.minutes
... ...
app/helpers/form_helper.rb
... ... @@ -5,8 +5,8 @@ module FormHelper
5 5  
6 6 content_tag(:div, :class => 'error-messages') do
7 7 body = content_tag(:h2, 'Dang. The following errors are keeping this from being a success.')
8   - body += content_tag(:ul) do
9   - document.errors.full_messages.inject('') {|errs, msg| errs += content_tag(:li, h(msg)) }.html_safe
  8 + body + content_tag(:ul) do
  9 + document.errors.full_messages.inject('') {|errs, msg| errs + content_tag(:li, h(msg)) }.html_safe
10 10 end
11 11 end
12 12 end
... ...
app/helpers/problems_helper.rb
... ... @@ -23,7 +23,7 @@ module ProblemsHelper
23 23 :d => Errbit::Config.gravatar_default,
24 24 }
25 25 options.reverse_merge! default_options
26   - params = options.extract!(:s, :d).delete_if { |k, v| v.blank? }
  26 + params = options.extract!(:s, :d).delete_if { |_k, v| v.blank? }
27 27 email_hash = Digest::MD5.hexdigest(email)
28 28 url = request.ssl? ? "https://secure.gravatar.com" : "http://www.gravatar.com"
29 29 "#{url}/avatar/#{email_hash}?#{params.to_query}"
... ...
app/models/app.rb
... ... @@ -153,14 +153,14 @@ class App
153 153  
154 154 # Copy app attributes from another app.
155 155 def copy_attributes_from(app_id)
156   - if copy_app = App.where(:_id => app_id).first
  156 + if (copy_app = App.where(:_id => app_id).first)
157 157 # Copy fields
158 158 (copy_app.fields.keys - %w(_id name created_at updated_at)).each do |k|
159 159 self.send("#{k}=", copy_app.send(k))
160 160 end
161 161 # Clone the embedded objects that can be changed via apps/edit (ignore errs & deploys, etc.)
162 162 %w(watchers issue_tracker notification_service).each do |relation|
163   - if obj = copy_app.send(relation)
  163 + if (obj = copy_app.send(relation))
164 164 self.send("#{relation}=", obj.is_a?(Array) ? obj.map(&:clone) : obj.clone)
165 165 end
166 166 end
... ...
app/models/notice.rb
... ... @@ -82,7 +82,7 @@ class Notice
82 82 def to_curl
83 83 return "N/A" if url.blank?
84 84 headers = %w(Accept Accept-Encoding Accept-Language Cookie Referer User-Agent).each_with_object([]) do |name, h|
85   - if value = env_vars["HTTP_#{name.underscore.upcase}"]
  85 + if (value = env_vars["HTTP_#{name.underscore.upcase}"])
86 86 h << "-H '#{name}: #{value}'"
87 87 end
88 88 end
... ... @@ -136,9 +136,9 @@ class Notice
136 136 end
137 137 end
138 138  
139   - def sanitize_hash(h)
140   - h.recurse do |h|
141   - h.inject({}) do |h,(k,v)|
  139 + def sanitize_hash(hash)
  140 + hash.recurse do |recurse_hash|
  141 + recurse_hash.inject({}) do |h,(k,v)|
142 142 if k.is_a?(String)
143 143 h[k.gsub(/\./,'&#46;').gsub(/^\$/,'&#36;')] = v
144 144 else
... ...
app/models/notification_services/campfire_service.rb
... ... @@ -30,7 +30,7 @@ if defined? Campy
30 30 # build the campfire client
31 31 campy = Campy::Room.new(:account => subdomain, :token => api_token, :room_id => room_id)
32 32 # post the issue to the campfire room
33   - campy.speak "[errbit] #{problem.app.name} #{notification_description problem} - #{Errbit::Config.protocol}://#{Errbit::Config.host}/apps/#{problem.app.id.to_s}/problems/#{problem.id.to_s}"
  33 + campy.speak "[errbit] #{problem.app.name} #{notification_description problem} - #{Errbit::Config.protocol}://#{Errbit::Config.host}/apps/#{problem.app.id}/problems/#{problem.id}"
34 34 end
35 35 end
36 36 end
... ...
app/models/notification_services/flowdock_service.rb
... ... @@ -31,11 +31,11 @@ if defined? Flowdock
31 31  
32 32 # can only contain alphanumeric characters and underscores
33 33 def project_name(problem)
34   - problem.app.name.gsub /[^0-9a-z_]/i, ''
  34 + problem.app.name.gsub(/[^0-9a-z_]/i, '')
35 35 end
36 36  
37 37 def content(problem, url)
38   - full_description = "[#{ problem.environment }][#{ problem.where }] #{problem.message.to_s}"
  38 + full_description = "[#{ problem.environment }][#{ problem.where }] #{problem.message}"
39 39 <<-MSG.strip_heredoc
40 40 #{ERB::Util.html_escape full_description}<br>
41 41 <a href="#{url}">#{url}</a>
... ...
app/models/notification_services/gtalk_service.rb
... ... @@ -46,8 +46,8 @@ class NotificationServices::GtalkService &lt; NotificationService
46 46 client.auth(api_token)
47 47  
48 48 #has to look like this to be formatted properly in the client
49   - message = """#{problem.app.name.to_s}
50   -#{Errbit::Config.protocol}://#{Errbit::Config.host}/apps/#{problem.app.id.to_s}
  49 + message = """#{problem.app.name}
  50 +#{Errbit::Config.protocol}://#{Errbit::Config.host}/apps/#{problem.app.id}
51 51 #{notification_description problem}"""
52 52  
53 53 # post the issue to the xmpp room(s)
... ...
app/models/notification_services/hoiio_service.rb
... ... @@ -35,7 +35,7 @@ class NotificationServices::HoiioService &lt; NotificationService
35 35  
36 36 # send sms
37 37 room_id.split(',').each do |number|
38   - sms.send :dest => number, :msg => "#{Errbit::Config.protocol}://#{Errbit::Config.host}/apps/#{problem.app.id.to_s} #{notification_description problem}"
  38 + sms.send :dest => number, :msg => "#{Errbit::Config.protocol}://#{Errbit::Config.host}/apps/#{problem.app.id} #{notification_description problem}"
39 39 end
40 40  
41 41 end
... ...
app/models/notification_services/pushover_service.rb
... ... @@ -26,7 +26,7 @@ class NotificationServices::PushoverService &lt; NotificationService
26 26 notification = Rushover::Client.new(subdomain)
27 27  
28 28 # send push notification to pushover
29   - notification.notify(api_token, "#{notification_description problem}", :priority => 1, :title => "Errbit Notification", :url => "#{Errbit::Config.protocol}://#{Errbit::Config.host}/apps/#{problem.app.id.to_s}", :url_title => "Link to error")
  29 + notification.notify(api_token, "#{notification_description problem}", :priority => 1, :title => "Errbit Notification", :url => "#{Errbit::Config.protocol}://#{Errbit::Config.host}/apps/#{problem.app.id}", :url_title => "Link to error")
30 30  
31 31 end
32 32 end
... ...
app/models/user.rb
... ... @@ -3,7 +3,7 @@ class User
3 3 include Mongoid::Document
4 4 include Mongoid::Timestamps
5 5  
6   - devise *Errbit::Config.devise_modules
  6 + devise(*Errbit::Config.devise_modules)
7 7  
8 8 field :email
9 9 field :github_login
... ...
config/boot.rb
... ... @@ -8,5 +8,5 @@ begin
8 8 # try to use Yajl, the json_gem compatibility layer must be loaded after json
9 9 require 'yajl/json_gem'
10 10 rescue LoadError
11   - # fail silently because json gem is fine
  11 + warn "JSON: unable to load Yajl; just using the json gem"
12 12 end
... ...
config/initializers/action_mailer.rb
... ... @@ -26,7 +26,7 @@ end
26 26 host: Errbit::Config.host,
27 27 port: Errbit::Config.port,
28 28 protocol: Errbit::Config.protocol
29   - }.select { |k, v| v }
  29 + }.select { |_k, v| v }
30 30  
31 31 default.reverse_merge!(options_from_config)
32 32 end
... ...
config/initializers/overrides.rb
1 1 require Rails.root.join('lib/overrides/hoptoad_notifier/hoptoad_notifier')
2 2  
3 3 class BSON::ObjectId
4   - def as_json(*args)
  4 + def as_json(*_args)
5 5 to_s
6 6 end
7 7 end
... ...
config/unicorn.default.rb
... ... @@ -8,7 +8,7 @@ pid ENV[&#39;UNICORN_PID&#39;] if ENV[&#39;UNICORN_PID&#39;]
8 8  
9 9 # Taken from github: https://github.com/blog/517-unicorn
10 10 # Though everyone uses pretty miuch the same code
11   -before_fork do |server, worker|
  11 +before_fork do |server, _worker|
12 12 ##
13 13 # When sent a USR2, Unicorn will suffix its pidfile with .oldbin and
14 14 # immediately start loading up a new version of itself (loaded with a new
... ... @@ -21,11 +21,11 @@ before_fork do |server, worker|
21 21 # Using this method we get 0 downtime deploys.
22 22  
23 23 old_pid = "#{server.config[:pid]}.oldbin"
24   - if File.exists?(old_pid) && server.pid != old_pid
  24 + if File.exist?(old_pid) && server.pid != old_pid
25 25 begin
26 26 Process.kill("QUIT", File.read(old_pid).to_i)
27 27 rescue Errno::ENOENT, Errno::ESRCH
28   - # someone else did our job for us
  28 + warn "Unicorn: master process already killed, no problem"
29 29 end
30 30 end
31 31 end
... ...
spec/controllers/users_controller_spec.rb
... ... @@ -31,7 +31,7 @@ describe UsersController, type: &#39;controller&#39; do
31 31 context "GET /users/:my_id/edit" do
32 32 it 'finds the user' do
33 33 get :edit, :id => user.id
34   - expect(controller.user).to eq user
  34 + expect(controller.user).to eq(user)
35 35 expect(response).to render_template 'edit'
36 36 end
37 37  
... ... @@ -234,12 +234,12 @@ describe UsersController, type: &#39;controller&#39; do
234 234 }
235 235 let(:user_param) { {'user' => { :name => 'foo', :admin => true }} }
236 236 it 'not have admin field' do
237   - expect(controller.send(:user_params)).to eq ({'name' => 'foo'})
  237 + expect(controller.send(:user_params)).to eq({'name' => 'foo'})
238 238 end
239 239 context "with password and password_confirmation empty?" do
240 240 let(:user_param) { {'user' => { :name => 'foo', 'password' => '', 'password_confirmation' => '' }} }
241 241 it 'not have password and password_confirmation field' do
242   - expect(controller.send(:user_params)).to eq ({'name' => 'foo'})
  242 + expect(controller.send(:user_params)).to eq({'name' => 'foo'})
243 243 end
244 244 end
245 245 end
... ...
spec/fabricators/app_fabricator.rb
... ... @@ -4,7 +4,7 @@ Fabricator(:app) do
4 4 end
5 5  
6 6 Fabricator(:app_with_watcher, :from => :app) do
7   - watchers(:count => 1) { |parent, i|
  7 + watchers(:count => 1) { |parent, _i|
8 8 Fabricate.build(:watcher, :app => parent)
9 9 }
10 10 end
... ...
spec/fabricators/notification_service_fabricator.rb
... ... @@ -3,7 +3,7 @@ Fabricator :notification_service do
3 3 room_id { sequence :word }
4 4 api_token { sequence :word }
5 5 subdomain { sequence :word }
6   - notify_at_notices { sequence { |a| [0]} }
  6 + notify_at_notices { sequence { |_a| [0]} }
7 7 end
8 8  
9 9 Fabricator :gtalk_notification_service, :from => :notification_service, :class_name => "NotificationServices::GtalkService" do
... ...
spec/interactors/problem_merge_spec.rb
... ... @@ -36,7 +36,7 @@ describe ProblemMerge do
36 36  
37 37 it 'move all err in one problem' do
38 38 problem_merge.merge
39   - expect(problem.reload.errs.map(&:id).sort).to eq (first_errs | merged_errs).map(&:id).sort
  39 + expect(problem.reload.errs.map(&:id).sort).to eq((first_errs | merged_errs).map(&:id).sort)
40 40 end
41 41  
42 42 it 'keeps the issue link' do
... ...
spec/lib/airbrake_api/v3/notice_parser_spec.rb
... ... @@ -42,7 +42,7 @@ describe AirbrakeApi::V3::NoticeParser do
42 42 params['key'] = app.api_key
43 43  
44 44 report = AirbrakeApi::V3::NoticeParser.new(params).report
45   - notice = report.generate_notice!
  45 + report.generate_notice!
46 46  
47 47 expect(report.error_class).to eq('Error')
48 48 expect(report.message).to eq('Error: TestError')
... ... @@ -58,4 +58,4 @@ describe AirbrakeApi::V3::NoticeParser do
58 58  
59 59 data
60 60 end
61   -end
62 61 \ No newline at end of file
  62 +end
... ...
spec/lib/configurator_spec.rb
... ... @@ -22,7 +22,7 @@ describe Configurator do
22 22  
23 23 it 'overrides existing variables' do
24 24 result = Configurator.run({
25   - one: ['VARONE', ->(values) { 'oveRIIIDE' } ]
  25 + one: ['VARONE', ->(_values) { 'oveRIIIDE' } ]
26 26 })
27 27 expect(result.one).to eq('oveRIIIDE')
28 28 end
... ...
spec/mailers/mailer_spec.rb
... ... @@ -85,7 +85,7 @@ describe Mailer do
85 85 end
86 86  
87 87 context 'with a very long message' do
88   - let(:notice) { Fabricate(:notice, :message => 6.times.collect{|a| "0123456789" }.join('')) }
  88 + let(:notice) { Fabricate(:notice, :message => 6.times.collect{|_a| "0123456789" }.join('')) }
89 89 it "should truncate the long message" do
90 90 expect(email.subject).to match( / \d{47}\.{3}$/ )
91 91 end
... ...
spec/models/notice_spec.rb
... ... @@ -107,7 +107,7 @@ describe Notice, type: &#39;model&#39; do
107 107 describe "request" do
108 108 it "returns empty hash if not set" do
109 109 notice = Notice.new
110   - expect(notice.request).to eq ({})
  110 + expect(notice.request).to eq({})
111 111 end
112 112 end
113 113  
... ...
spec/models/notification_service/gtalk_service_spec.rb
... ... @@ -2,7 +2,7 @@ describe NotificationServices::GtalkService, type: &#39;model&#39; do
2 2 it "it should send a notification to gtalk" do
3 3 # setup
4 4 notice = Fabricate :notice
5   - problem = notice.problem
  5 + notice.problem
6 6 notification_service = Fabricate :gtalk_notification_service, :app => notice.app
7 7 problem = notice.problem
8 8  
... ... @@ -14,8 +14,8 @@ describe NotificationServices::GtalkService, type: &#39;model&#39; do
14 14 expect(Jabber::Client).to receive(:new).with(jid).and_return(gtalk)
15 15 expect(gtalk).to receive(:connect).with(notification_service.service)
16 16 expect(gtalk).to receive(:auth).with(notification_service.api_token)
17   - message_value = """#{problem.app.name.to_s}
18   -#{Errbit::Config.protocol}://#{Errbit::Config.host}/apps/#{problem.app.id.to_s}
  17 + message_value = """#{problem.app.name}
  18 +#{Errbit::Config.protocol}://#{Errbit::Config.host}/apps/#{problem.app.id}
19 19 #{notification_service.notification_description problem}"""
20 20  
21 21 expect(Jabber::Message).to receive(:new).with(notification_service.user_id, message_value).and_return(message)
... ... @@ -37,8 +37,8 @@ describe NotificationServices::GtalkService, type: &#39;model&#39; do
37 37 @notice = Fabricate :notice
38 38 @notification_service = Fabricate :gtalk_notification_service, :app => @notice.app
39 39 @problem = @notice.problem
40   - @error_msg = """#{@problem.app.name.to_s}
41   -#{Errbit::Config.protocol}://#{Errbit::Config.host}/apps/#{@problem.app.id.to_s}
  40 + @error_msg = """#{@problem.app.name}
  41 +#{Errbit::Config.protocol}://#{Errbit::Config.host}/apps/#{@problem.app.id}
42 42 #{@notification_service.notification_description @problem}"""
43 43  
44 44 # gtalk stubbing
... ... @@ -94,7 +94,7 @@ describe NotificationServices::GtalkService, type: &#39;model&#39; do
94 94 it "it should send a notification to room only" do
95 95 # setup
96 96 notice = Fabricate :notice
97   - problem = notice.problem
  97 + notice.problem
98 98 notification_service = Fabricate :gtalk_notification_service, :app => notice.app
99 99 problem = notice.problem
100 100  
... ... @@ -106,8 +106,8 @@ describe NotificationServices::GtalkService, type: &#39;model&#39; do
106 106 expect(Jabber::Client).to receive(:new).with(jid).and_return(gtalk)
107 107 expect(gtalk).to receive(:connect)
108 108 expect(gtalk).to receive(:auth).with(notification_service.api_token)
109   - message_value = """#{problem.app.name.to_s}
110   -#{Errbit::Config.protocol}://#{Errbit::Config.host}/apps/#{problem.app.id.to_s}
  109 + message_value = """#{problem.app.name}
  110 +#{Errbit::Config.protocol}://#{Errbit::Config.host}/apps/#{problem.app.id}
111 111 #{notification_service.notification_description problem}"""
112 112  
113 113 expect(Jabber::Message).to receive(:new).with(notification_service.room_id, message_value).and_return(message)
... ...
spec/models/problem_spec.rb
... ... @@ -263,7 +263,7 @@ describe Problem, type: &#39;model&#39; do
263 263 end
264 264  
265 265 it "#messages should be empty by default" do
266   - expect(@problem.messages).to eq ({})
  266 + expect(@problem.messages).to eq({})
267 267 end
268 268  
269 269 it "removing a notice removes string from #messages" do
... ... @@ -290,7 +290,7 @@ describe Problem, type: &#39;model&#39; do
290 290 end
291 291  
292 292 it "#hosts should be empty by default" do
293   - expect(@problem.hosts).to eq ({})
  293 + expect(@problem.hosts).to eq({})
294 294 end
295 295  
296 296 it "removing a notice removes string from #hosts" do
... ... @@ -310,7 +310,7 @@ describe Problem, type: &#39;model&#39; do
310 310 end
311 311  
312 312 it "#user_agents should be empty by default" do
313   - expect(@problem.user_agents).to eq ({})
  313 + expect(@problem.user_agents).to eq({})
314 314 end
315 315  
316 316 it "removing a notice removes string from #user_agents" do
... ...
spec/views/problems/show.html.haml_spec.rb
... ... @@ -34,7 +34,7 @@ describe &quot;problems/show.html.haml&quot;, type: &#39;view&#39; do
34 34 allow(controller).to receive(:current_user).and_return(Fabricate(:user))
35 35 end
36 36  
37   - def with_issue_tracker(tracker, problem)
  37 + def with_issue_tracker(tracker, _problem)
38 38 allow(ErrbitPlugin::Registry).to receive(:issue_trackers).and_return(trackers)
39 39 app.issue_tracker = IssueTrackerDecorator.new(
40 40 IssueTracker.new :type_tracker => tracker, :options => {
... ...