lib/ios_logs/plugin.rb in danger-ios_logs-0.1.1 vs lib/ios_logs/plugin.rb in danger-ios_logs-0.1.2
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
require 'git_diff_parser'
module Danger
# This is a danger plugin to detect any `NSLog`/`print` entries left in the code.
#
@@ -18,15 +20,15 @@
#
# @see Bartosz Janda/danger-ios_logs
# @tags ios, logs, print, nslog, swift
#
class DangerIosLogs < Plugin
- NSLOG_REGEXP = /\s+NSLog\s*\(/
- PRINT_REGEXP = /\s+print\s*\(/
+ NSLOG_REGEXP = /\s+NSLog\s*\(/.freeze
+ PRINT_REGEXP = /\s+print\s*\(/.freeze
- NSLOG_MESSAGE = 'There remain `NSLog` in the modified code.'.freeze
- PRINT_MESSAGE = 'There remain `print` in the modified code.'.freeze
+ NSLOG_MESSAGE = 'There remain `NSLog` in the modified code.'
+ PRINT_MESSAGE = 'There remain `print` in the modified code.'
#
# Notify usage of `NSLog`. `true` by default
#
# @return [Bool]
@@ -77,9 +79,10 @@
# By default `:warn`. Possible values: `:message`, `:warn`, `:fail`
#
# @return [Void]
def check(method = :warn)
raise 'Unsupported method' unless %i[message warn fail].include?(method)
+
@nslogs = []
@prints = []
check_files files_of_interest