File Coverage

blib/lib/App/GHPT/WorkSubmitter/AskPullRequestQuestions.pm
Criterion Covered Total %
statement 21 26 80.7
branch n/a
condition n/a
subroutine 6 7 85.7
pod 1 1 100.0
total 28 34 82.3


line stmt bran cond sub pod time code
1              
2             use App::GHPT::Wrapper::OurMoose;
3 1     1   6  
  1         3  
  1         11  
4             our $VERSION = '2.000000';
5              
6             use App::GHPT::Types qw( ArrayRef Str );
7 1     1   10 use Module::Pluggable::Object;
  1         3  
  1         14  
8 1     1   5332 use App::GHPT::WorkSubmitter::ChangedFilesFactory;
  1         5153  
  1         56  
9 1     1   614  
  1         4  
  1         394  
10             has merge_to_branch_name => (
11             is => 'ro',
12             isa => Str,
13             required => 1,
14             );
15              
16             has question_namespaces => (
17             is => 'ro',
18             isa => ArrayRef [Str],
19             required => 1,
20             );
21              
22             has _changed_files => (
23             is => 'ro',
24             isa => 'App::GHPT::WorkSubmitter::ChangedFiles',
25             lazy => 1,
26             builder => '_build_changed_files',
27             );
28              
29             return App::GHPT::WorkSubmitter::ChangedFilesFactory->new(
30 2     2   5 merge_to_branch_name => $self->merge_to_branch_name,
  2         7  
  2         12  
31 2         86 )->changed_files;
32             }
33              
34             has _questions => (
35             is => 'ro',
36             isa => ArrayRef,
37             lazy => 1,
38             builder => '_build_questions',
39             );
40              
41             return [
42             map { $_->new( changed_files => $self->_changed_files ) }
43 2     2   8 Module::Pluggable::Object->new(
  2         9  
  2         4  
44             search_path => $self->question_namespaces,
45 2         68 require => 1,
  3         3195  
46             )->plugins,
47             ];
48             }
49              
50             return join "\n", map { $_->ask } $self->_questions->@*;
51             }
52              
53 0     0 1   __PACKAGE__->meta->make_immutable;
  0            
  0            
54 0            
  0            
55             1;
56              
57             # ABSTRACT: Ask questions to go in the pull request
58              
59              
60             =pod
61              
62             =encoding UTF-8
63              
64             =head1 NAME
65              
66             App::GHPT::WorkSubmitter::AskPullRequestQuestions - Ask questions to go in the pull request
67              
68             =head1 VERSION
69              
70             version 2.000000
71              
72             =head1 SYNOPSIS
73              
74             my $markdown = App::GHPT::WorkSubmitter::AskPullRequestQuestions->new(
75             merge_to_branch_name => 'main',
76             )->ask_questions;
77              
78             =head1 DESCRIPTION
79              
80             A module to ask questions about the branch you're creating a pull request
81             about and find.
82              
83             This module searches for all C<App::GHPT::WorkSubmitter::Question::*> modules and uses
84             them to produce markdown.
85              
86             =head1 ATTRIBUTES
87              
88             =head2 merge_to_branch_name
89              
90             The name of the branch that we're creating the pull request against. This is
91             probably C<main>.
92              
93             Required. Str.
94              
95             =head1 METHODS
96              
97             =head2 $asker->ask_questions
98              
99             Ask all the questions, return markdown.
100              
101             =head1 SUPPORT
102              
103             Bugs may be submitted through L<https://github.com/maxmind/App-GHPT/issues>.
104              
105             =head1 AUTHORS
106              
107             =over 4
108              
109             =item *
110              
111             Mark Fowler <mark@twoshortplanks.com>
112              
113             =item *
114              
115             Dave Rolsky <autarch@urth.org>
116              
117             =back
118              
119             =head1 COPYRIGHT AND LICENSE
120              
121             This software is Copyright (c) 2022 by MaxMind, Inc.
122              
123             This is free software, licensed under:
124              
125             The Artistic License 2.0 (GPL Compatible)
126              
127             =cut