Ticket #554 (closed cage: fixed)

Opened 13 years ago

Last modified 13 years ago

[CAGE] coding standard for PIR files

Reported by: fperrad Owned by: fperrad
Priority: normal Milestone:
Component: none Version:
Severity: medium Keywords:
Cc: jkeen@… Language:
Patch status: Platform:

Description

currently, t/distro/file_metadata.t checks the presence of svn:keywords (including Id) in PIR files, but t/codingstd/svn_id.t doesn't check PIR files (only C, Perl & Makefile).

Do we add this check ?

Change History

in reply to: ↑ description   Changed 13 years ago by jkeenan

Replying to fperrad:

Do we add this check ?

As petdance would say, "Patches welcome!"

There already exists Parrot::Distribution::get_pir_language_files(), so it should not be too difficult to do this.

Thank you very much.
kid51

follow-up: ↓ 3   Changed 13 years ago by fperrad

  • owner set to fperrad
  • status changed from new to assigned

Done with r38114 & r38115.

But currently, the test fails : the file examples/pir/quine_ord.pir must be handled as an exception.

in reply to: ↑ 2   Changed 13 years ago by jkeenan

  • cc jkeen@… added

Replying to fperrad:

Done with r38114 & r38115. But currently, the test fails : the file examples/pir/quine_ord.pir must be handled as an exception.

We can handle that with r38139.

$ svn diff -r 38114:38139  t/codingstd/svn_id.t
Index: t/codingstd/svn_id.t
===================================================================
--- t/codingstd/svn_id.t        (revision 38114)
+++ t/codingstd/svn_id.t        (revision 38139)
@@ -4,8 +4,9 @@
 
 use strict;
 use warnings;
+use Cwd;
+use File::Spec ();
 use lib qw( . lib ../lib ../../lib );
-
 use Parrot::Distribution;
 use Test::More            tests => 1;
 
@@ -34,23 +35,34 @@
 =cut
 
 my $DIST = Parrot::Distribution->new;
+my $cwd = cwd();
 
-my @files = @ARGV ? <@ARGV> : (
-    $DIST->get_c_language_files(),
-    $DIST->get_make_language_files(),
-    $DIST->get_perl_language_files(),
-    $DIST->get_pir_language_files(),
+# Certain files, for various reasons, cannot have an
+# SVN Id tag.  We exclude them from examination by this test.
+
+my %known_exceptions = map {
+        $_ => 1,
+        ( File::Spec->catdir( $cwd, $_ ) ) => 1,
+    } qw(
+        examples/pir/quine_ord.pir
+    );
+
+my @files = grep { ! $known_exceptions{$_} }
+    ( @ARGV
+        ? <@ARGV>
+        : map { $_->path } (
+            $DIST->get_c_language_files(),
+            $DIST->get_make_language_files(),
+            $DIST->get_perl_language_files(),
+            $DIST->get_pir_language_files(),
+        )
 );
 my @no_id_files;
 
 foreach my $file (@files) {
 
-    # if we have command line arguments, the file is the full path
-    # otherwise, use the relevant Parrot:: path method
-    my $path = @ARGV ? $file : $file->path;
+    my $buf = $DIST->slurp($file);
 
-    my $buf = $DIST->slurp($path);
-
     if ( $buf !~ m/\$Id
                    (?:
                     \$       # unexpanded tag, for git-svn users or for new files
@@ -58,7 +70,7 @@
                     :.*\$    # expanded tag, colon required
                    )
                   /xm ) {
-        push @no_id_files, $path;
+        push @no_id_files, $file;
         next;
     }
 }

  Changed 13 years ago by fperrad

  • status changed from assigned to closed
  • resolution set to fixed

  Changed 13 years ago by coke

  • status changed from closed to reopened
  • resolution fixed deleted

The updates here changed:

examples/streams/FileLines.pir

which has this POD near the top:

=head1 NOTE

When updating this file, be sure to verify L<t/examples/streams.t>, as its
tests rely on the content of this file.

This test is now failing:

t/examples/streams.t (Wstat: 512 Tests: 12 Failed: 2)
  Failed tests:  1-2

  Changed 13 years ago by fperrad

  • status changed from reopened to closed
  • resolution set to fixed

fixed by r38235.

Note: See TracTickets for help on using tickets.