Bulknews::Subtech RSSフィード

2006/09/05 (火)

[Plagger] code vs. comments 00:53  [Plagger] code vs. comments - Bulknews::Subtech を含むブックマーク はてなブックマーク -  [Plagger] code vs. comments - Bulknews::Subtech

適当なコードではかってみた。より正確には Pod::Stripper を使ったほうがよいかも。

#!/usr/bin/perl
use strict;
use warnings;

my %total;

for my $file (@ARGV) {
    my @code = strip_pod($file);
    my @comments = grep /^\s*#/, @code;
    my $ratio = @comments / @code;
    printf "%2.1f%% (%d/%d)\t%s\n", $ratio * 100, scalar(@comments), scalar(@code), $file;
    $total{code} += @code;
    $total{comments} += @comments;
}

print "---------------------------------------\n";
printf "%2.1f%% (%d/%d)\tTotal\n", 100 * $total{comments} / $total{code}, $total{comments}, $total{code};

sub strip_pod {
    my $file = shift;
    open my $fh, $file or die "$file: $!";
    my @code;
    while (<$fh>) {
        last if /^__(END|DATA)__/;
        push @code, $_;
    }
    return @code;
}

結果は以下。余裕で20%以下ですな。

0.0% (0/32)     lib/Plagger/CacheProxy.pm
0.0% (0/33)     lib/Plagger/Rule.pm
0.0% (0/45)     lib/Plagger/Thing.pm
0.0% (0/33)     lib/Plagger/Template.pm
0.0% (0/11)     lib/Plagger/Tag.pm
0.0% (0/27)     lib/Plagger/TT/Plagger/Util.pm
1.0% (1/99)     lib/Plagger/Date.pm
2.6% (5/194)    lib/Plagger/Util.pm
0.0% (0/49)     lib/Plagger/Update.pm
4.2% (10/237)   lib/Plagger/Plugin/Aggregator/Simple.pm
4.0% (6/149)    lib/Plagger/Plugin/Aggregator/Xango.pm
0.0% (0/20)     lib/Plagger/Plugin/Aggregator/Null.pm
0.0% (0/31)     lib/Plagger/Plugin/Widget/HatenaBookmark.pm
0.0% (0/39)     lib/Plagger/Plugin/Widget/Delicious.pm
0.0% (0/46)     lib/Plagger/Plugin/Widget/HatenaBookmarkUsersCount.pm
2.1% (1/47)     lib/Plagger/Plugin/Widget/BloglinesSubscription.pm
0.0% (0/101)    lib/Plagger/Plugin/Widget/Simple.pm
0.0% (0/31)     lib/Plagger/Plugin/Widget/BulkfeedsSpamReport.pm
2.0% (1/49)     lib/Plagger/Plugin/Subscription/Config.pm
1.8% (1/55)     lib/Plagger/Plugin/Subscription/Odeo.pm
0.0% (0/100)    lib/Plagger/Plugin/Subscription/OPML.pm
0.0% (0/49)     lib/Plagger/Plugin/Subscription/HatenaRSS.pm
0.0% (0/38)     lib/Plagger/Plugin/Subscription/HatenaGroup.pm
1.5% (3/200)    lib/Plagger/Plugin/Subscription/Bloglines.pm
0.0% (0/48)     lib/Plagger/Plugin/Subscription/DBI.pm
2.0% (1/50)     lib/Plagger/Plugin/Subscription/Planet.pm
0.0% (0/56)     lib/Plagger/Plugin/Subscription/PingServer.pm
0.0% (0/36)     lib/Plagger/Plugin/Subscription/PlanetINI.pm
0.0% (0/40)     lib/Plagger/Plugin/Subscription/2chThreadList.pm
0.0% (0/13)     lib/Plagger/Plugin/Subscription/XOXO.pm
2.5% (4/160)    lib/Plagger/Plugin/Subscription/LivedoorReader.pm
0.0% (0/46)     lib/Plagger/Plugin/Subscription/XPath.pm
0.0% (0/77)     lib/Plagger/Plugin/Subscription/FOAF.pm
0.0% (0/66)     lib/Plagger/Plugin/Subscription/File.pm
0.0% (0/43)     lib/Plagger/Plugin/Subscription/Bookmarks/Safari.pm
0.0% (0/14)     lib/Plagger/Plugin/Subscription/Bookmarks/Mozilla.pm
5.4% (2/37)     lib/Plagger/Plugin/Subscription/Bookmarks/InternetExplorer.pm
1.7% (1/58)     lib/Plagger/Plugin/Subscription/Bookmarks.pm
1.4% (1/73)     lib/Plagger/Plugin/Subscription/Feed.pm
1.8% (1/55)     lib/Plagger/Plugin/Filter/SpamAssassin.pm
0.0% (0/24)     lib/Plagger/Plugin/Filter/FeedFlareStripper.pm
0.0% (0/29)     lib/Plagger/Plugin/Filter/TTP.pm
0.0% (0/27)     lib/Plagger/Plugin/Filter/HatenaFormat.pm
0.0% (0/41)     lib/Plagger/Plugin/Filter/RSSTimeZoneString.pm
0.0% (0/48)     lib/Plagger/Plugin/Filter/HatenaDiaryKeywordLink.pm
0.0% (0/29)     lib/Plagger/Plugin/Filter/Emoticon.pm
0.0% (0/51)     lib/Plagger/Plugin/Filter/RSSLiberalDateTime.pm
1.7% (1/59)     lib/Plagger/Plugin/Filter/BulkfeedsTerms.pm
4.3% (2/46)     lib/Plagger/Plugin/Filter/tDiaryComment.pm
0.0% (0/21)     lib/Plagger/Plugin/Filter/FloatingDateTime.pm
0.0% (0/80)     lib/Plagger/Plugin/Filter/Delicious.pm
0.0% (0/69)     lib/Plagger/Plugin/Filter/URLBL.pm
0.0% (0/42)     lib/Plagger/Plugin/Filter/HatenaBookmarkUsersCount.pm
2.5% (1/40)     lib/Plagger/Plugin/Filter/HatenaBookmarkTag.pm
0.0% (0/27)     lib/Plagger/Plugin/Filter/DeliciousFeedTags.pm
6.2% (3/48)     lib/Plagger/Plugin/Filter/FeedBurnerPermalink.pm
0.0% (0/35)     lib/Plagger/Plugin/Filter/ResolveRelativeLink.pm
0.0% (0/25)     lib/Plagger/Plugin/Filter/2chNewsokuTitle.pm
0.0% (0/32)     lib/Plagger/Plugin/Filter/Regexp.pm
0.0% (0/27)     lib/Plagger/Plugin/Filter/BlogPet.pm
0.0% (0/77)     lib/Plagger/Plugin/Filter/Pipe.pm
1.5% (1/65)     lib/Plagger/Plugin/Filter/ImageInfo.pm
0.0% (0/69)     lib/Plagger/Plugin/Filter/StripRSSAd.pm
2.4% (7/290)    lib/Plagger/Plugin/Filter/EntryFullText.pm
0.0% (0/22)     lib/Plagger/Plugin/Filter/Profanity.pm
0.0% (0/57)     lib/Plagger/Plugin/Filter/Base.pm
0.0% (0/102)    lib/Plagger/Plugin/Filter/POPFile.pm
5.6% (3/54)     lib/Plagger/Plugin/Filter/Thumbnail.pm
0.0% (0/17)     lib/Plagger/Plugin/Filter/Romanize/Japanese.pm
2.1% (4/193)    lib/Plagger/Plugin/Filter/FindEnclosures.pm
0.0% (0/37)     lib/Plagger/Plugin/Filter/Rule.pm
0.0% (0/25)     lib/Plagger/Plugin/Filter/Romanize.pm
0.0% (0/23)     lib/Plagger/Plugin/Filter/StripTagsFromTitle.pm
0.0% (0/112)    lib/Plagger/Plugin/Filter/Babelfish.pm
2.2% (3/139)    lib/Plagger/Plugin/Filter/TruePermalink.pm
3.0% (2/66)     lib/Plagger/Plugin/Filter/FetchEnclosure.pm
8.8% (3/34)     lib/Plagger/Plugin/Filter/TagsToTitle.pm
0.0% (0/28)     lib/Plagger/Plugin/Filter/BloglinesContentNormalize.pm
0.0% (0/37)     lib/Plagger/Plugin/Filter/2chRSSContent.pm
0.0% (0/93)     lib/Plagger/Plugin/Filter/HTMLScrubber.pm
0.0% (0/42)     lib/Plagger/Plugin/Filter/RewriteEnclosureURL.pm
0.0% (0/27)     lib/Plagger/Plugin/Filter/HatenaDiaryKeywordUnlink.pm
0.0% (0/88)     lib/Plagger/Plugin/Filter/HEADEnclosureMetadata.pm
0.0% (0/29)     lib/Plagger/Plugin/Filter/BreakEntriesToFeeds.pm
2.8% (5/176)    lib/Plagger/Plugin/Filter/FetchEnclosure/Xango.pm
3.7% (4/109)    lib/Plagger/Plugin/Filter/FetchEnclosure/Wget.pm
3.3% (3/91)     lib/Plagger/Plugin/Filter/FetchEnclosure/ParallelUA.pm
4.0% (4/100)    lib/Plagger/Plugin/Filter/FetchEnclosure/Curl.pm
3.7% (3/81)     lib/Plagger/Plugin/Filter/FetchEnclosure/HTTPAsync.pm
3.5% (5/141)    lib/Plagger/Plugin/Filter/GuessLanguage.pm
0.0% (0/30)     lib/Plagger/Plugin/Filter/Markdown.pm
0.0% (0/41)     lib/Plagger/Plugin/Filter/CompositeFeed.pm
6.5% (2/31)     lib/Plagger/Plugin/Filter/AtomLinkRelated.pm
0.0% (0/28)     lib/Plagger/Plugin/Filter/HatenaKeywordTag.pm
0.0% (0/27)     lib/Plagger/Plugin/Filter/LivedoorKeywordUnlink.pm
0.0% (0/55)     lib/Plagger/Plugin/Filter/TinyURL.pm
0.0% (0/43)     lib/Plagger/Plugin/Filter/ExtractAuthorName.pm
0.0% (0/160)    lib/Plagger/Plugin/Search/Rast.pm
2.8% (2/72)     lib/Plagger/Plugin/Search/Namazu.pm
1.4% (1/71)     lib/Plagger/Plugin/Search/Spotlight.pm
0.0% (0/92)     lib/Plagger/Plugin/Search/Estraier.pm
1.0% (1/100)    lib/Plagger/Plugin/Search/KinoSearch.pm
0.0% (0/49)     lib/Plagger/Plugin/SmartFeed.pm
0.0% (0/67)     lib/Plagger/Plugin/Publish/JavaScript.pm
0.0% (0/41)     lib/Plagger/Plugin/Publish/OPML.pm
0.0% (0/131)    lib/Plagger/Plugin/Publish/CHTML.pm
0.0% (0/32)     lib/Plagger/Plugin/Publish/Playlog.pm
0.0% (0/32)     lib/Plagger/Plugin/Publish/Speech.pm
0.0% (0/37)     lib/Plagger/Plugin/Publish/PDF.pm
4.0% (10/249)   lib/Plagger/Plugin/Publish/Gmail.pm
2.7% (2/73)     lib/Plagger/Plugin/Publish/MT.pm
0.0% (0/49)     lib/Plagger/Plugin/Publish/Delicious.pm
0.9% (2/212)    lib/Plagger/Plugin/Publish/Maildir.pm
2.1% (2/97)     lib/Plagger/Plugin/Publish/Planet.pm
0.0% (0/87)     lib/Plagger/Plugin/Publish/MTWidget.pm
0.0% (0/120)    lib/Plagger/Plugin/Publish/IMAP.pm
0.0% (0/61)     lib/Plagger/Plugin/Publish/HatenaBookmark.pm
0.0% (0/26)     lib/Plagger/Plugin/Publish/Debug.pm
0.0% (0/85)     lib/Plagger/Plugin/Publish/CSV.pm
1.8% (1/56)     lib/Plagger/Plugin/Publish/Speech/Win32.pm
7.8% (8/102)    lib/Plagger/Plugin/Publish/Speech/MacOSX.pm
0.0% (0/34)     lib/Plagger/Plugin/Publish/Pipe.pm
0.0% (0/35)     lib/Plagger/Plugin/Publish/PSP.pm
3.9% (7/179)    lib/Plagger/Plugin/Publish/Feed.pm
0.0% (0/83)     lib/Plagger/Plugin/Publish/Takahashi.pm
4.8% (5/105)    lib/Plagger/Plugin/Publish/2chdat.pm
1.8% (2/111)    lib/Plagger/Plugin/Publish/PalmDoc.pm
3.6% (2/55)     lib/Plagger/Plugin/Publish/OutlineText.pm
0.0% (0/190)    lib/Plagger/Plugin/Publish/SWF.pm
0.0% (0/52)     lib/Plagger/Plugin/Publish/JSON.pm
1.0% (1/102)    lib/Plagger/Plugin/Publish/LivedoorClip.pm
2.0% (2/98)     lib/Plagger/Plugin/Publish/PowerPoint.pm
0.0% (0/39)     lib/Plagger/Plugin/Publish/FOAFRoll.pm
0.0% (0/54)     lib/Plagger/Plugin/Publish/Excel.pm
0.0% (0/53)     lib/Plagger/Plugin/Publish/Serializer.pm
0.9% (1/115)    lib/Plagger/Plugin/Notify/Campfire.pm
0.0% (0/97)     lib/Plagger/Plugin/Notify/SSTP.pm
0.0% (0/40)     lib/Plagger/Plugin/Notify/Eject.pm
0.0% (0/39)     lib/Plagger/Plugin/Notify/Growl.pm
0.0% (0/56)     lib/Plagger/Plugin/Notify/IRC.pm
2.1% (2/97)     lib/Plagger/Plugin/Notify/MSAgent.pm
0.0% (0/9)      lib/Plagger/Plugin/Notify/Eject/darwin.pm
0.0% (0/9)      lib/Plagger/Plugin/Notify/Eject/freebsd.pm
0.0% (0/9)      lib/Plagger/Plugin/Notify/Eject/linux.pm
0.0% (0/10)     lib/Plagger/Plugin/Notify/Eject/mswin32.pm
2.7% (2/74)     lib/Plagger/Plugin/Notify/Tiarra.pm
0.0% (0/44)     lib/Plagger/Plugin/Notify/NetSend.pm
0.0% (0/32)     lib/Plagger/Plugin/Notify/UpdatePing.pm
0.0% (0/34)     lib/Plagger/Plugin/Notify/Beep.pm
0.0% (0/63)     lib/Plagger/Plugin/Notify/Balloon.pm
1.6% (1/63)     lib/Plagger/Plugin/Notify/Audio.pm
0.0% (0/16)     lib/Plagger/Plugin/Notify/Audio/MSWin32.pm
0.0% (0/19)     lib/Plagger/Plugin/Notify/Audio/iTunesMac.pm
0.0% (0/16)     lib/Plagger/Plugin/Notify/Audio/iTunesWin32.pm
0.0% (0/39)     lib/Plagger/Plugin/Notify/Command.pm
3.4% (1/29)     lib/Plagger/Plugin/SmartFeed/All.pm
2.0% (1/50)     lib/Plagger/Plugin/CustomFeed/Debug.pm
3.1% (6/195)    lib/Plagger/Plugin/CustomFeed/Mixi.pm
0.0% (0/133)    lib/Plagger/Plugin/CustomFeed/AmazonAssociateReportJP.pm
0.0% (0/184)    lib/Plagger/Plugin/CustomFeed/Frepa.pm
1.0% (1/100)    lib/Plagger/Plugin/CustomFeed/Mailman.pm
2.6% (4/155)    lib/Plagger/Plugin/CustomFeed/iTunesRecentPlay.pm
0.0% (0/127)    lib/Plagger/Plugin/CustomFeed/FlickrSearch.pm
0.0% (0/98)     lib/Plagger/Plugin/CustomFeed/POP3.pm
3.7% (5/136)    lib/Plagger/Plugin/CustomFeed/YouTube.pm
0.0% (0/118)    lib/Plagger/Plugin/CustomFeed/SVNLog.pm
0.0% (0/47)     lib/Plagger/Plugin/CustomFeed/Frepa/FriendStatus.pm
0.0% (0/79)     lib/Plagger/Plugin/CustomFeed/Frepa/FriendDiary.pm
1.8% (1/56)     lib/Plagger/Plugin/CustomFeed/Frepa/RecentComment.pm
0.0% (0/92)     lib/Plagger/Plugin/CustomFeed/PerlMonks.pm
0.0% (0/81)     lib/Plagger/Plugin/CustomFeed/Simple.pm
3.8% (5/131)    lib/Plagger/Plugin/CustomFeed/2chSearch.pm
0.0% (0/95)     lib/Plagger/Plugin/CustomFeed/ForrentSearch.pm
2.2% (2/91)     lib/Plagger/Plugin/CustomFeed/BloglinesCitations.pm
1.4% (1/71)     lib/Plagger/Plugin/CustomFeed/GoogleNews.pm
1.6% (2/128)    lib/Plagger/Plugin/CustomFeed/MixiDiarySearch.pm
0.0% (0/71)     lib/Plagger/Plugin/CustomFeed/MealMasterZip.pm
0.9% (1/113)    lib/Plagger/Plugin/Bundle/Planet.pm
0.0% (0/28)     lib/Plagger/Plugin/UserAgent/AuthenRequest.pm
0.0% (0/23)     lib/Plagger/Plugin/UserAgent/RequestHeader.pm
0.0% (0/35)     lib/Plagger/Subscription.pm
0.0% (0/24)     lib/Plagger/Cache/Null.pm
2.4% (1/42)     lib/Plagger/Rules.pm
0.0% (0/28)     lib/Plagger/Operator.pm
0.0% (0/38)     lib/Plagger/Rule/Rating.pm
0.0% (0/37)     lib/Plagger/Rule/FeedType.pm
3.2% (3/95)     lib/Plagger/Rule/Fresh.pm
0.0% (0/46)     lib/Plagger/Rule/EntryTag.pm
0.0% (0/26)     lib/Plagger/Rule/DateTimeCron.pm
0.0% (0/71)     lib/Plagger/Rule/FeedAttr.pm
0.0% (0/14)     lib/Plagger/Rule/Expression.pm
0.0% (0/7)      lib/Plagger/Rule/Always.pm
0.0% (0/54)     lib/Plagger/Rule/URLBL.pm
0.0% (0/28)     lib/Plagger/Rule/Deduped/DB_File.pm
0.0% (0/47)     lib/Plagger/Rule/Deduped/Base.pm
0.0% (0/43)     lib/Plagger/Rule/Deduped.pm
2.7% (4/147)    lib/Plagger/UserAgent.pm
1.2% (2/164)    lib/Plagger/Plugin.pm
1.9% (2/105)    lib/Plagger/Entry.pm
3.5% (5/144)    lib/Plagger/Feed.pm
1.8% (2/112)    lib/Plagger/Cache.pm
0.0% (0/18)     lib/Plagger/Crypt/Base64.pm
0.0% (0/29)     lib/Plagger/Crypt.pm
2.0% (1/49)     lib/Plagger/Enclosure.pm
0.0% (0/74)     lib/Plagger/ConfigLoader.pm
1.8% (1/55)     lib/Plagger/Cookies.pm
0.0% (0/16)     lib/Plagger/Mechanize.pm
0.0% (0/96)     lib/Plagger/Walker.pm
1.8% (1/57)     lib/Plagger/FeedParser.pm
1.1% (5/436)    lib/Plagger.pm
---------------------------------------
1.4% (205/14806)        Total