diff options
author | Dominique Dumont <dod@debian.org> | 2021-06-04 18:14:06 +0200 |
---|---|---|
committer | Dominique Dumont <dod@debian.org> | 2021-06-04 18:38:59 +0200 |
commit | 461de20f63961902a92b482f30428c62e5f44806 (patch) | |
tree | 710f98e600e4def4cd11ae7a7d5d8a9a8ef71008 | |
parent | c12b088aa12692fd21274ac34cd13fa19bed68ff (diff) |
add explicit returns to subroutines
-rw-r--r-- | lib/Config/Model/Backend/Dpkg.pm | 4 | ||||
-rw-r--r-- | lib/Config/Model/Backend/Dpkg/Autopkgtest.pm | 3 | ||||
-rw-r--r-- | lib/Config/Model/Backend/Dpkg/Control.pm | 4 | ||||
-rw-r--r-- | lib/Config/Model/Backend/Dpkg/Copyright.pm | 5 | ||||
-rw-r--r-- | lib/Config/Model/Backend/Dpkg/Patch.pm | 2 | ||||
-rw-r--r-- | lib/Config/Model/Backend/DpkgSyntax.pm | 1 | ||||
-rw-r--r-- | lib/Config/Model/Dpkg/Copyright.pm | 3 | ||||
-rw-r--r-- | lib/Config/Model/Dpkg/Dependency.pm | 8 | ||||
-rw-r--r-- | lib/Dpkg/Copyright/Scanner.pm | 9 |
9 files changed, 37 insertions, 2 deletions
diff --git a/lib/Config/Model/Backend/Dpkg.pm b/lib/Config/Model/Backend/Dpkg.pm index a46daa62..01b84a0c 100644 --- a/lib/Config/Model/Backend/Dpkg.pm +++ b/lib/Config/Model/Backend/Dpkg.pm @@ -59,6 +59,7 @@ sub read_install_files ( $self, $hash, $elt, $check, $args ) { $logger->info("install: found $arch install file"); $hash->fetch_with_id("./$arch"); } + return; } sub read_lintian_overrides ( $self, $hash, $elt, $check, $args ) { @@ -78,6 +79,7 @@ sub read_lintian_overrides ( $self, $hash, $elt, $check, $args ) { $logger->info("found $pkg lintian-overrides file"); $hash->fetch_with_id($pkg)->store($file->slurp_utf8); } + return; } sub read_patch_series ( $self, $hash, $elt, $check, $args ) { @@ -121,6 +123,7 @@ sub read_patch_series ( $self, $hash, $elt, $check, $args ) { $logger->info("found patch $pname, stored in $location ($obj)"); } } + return; } my %write_hash_dispatch = ( @@ -199,6 +202,7 @@ sub write_lintian_overrides ($self, $dir, $hash) { $dir->child($file)->spew_utf8($content); } } + return; } no Mouse; diff --git a/lib/Config/Model/Backend/Dpkg/Autopkgtest.pm b/lib/Config/Model/Backend/Dpkg/Autopkgtest.pm index cf0c55b5..f073d640 100644 --- a/lib/Config/Model/Backend/Dpkg/Autopkgtest.pm +++ b/lib/Config/Model/Backend/Dpkg/Autopkgtest.pm @@ -72,6 +72,7 @@ sub parse_control_file ($self, $control_file, $node, $check) { } } } + return; } sub write { @@ -101,6 +102,8 @@ sub write_control_file ($self, $node, $control_file) { my $res = $self->write_dpkg_file(\@sections,", " ) ; $control_file->spew_utf8($res); + + return; } 1; diff --git a/lib/Config/Model/Backend/Dpkg/Control.pm b/lib/Config/Model/Backend/Dpkg/Control.pm index d51dc48c..5e95e19c 100644 --- a/lib/Config/Model/Backend/Dpkg/Control.pm +++ b/lib/Config/Model/Backend/Dpkg/Control.pm @@ -125,6 +125,7 @@ sub fill_package_cache ($self, $c) { } my @pkgs = keys %packages; Config::Model::Dpkg::Dependency::cache_info_from_madison ($self->node->instance,@pkgs); + return; } sub read_sections { @@ -152,6 +153,7 @@ sub read_sections { my $ref = delete $sections{$lc_key} ; $self->store_section_element_in_tree ($node,$check, @$ref); } + return; } # @@ -196,6 +198,7 @@ sub store_section_element_in_tree { my $unexpected_obj = $node->fetch_element($key); $self->store_section_leaf_element ( $logger, $unexpected_obj, $check, $v_ref); } + return; } @@ -242,6 +245,7 @@ sub _re_order ($list, $move_after) { splice @$list, $ik, 1; # remove $k from list splice @$list, $iv, 0, $k; # add back $k after $v } + return; } my @move_after = ( diff --git a/lib/Config/Model/Backend/Dpkg/Copyright.pm b/lib/Config/Model/Backend/Dpkg/Copyright.pm index aaa93aad..8d286440 100644 --- a/lib/Config/Model/Backend/Dpkg/Copyright.pm +++ b/lib/Config/Model/Backend/Dpkg/Copyright.pm @@ -268,6 +268,7 @@ sub append_text_no_synopsis ($self, $logger_param, $object, $check, $v_ref) { } $self->store_section_leaf_element($logger_param,$object, $check, \@new_ref); + return; } sub _store_line { @@ -276,6 +277,7 @@ sub _store_line { chomp $v ; $logger->debug("_store_line with check $check ".$object->name." = $v"); $object->store(value => $v, check => $check) ; + return; } sub _store_file_info ($self,$section, $object, $target_name,$key, $check, $v_ref) { @@ -285,6 +287,7 @@ sub _store_file_info ($self,$section, $object, $target_name,$key, $check, $v_ref my $f = $store_dispatch{$dispatcher} || die "Error in $section section (line ".$v_ref->[0][1]."): unexpected '$key' field\n"; $self->$f($logger, $target,$check,$v_ref) ; + return; } sub _store_license_info ($self, $lic_node, $key, $check, $v_ref ) { @@ -296,6 +299,7 @@ sub _store_license_info ($self, $lic_node, $key, $check, $v_ref ) { ); } $self->_store_file_license( $lic_node, $check, $v_ref ); + return; } sub _store_file_license ($self, $lic_object, $check, $v_ref) { @@ -316,6 +320,7 @@ sub _store_file_license ($self, $lic_object, $check, $v_ref) { my $short_name_obj = $lic_object->fetch_element('short_name'); $self->store_section_leaf_element ($logger, $short_name_obj, $check, [ $lic_line_ref ]); + return; } sub write { diff --git a/lib/Config/Model/Backend/Dpkg/Patch.pm b/lib/Config/Model/Backend/Dpkg/Patch.pm index 657e5370..7396156c 100644 --- a/lib/Config/Model/Backend/Dpkg/Patch.pm +++ b/lib/Config/Model/Backend/Dpkg/Patch.pm @@ -21,7 +21,7 @@ use Path::Tiny; my $logger = get_logger("Backend::Dpkg::Patch"); -sub skip_open { 1;} +sub skip_open { return 1;} # TODO: use a role provided by Config::Model sub cfg_path { diff --git a/lib/Config/Model/Backend/DpkgSyntax.pm b/lib/Config/Model/Backend/DpkgSyntax.pm index eef10d8c..2f0b8ce5 100644 --- a/lib/Config/Model/Backend/DpkgSyntax.pm +++ b/lib/Config/Model/Backend/DpkgSyntax.pm @@ -171,6 +171,7 @@ sub _store_line_and_comments ($store_ref,$file_path,$line,$check,$line_nb, $hand $logger->error($msg) if $check eq 'skip'; } $comments->@* = (); # reset comments, they are now stored + return; } # input is [ section [ keyword => value | value_list_ref ] ] diff --git a/lib/Config/Model/Dpkg/Copyright.pm b/lib/Config/Model/Dpkg/Copyright.pm index 32a8f875..991dd0ae 100644 --- a/lib/Config/Model/Dpkg/Copyright.pm +++ b/lib/Config/Model/Dpkg/Copyright.pm @@ -38,6 +38,7 @@ my $dumper = Config::Model::DumpAsData->new; sub _say ($self,$msg) { say $msg unless $self->{quiet}; + return; } sub _get_old_data ($old_split_files, $old_split_dirs, $path) { @@ -342,6 +343,7 @@ sub _apply_fix_scan_copyright_file ($self, $current_dir) { } } } + return; } sub _prune_old_dirs ($self, $h, $old_dirs, $path = [] ) { @@ -360,6 +362,7 @@ sub _prune_old_dirs ($self, $h, $old_dirs, $path = [] ) { $self->_say( "Removing old entry $dir_path" ); delete $old_dirs->{$dir_path}; } + return; } 1; diff --git a/lib/Config/Model/Dpkg/Dependency.pm b/lib/Config/Model/Dpkg/Dependency.pm index f162ac6a..87d6d0a8 100644 --- a/lib/Config/Model/Dpkg/Dependency.pm +++ b/lib/Config/Model/Dpkg/Dependency.pm @@ -436,6 +436,7 @@ sub check_debhelper_compat_version { $logger->info("will warn: $msg (fix++)"); } } + return; } sub check_debhelper_version { @@ -470,6 +471,7 @@ sub check_debhelper_version { $logger->info("will warn: $msg (fix++)"); } } + return; } sub check_compat_object ($self) { @@ -501,6 +503,7 @@ sub check_compat_object_value ($self, $apply_fix, $msgs) { $logger->info("will warn: $msg (fix++)"); } } + return; } sub check_compat_value ($self, $compat_value, $apply_fix, $msgs) { @@ -720,6 +723,7 @@ sub check_or_fix_essential_package { $logger->info("will warn: $msg (fix++)"); } } + return; } @@ -763,6 +767,7 @@ sub check_or_fix_pkg_name { "package $pkg is unknown. Check for typos if not a virtual package."); } } + return; } sub check_or_fix_dep { @@ -807,6 +812,7 @@ sub check_or_fix_dep { $fix_sub = sub { delete $_[0]->{dep} }; } $self->warn_or_fix_dep_info ($fix_sub, $apply_fix, $dep_info, $msgs, $warn_str, $log_str) ; + return; } @@ -823,6 +829,7 @@ sub warn_or_fix_dep_info { $self->add_warning( $warn_msg ); $logger->info("will warn: $warn_msg (fix++)"); } + return; } use vars qw/%cache $use_test_cache/ ; @@ -946,6 +953,7 @@ sub cache_info_from_madison { else { warn "cannot get data from madison. Check your proxy ?\n"; } + return; } # See https://ftp-master.debian.org/epydoc/dakweb.queries.madison-module.html diff --git a/lib/Dpkg/Copyright/Scanner.pm b/lib/Dpkg/Copyright/Scanner.pm index 2e0e9449..581dd1b0 100644 --- a/lib/Dpkg/Copyright/Scanner.pm +++ b/lib/Dpkg/Copyright/Scanner.pm @@ -90,12 +90,14 @@ sub print_copyright ( %args ) { binmode(STDOUT, ":encoding(UTF-8)"); print @out; } + return; } my $quiet; sub _warn ($msg) { warn $msg unless $quiet; + return; } my %default ; @@ -443,8 +445,9 @@ sub _warn_user_about_problems ($files, $fill_blank_data, @no_info_list) { warn "No copyright information found" unless keys %$files; - + return; } + sub __to_copyright_structure ($c, $l) { return { Copyright => $c, @@ -472,6 +475,7 @@ sub __create_tree_leaf_from_paths ($h,$path,$value) { my $last = pop @subpaths; map { $h = $h->{$_} ||= {} } @subpaths ; $h->{$last} = $value; + return; } sub __clean_copyright ($c) { @@ -564,6 +568,7 @@ sub __pack_dir ($h, $pack, @path) { } push $pack->@*, map { [ $_, $pack_by_id{$_}->@* ]; } keys %pack_by_id ; + return; } # find ids that can be merged together @@ -626,6 +631,7 @@ sub __swap_merged_ids ($files, $merged_c_info) { $files->{$name} = "$new_id" ; } } + return; } sub __coalesce_copyright_years($entries, $owners) { @@ -764,6 +770,7 @@ sub __prune_files_represented_by_main_license ($main_license_id, $tree_of_ids) { # here's the '*' file representing the most used (c) info $tree_of_ids->{'*'} //= $main_license_id; } + return; } # $tree_of_ids is a tree of hash matching the directory structure. Each leaf is a |