| 1 | package Software::Policies::Contributing::PerlDistZilla; | ||||||||||||
| 2 | |||||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 2 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | 2 | ▶ | use 5.010; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | |||||||||||||
| 7 | # ABSTRACT: Create project policy file: Contributing / PerlDistZilla | ||||||||||||
| 8 | |||||||||||||
| 9 | 2 | our $VERSION = '0.006'; | |||||||||||
| 10 | |||||||||||||
| 11 | 2 | ▶ | use Carp; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 12 | 2 | ▶ | use Data::Section -setup; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 13 | 2 | ▶ | use Text::Template (); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 14 | |||||||||||||
| 15 | 5 | ▶ | sub new { | ||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 16 | 5 | my ($class) = @_; | |||||||||||
| 17 | 5 | return bless {}, $class; | |||||||||||
| 18 | } | ||||||||||||
| 19 | |||||||||||||
| 20 | 5 | ▶ | sub create { | ||||||||||
|
Subroutine
create: called CC=9 SCAR=22.0
Pod
documented
| |||||||||||||
| 21 | 5 | my ( $self, %args ) = @_; | |||||||||||
| 22 | 5 | ▶ | my $version = delete $args{'version'} // '1'; | ||||||||||
|
Condition100%2/2
delete $args{"version"} // 1
MC/DC100%1/1
delete $args{"version"} // 1
delete $args{"version"}
Truth table100%2/2
A
A= delete $args{"version"}
| |||||||||||||
| 23 | 5 | ▶ | my $format = delete $args{'format'} // 'markdown'; | ||||||||||
|
Condition100%2/2
delete $args{"format"} // "markdown"
MC/DC100%1/1
delete $args{"format"} // "markdown"
delete $args{"format"}
Truth table100%2/2
A
A= delete $args{"format"}
| |||||||||||||
| 24 | |||||||||||||
| 25 | 5 | my %attributes; | |||||||||||
| 26 | 5 | ▶ | my $attrs = delete $args{'attributes'} // {}; | ||||||||||
|
Condition100%2/2
delete $args{"attributes"} // {}
MC/DC100%1/1
delete $args{"attributes"} // {}
delete $args{"attributes"}
Truth table100%2/2
A
A= delete $args{"attributes"}
| |||||||||||||
| 27 | 5 | ▶ | $attributes{'ai_disclosure'} = $attrs->{'ai_disclosure'} // 0; | ||||||||||
|
Condition100%2/2
$attrs->{"ai_disclosure"} // 0
MC/DC100%1/1
$attrs->{"ai_disclosure"} // 0
$attrs->{"ai_disclosure"}
Truth table100%2/2
A
A= $attrs->{"ai_disclosure"}
| |||||||||||||
| 28 | 5 | ▶ | $attributes{'ai_assisted'} = $attrs->{'ai_assisted'} // 1; | ||||||||||
|
Condition100%2/2
$attrs->{"ai_assisted"} // 1
MC/DC100%1/1
$attrs->{"ai_assisted"} // 1
$attrs->{"ai_assisted"}
Truth table100%2/2
A
A= $attrs->{"ai_assisted"}
| |||||||||||||
| 29 | |||||||||||||
| 30 | 5 | ▶ | croak 'Unknown arguments: ', join q{,}, keys %args if (%args); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 31 | |||||||||||||
| 32 | 5 | ▶ | if ( $attributes{'ai_disclosure'} ) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 33 | 2 | $attributes{'ai_disclosure_text'} = _ai_assisted( $attributes{'ai_assisted'}, $version, $format ); | |||||||||||
| 34 | } | ||||||||||||
| 35 | |||||||||||||
| 36 | 5 | my ($data_section) = __PACKAGE__ =~ m/.+::([^:]+)$/msx; | |||||||||||
| 37 | 5 | my $data_section_label = $data_section . q{_v} . q{1} . q{_} . $format; | |||||||||||
| 38 | 5 | my $template = $self->section_data($data_section_label); | |||||||||||
| 39 | 5 | ▶ | croak "Cannot find data section $data_section_label" | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 40 | if ( !$template ); | ||||||||||||
| 41 | my $text = Text::Template->fill_this_in( | ||||||||||||
| 42 | 5 | ${$template}, | |||||||||||
| 43 | HASH => \%attributes, | ||||||||||||
| 44 | DELIMITERS => [qw/{{ }}/], | ||||||||||||
| 45 | ); | ||||||||||||
| 46 | return ( | ||||||||||||
| 47 | 5 | policy => 'Contributing', | |||||||||||
| 48 | class => 'PerlDistZilla', | ||||||||||||
| 49 | version => $version, | ||||||||||||
| 50 | text => $text, | ||||||||||||
| 51 | filename => _filename($format), | ||||||||||||
| 52 | format => $format, | ||||||||||||
| 53 | ); | ||||||||||||
| 54 | } | ||||||||||||
| 55 | |||||||||||||
| 56 | 0 | ▶ | sub get_available_classes_and_versions { | ||||||||||
|
Subroutine
get_available_classes_and_versions: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||
| 57 | return { | ||||||||||||
| 58 | 0 | 'PerlDistZilla' => { | |||||||||||
| 59 | versions => { | ||||||||||||
| 60 | '1' => 1, | ||||||||||||
| 61 | }, | ||||||||||||
| 62 | formats => { | ||||||||||||
| 63 | 'markdown' => 1, | ||||||||||||
| 64 | 'text' => 1, | ||||||||||||
| 65 | }, | ||||||||||||
| 66 | }, | ||||||||||||
| 67 | }; | ||||||||||||
| 68 | } | ||||||||||||
| 69 | |||||||||||||
| 70 | 5 | ▶ | sub _filename { | ||||||||||
|
Subroutine
_filename: called CC=1 SCAR=0.0
| |||||||||||||
| 71 | 5 | my ($format) = @_; | |||||||||||
| 72 | 5 | my %formats = ( | |||||||||||
| 73 | 'markdown' => 'CONTRIBUTING.md', | ||||||||||||
| 74 | 'text' => 'CONTRIBUTING.txt', | ||||||||||||
| 75 | ); | ||||||||||||
| 76 | 5 | return $formats{$format}; | |||||||||||
| 77 | } | ||||||||||||
| 78 | |||||||||||||
| 79 | 2 | ▶ | sub _ai_assisted { | ||||||||||
|
Subroutine
_ai_assisted: called CC=6 SCAR=22.4
| |||||||||||||
| 80 | 2 | my ( $wanted, $version, $format ) = @_; | |||||||||||
| 81 | 2 | ▶ | if ($wanted) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 82 | 1 | ▶ | if ( $format eq 'markdown' ) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 83 | 1 | ▶ | if ( $version eq '1' ) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 84 | 1 | return <<'EOF'; | |||||||||||
| 85 | ### AI-assisted contributions | ||||||||||||
| 86 | |||||||||||||
| 87 | This project uses AI-assisted development tools. If you also use AI tools | ||||||||||||
| 88 | when preparing your contribution, please note the following: | ||||||||||||
| 89 | |||||||||||||
| 90 | - Disclose if you have used AI tools in preparing your contribution. | ||||||||||||
| 91 | - Review, understand, and test all AI-generated code, documentation | ||||||||||||
| 92 | and other output before submitting. | ||||||||||||
| 93 | - Do not submit raw, unreviewed AI output. | ||||||||||||
| 94 | - Consider the ethical implications of your choice of AI tools, | ||||||||||||
| 95 | particularly regarding how the tools' models were trained and whether | ||||||||||||
| 96 | their data sourcing practices are consistent with respect for | ||||||||||||
| 97 | creators and rights holders. | ||||||||||||
| 98 | - Be prepared to identify which AI tools were used if asked. | ||||||||||||
| 99 | |||||||||||||
| 100 | See [AI_DISCLOSURE.md](AI_DISCLOSURE.md) for the full policy on AI usage | ||||||||||||
| 101 | in this project. | ||||||||||||
| 102 | |||||||||||||
| 103 | EOF | ||||||||||||
| 104 | } | ||||||||||||
| 105 | else { | ||||||||||||
| 106 | # version 1.1 | ||||||||||||
| 107 | 0 | return <<'EOF'; | |||||||||||
| 108 | ### AI-assisted contributions | ||||||||||||
| 109 | |||||||||||||
| 110 | This project uses AI-assisted development tools. If you also use AI tools | ||||||||||||
| 111 | when preparing your contribution, please note the following: | ||||||||||||
| 112 | |||||||||||||
| 113 | - Disclose that you have used AI tools in the commit message and pull request. | ||||||||||||
| 114 | For commits, use an "AI-assisted-by: <tool name>" trailer. | ||||||||||||
| 115 | - Review, understand, and test all AI-generated code, documentation | ||||||||||||
| 116 | and other output before submitting. | ||||||||||||
| 117 | - Do not submit raw, unreviewed AI output. | ||||||||||||
| 118 | - Consider the ethical implications of your choice of AI tools, | ||||||||||||
| 119 | particularly regarding how the tools' models were trained and whether | ||||||||||||
| 120 | their data sourcing practices are consistent with respect for | ||||||||||||
| 121 | creators and rights holders. | ||||||||||||
| 122 | - Be prepared to disclose which AI tools you used if asked. | ||||||||||||
| 123 | |||||||||||||
| 124 | See [AI_DISCLOSURE.md](AI_DISCLOSURE.md) for the full policy on AI usage | ||||||||||||
| 125 | in this project. | ||||||||||||
| 126 | |||||||||||||
| 127 | EOF | ||||||||||||
| 128 | } | ||||||||||||
| 129 | } | ||||||||||||
| 130 | else { | ||||||||||||
| 131 | 0 | ▶ | if ( $version eq '1' ) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 132 | 0 | return <<'EOF'; | |||||||||||
| 133 | AI-assisted contributions | ||||||||||||
| 134 | |||||||||||||
| 135 | This project uses AI-assisted development tools. If you also use AI tools | ||||||||||||
| 136 | when preparing your contribution, please note the following: | ||||||||||||
| 137 | |||||||||||||
| 138 | - Disclose if you have used AI tools in preparing your contribution. | ||||||||||||
| 139 | - Review, understand, and test all AI-generated code, documentation | ||||||||||||
| 140 | and other output before submitting. | ||||||||||||
| 141 | - Do not submit raw, unreviewed AI output. | ||||||||||||
| 142 | - Consider the ethical implications of your choice of AI tools, | ||||||||||||
| 143 | particularly regarding how the tools' models were trained and whether | ||||||||||||
| 144 | their data sourcing practices are consistent with respect for | ||||||||||||
| 145 | creators and rights holders. | ||||||||||||
| 146 | - Be prepared to identify which AI tools were used if asked. | ||||||||||||
| 147 | |||||||||||||
| 148 | See file AI_DISCLOSURE.md for the full policy on AI usage | ||||||||||||
| 149 | in this project. | ||||||||||||
| 150 | |||||||||||||
| 151 | EOF | ||||||||||||
| 152 | } | ||||||||||||
| 153 | else { | ||||||||||||
| 154 | # version 1.1 | ||||||||||||
| 155 | 0 | return <<'EOF'; | |||||||||||
| 156 | AI-assisted contributions | ||||||||||||
| 157 | |||||||||||||
| 158 | This project uses AI-assisted development tools. If you also use AI tools | ||||||||||||
| 159 | when preparing your contribution, please note the following: | ||||||||||||
| 160 | |||||||||||||
| 161 | - Disclose that you have used AI tools in the commit message and pull request. | ||||||||||||
| 162 | For commits, use an "AI-assisted-by: <tool name>" trailer. | ||||||||||||
| 163 | - Review, understand, and test all AI-generated code, documentation | ||||||||||||
| 164 | and other output before submitting. | ||||||||||||
| 165 | - Do not submit raw, unreviewed AI output. | ||||||||||||
| 166 | - Consider the ethical implications of your choice of AI tools, | ||||||||||||
| 167 | particularly regarding how the tools' models were trained and whether | ||||||||||||
| 168 | their data sourcing practices are consistent with respect for | ||||||||||||
| 169 | creators and rights holders. | ||||||||||||
| 170 | - Be prepared to disclose which AI tools you used if asked. | ||||||||||||
| 171 | |||||||||||||
| 172 | See file AI_DISCLOSURE.md for the full policy on AI usage | ||||||||||||
| 173 | in this project. | ||||||||||||
| 174 | |||||||||||||
| 175 | EOF | ||||||||||||
| 176 | } | ||||||||||||
| 177 | } | ||||||||||||
| 178 | } | ||||||||||||
| 179 | else { | ||||||||||||
| 180 | 1 | ▶ | if ( $format eq 'markdown' ) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 181 | 0 | return <<'EOF'; | |||||||||||
| 182 | ### AI-assisted contributions | ||||||||||||
| 183 | |||||||||||||
| 184 | This project does not accept contributions that were produced with | ||||||||||||
| 185 | the assistance of AI tools. This includes, but is not limited to, | ||||||||||||
| 186 | code generated or substantially modified by large language models | ||||||||||||
| 187 | (such as ChatGPT, Claude, or GitHub Copilot), AI-powered code | ||||||||||||
| 188 | completion tools, and AI-generated documentation or test cases. | ||||||||||||
| 189 | |||||||||||||
| 190 | Minor incidental use of AI, such as IDE autocomplete features that | ||||||||||||
| 191 | operate on local context only, is not considered a violation of this | ||||||||||||
| 192 | policy. | ||||||||||||
| 193 | |||||||||||||
| 194 | By submitting a contribution, you represent that the work is your | ||||||||||||
| 195 | own and was not produced by or with the assistance of AI tools | ||||||||||||
| 196 | beyond the exception noted above. | ||||||||||||
| 197 | |||||||||||||
| 198 | If you are unsure whether your use of a particular tool falls under | ||||||||||||
| 199 | this policy, please ask before submitting. | ||||||||||||
| 200 | |||||||||||||
| 201 | See [AI_DISCLOSURE.md](AI_DISCLOSURE.md) for the full rationale | ||||||||||||
| 202 | behind this policy. | ||||||||||||
| 203 | |||||||||||||
| 204 | EOF | ||||||||||||
| 205 | } | ||||||||||||
| 206 | else { | ||||||||||||
| 207 | 1 | return <<'EOF'; | |||||||||||
| 208 | AI-assisted contributions | ||||||||||||
| 209 | |||||||||||||
| 210 | This project does not accept contributions that were produced with | ||||||||||||
| 211 | the assistance of AI tools. This includes, but is not limited to, | ||||||||||||
| 212 | code generated or substantially modified by large language models | ||||||||||||
| 213 | (such as ChatGPT, Claude, or GitHub Copilot), AI-powered code | ||||||||||||
| 214 | completion tools, and AI-generated documentation or test cases. | ||||||||||||
| 215 | |||||||||||||
| 216 | Minor incidental use of AI, such as IDE autocomplete features that | ||||||||||||
| 217 | operate on local context only, is not considered a violation of this | ||||||||||||
| 218 | policy. | ||||||||||||
| 219 | |||||||||||||
| 220 | By submitting a contribution, you represent that the work is your | ||||||||||||
| 221 | own and was not produced by or with the assistance of AI tools | ||||||||||||
| 222 | beyond the exception noted above. | ||||||||||||
| 223 | |||||||||||||
| 224 | If you are unsure whether your use of a particular tool falls under | ||||||||||||
| 225 | this policy, please ask before submitting. | ||||||||||||
| 226 | |||||||||||||
| 227 | See file AI_DISCLOSURE.md for the full rationale | ||||||||||||
| 228 | behind this policy. | ||||||||||||
| 229 | |||||||||||||
| 230 | EOF | ||||||||||||
| 231 | } | ||||||||||||
| 232 | } | ||||||||||||
| 233 | } | ||||||||||||
| 234 | |||||||||||||
| 235 | 2 | 1; | |||||||||||
| 236 | |||||||||||||
| 237 | =pod | ||||||||||||
| 238 | |||||||||||||
| 239 | =encoding UTF-8 | ||||||||||||
| 240 | |||||||||||||
| 241 | =head1 NAME | ||||||||||||
| 242 | |||||||||||||
| 243 | Software::Policies::Contributing::PerlDistZilla - Create project policy file: Contributing / PerlDistZilla | ||||||||||||
| 244 | |||||||||||||
| 245 | =head1 VERSION | ||||||||||||
| 246 | |||||||||||||
| 247 | version 0.006 | ||||||||||||
| 248 | |||||||||||||
| 249 | =for Pod::Coverage new create get_available_classes_and_versions | ||||||||||||
| 250 | |||||||||||||
| 251 | =begin stopwords | ||||||||||||
| 252 | |||||||||||||
| 253 | |||||||||||||
| 254 | |||||||||||||
| 255 | |||||||||||||
| 256 | =end stopwords | ||||||||||||
| 257 | |||||||||||||
| 258 | =head1 METHODS | ||||||||||||
| 259 | |||||||||||||
| 260 | =head2 new | ||||||||||||
| 261 | |||||||||||||
| 262 | =head2 create | ||||||||||||
| 263 | |||||||||||||
| 264 | Create the policy. | ||||||||||||
| 265 | |||||||||||||
| 266 | Options: | ||||||||||||
| 267 | |||||||||||||
| 268 | =over 8 | ||||||||||||
| 269 | |||||||||||||
| 270 | =item class | ||||||||||||
| 271 | |||||||||||||
| 272 | Available classes: B<PerlDistZilla> (default). | ||||||||||||
| 273 | |||||||||||||
| 274 | =item version | ||||||||||||
| 275 | |||||||||||||
| 276 | Available versions: 1 (default). | ||||||||||||
| 277 | |||||||||||||
| 278 | =item format | ||||||||||||
| 279 | |||||||||||||
| 280 | Available formats: markdown (default), text. | ||||||||||||
| 281 | |||||||||||||
| 282 | =item attributes | ||||||||||||
| 283 | |||||||||||||
| 284 | =over 8 | ||||||||||||
| 285 | |||||||||||||
| 286 | =item ai_disclosure | ||||||||||||
| 287 | |||||||||||||
| 288 | Add an AI disclosure to the policy. Allowed values: 0, 1. Default: 0. | ||||||||||||
| 289 | |||||||||||||
| 290 | =item ai_assisted | ||||||||||||
| 291 | |||||||||||||
| 292 | If I<ai_disclosure> is true, I<ai_assisted> defines if AI assisted contributions are welcome or not. | ||||||||||||
| 293 | Allowed values: 0, 1. Default: 1. | ||||||||||||
| 294 | |||||||||||||
| 295 | =back | ||||||||||||
| 296 | |||||||||||||
| 297 | =back | ||||||||||||
| 298 | |||||||||||||
| 299 | =head1 AUTHOR | ||||||||||||
| 300 | |||||||||||||
| 301 | Mikko Koivunalho <mikkoi@cpan.org> | ||||||||||||
| 302 | |||||||||||||
| 303 | =head1 COPYRIGHT AND LICENSE | ||||||||||||
| 304 | |||||||||||||
| 305 | This software is copyright (c) 2025 by Mikko Koivunalho. | ||||||||||||
| 306 | |||||||||||||
| 307 | This is free software; you can redistribute it and/or modify it under | ||||||||||||
| 308 | the same terms as the Perl 5 programming language system itself. | ||||||||||||
| 309 | |||||||||||||
| 310 | =cut | ||||||||||||
| 311 | |||||||||||||
| 312 | __DATA__ | ||||||||||||