Module: Jiminy::Reporting
- Defined in:
- lib/jiminy/reporting.rb,
lib/jiminy/reporting/reporters.rb,
lib/jiminy/reporting/n_plus_one.rb,
lib/jiminy/reporting/ci_providers.rb,
lib/jiminy/reporting/ci_providers/local.rb,
lib/jiminy/reporting/ci_providers/github.rb,
lib/jiminy/reporting/ci_providers/circle_ci.rb,
lib/jiminy/reporting/reporters/base_reporter.rb,
lib/jiminy/reporting/reporters/github_reporter.rb,
lib/jiminy/reporting/ci_providers/circle_ci/job.rb,
lib/jiminy/reporting/ci_providers/circle_ci/vcs.rb,
lib/jiminy/reporting/reporters/dry_run_reporter.rb,
lib/jiminy/reporting/ci_providers/circle_ci/base.rb,
lib/jiminy/reporting/ci_providers/local/artifact.rb,
lib/jiminy/reporting/yaml_file_comment_presenter.rb,
lib/jiminy/reporting/ci_providers/circle_ci/artifact.rb,
lib/jiminy/reporting/ci_providers/circle_ci/pipeline.rb,
lib/jiminy/reporting/ci_providers/circle_ci/workflow.rb,
lib/jiminy/reporting/ci_providers/circle_ci/api_request.rb,
lib/jiminy/reporting/ci_providers/provider_configuration.rb
Defined Under Namespace
Modules: CIProviders, Reporters Classes: NPlusOne, YAMLFileCommentPresenter
Constant Summary collapse
- TEMPLATES_DIR =
File.("templates/reporting", __dir__).freeze
- COMMENT_HEADER =
ERB.new(File.read(File.join(TEMPLATES_DIR, "comment_header.md.erb"))).result.freeze
- LINE_SEPARATOR =
"\n"
Class Method Summary collapse
Class Method Details
.report!(*yaml_files, **options) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/jiminy/reporting.rb', line 18 def report!(*yaml_files, **) return if yaml_files.empty? comment_content = yaml_files.map do |yaml_file| YAMLFileCommentPresenter.new(source_filepath: yaml_file, pr_number: [:pr_number]).to_s end.join(LINE_SEPARATOR) return if comment_content.strip.empty? if [:dry_run] Reporters::DryRunReporter.new(header: COMMENT_HEADER, body: comment_content).report! else Reporters::GithubReporter.new(header: COMMENT_HEADER, body: comment_content, pr_number: [:pr_number]).report! end end |