danger-ruby-swiftlint icon indicating copy to clipboard operation
danger-ruby-swiftlint copied to clipboard

[Feature Request] Non-commenting option

Open daniel-beard opened this issue 5 years ago • 1 comments

  • I've hit up against another issue extending the functionality of this plugin, and have a proposal to allow generic handling of violations by callers.
  • Similar to this issue: https://github.com/ashfurrow/danger-ruby-swiftlint/issues/125 , I want to modify/filter or send violations somewhere else. In this case, I want all the violations to be in a single Github Review comment.
  • Instead of adding another small extension to support this case, I'd like to propose the following:
    • Removing the existing select issues block from the lint_files method
    • Adding a parameter that prevents this plugin from commenting. Maybe dry_run or no_comment ?
    • This would allow an external caller of this plugin to assume complete control over the values set in the warnings and error attr_accessors

E.g.


# Run swiftlint
swiftlint.lint_files(dry_run: true) 
swiftlint_warnings = swiftlint.warnings
swiftlint_errors = swiftlint.errors

# Filter warnings + errors here
filtered_warnings = swiftlint_warnings.select(&filter_warnings)
filtered_errors = swiftlint_errors.select(&filter_errors)

# Create GH review
github.review.start

#TODO: Add all the warnings + errors here.

github.review.submit

Thoughts? I can work on an implementation that makes sense if this seems reasonable.

daniel-beard avatar Apr 25 '19 22:04 daniel-beard

Hey, yeah that makes sense! I'd say the argument should be no_comment 👍

ashfurrow avatar Apr 27 '19 20:04 ashfurrow