lib/dangermattic/plugins/view_changes_checker.rb in danger-dangermattic-1.1.2 vs lib/dangermattic/plugins/view_changes_checker.rb in danger-dangermattic-1.2.0

- old
+ new

@@ -16,11 +16,11 @@ VIEW_EXTENSIONS_ANDROID = /(?i)(View|Button)\.(java|kt|xml)$/ MEDIA_IN_PR_BODY_PATTERNS = [ %r{https?://\S*\.(gif|jpg|jpeg|png|svg)}, %r{https?://\S*\.(mp4|avi|mov|mkv)}, - %r{https?://\S*github\S+/\S+/assets/\d+/}, + %r{https?://\S*github\S+/\S+/assets/}, /!\[(.*?)\]\((.*?)\)/, /<img\s+[^>]*src\s*=\s*[^>]*>/, /<video\s+[^>]*src\s*=\s*[^>]*>/ ].freeze @@ -29,18 +29,18 @@ # Checks if view files have been modified and if a screenshot or video is included in the pull request body, # displaying a warning if view files have been modified but no screenshot or video is included. # # @return [void] - def check + def check(report_type: :warning) view_files_modified = git.modified_files.any? do |file| VIEW_EXTENSIONS_IOS =~ file || VIEW_EXTENSIONS_ANDROID =~ file end pr_has_media = MEDIA_IN_PR_BODY_PATTERNS.any? do |pattern| github.pr_body =~ pattern end - warn(MESSAGE) if view_files_modified && !pr_has_media + reporter.report(message: MESSAGE, type: report_type) if view_files_modified && !pr_has_media end end end