Changeset 5519


Ignore:
Timestamp:
06/23/09 21:03:01 (3 years ago)
Author:
azawawi
Message:

[Perl 6] more comment documentation on quick fixes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Padre-Plugin-Perl6/lib/Padre/Plugin/Perl6/Perl6Document.pm

    r5518 r5519  
    239239                my $var_name = $1; 
    240240 
     241                # Fixes the following: 
     242                #   $foo = 1; 
     243                # into: 
     244                #   my $foo; 
     245                #   $foo = 1; 
    241246                push @items, { 
    242247                    text     => sprintf( Wx::gettext('Insert declaration for %s'), $var_name), 
     
    265270                foreach my $keyword (@flow_control_keywords) { 
    266271                    if($keyword eq $routine_name) { 
     272                        # Fixes the following: 
     273                        #   if() { };  
     274                        # into: 
     275                        #   if () { }; 
    267276                        push @items, { 
    268277                            text     => sprintf( Wx::gettext('Insert a space after %s'), $keyword ), 
     
    281290                    } 
    282291                } 
     292                # Fixes the following: 
     293                #   foo(); 
     294                # into: 
     295                #   sub foo() { 
     296                #       #XXX-implement 
     297                #   } 
     298                #   foo(); 
    283299                push @items, { 
    284300                    text     => sprintf( Wx::gettext('Insert routine %s'), $routine_name), 
     
    300316            } elsif($issue_msg =~ /^Obsolete use of . to concatenate strings/i) { 
    301317 
     318                # Fixes the following: 
     319                #   $string = "a" . "b"; 
     320                # into: 
     321                #   $string = "a" ~ "b"; 
    302322                push @items, { 
    303323                    text     => Wx::gettext('Use ~ instead of . for string concatenation'), 
     
    315335            } elsif($issue_msg =~ /^Obsolete use of -> to call a method/i) { 
    316336 
     337                # Fixes the following: 
     338                #   P->foo; 
     339                # into: 
     340                #   P.foo; 
    317341                push @items, { 
    318342                    text     => Wx::gettext('Use . for method call'), 
     
    330354            } elsif($issue_msg =~ /^Obsolete use of C\+\+ constructor syntax/i) { 
    331355 
     356                # Fixes the following: 
     357                #   new Foo; 
     358                # into: 
     359                #   Foo.new; 
    332360                push @items, { 
    333361                    text     => Wx::gettext('Use Perl 6 constructor syntax'), 
     
    346374            } elsif($issue_msg =~ /^Obsolete use of C-style "for \(;;\)" loop/i) { 
    347375 
     376                # Fixes the following: 
     377                #   for(;;) { }; 
     378                # into: 
     379                #   loop(;;) { }; 
    348380                push @items, { 
    349381                    text     => Wx::gettext('Use loop (;;) for looping'), 
     
    361393            } elsif($issue_msg =~ /^Obsolete use of \[-1\] subscript to access final element/i) { 
    362394 
     395                # Fixes the following: 
     396                #   [-1]; 
     397                # into: 
     398                #   [*-1]; 
    363399                push @items, { 
    364400                    text     => Wx::gettext('Use [*-1] to access final element'), 
     
    376412            } elsif($issue_msg =~ /^Obsolete use of rand\(N\)/i) { 
    377413             
     414                # Fixes the following: 
     415                #   rand(10); 
     416                # into: 
     417                #   10.pick; 
    378418                push @items, { 
    379419                    text     => Wx::gettext('Use N.pick for a random number'), 
     
    389429                }; 
    390430 
     431                # Fixes the following: 
     432                #   rand(10); 
     433                # into: 
     434                #   (1..10).pick; 
    391435                push @items, { 
    392436                    text     => Wx::gettext('Use (1..N).pick for a random number'), 
     
    404448            } elsif($issue_msg =~ /^Please use \.\.\* for indefinite range/i) { 
    405449 
     450                # Fixes the following: 
     451                #   [1..]; 
     452                # into: 
     453                #   [1..*]; 
    406454                push @items, { 
    407455                    text     => Wx::gettext('Use [N..*] for indefinite range'), 
     
    419467            } elsif($issue_msg =~ /^Please use \!\! rather than \:\:/i) { 
    420468 
     469                # Fixes the following: 
     470                #   1 == 2 ?? 1 :: 2; 
     471                # into: 
     472                #   1 == 2 ?? 1 !! 2; 
    421473                push @items, { 
    422474                    text     => Wx::gettext('Use !! for conditional operator else clause'), 
     
    435487 
    436488                # Fixes errors like: 
    437                 # 42 ?? 1,2,3 Z 4,5,6 !! 1,2,3 X 4,5,6; 
    438                 # into: 
    439                 # 42 ?? (1,2,3 Z 4,5,6) !! 1,2,3 X 4,5,6; 
     489                #   42 ?? 1,2,3 Z 4,5,6 !! 1,2,3 X 4,5,6; 
     490                # into: 
     491                #   42 ?? (1,2,3 Z 4,5,6) !! 1,2,3 X 4,5,6; 
    440492                push @items, { 
    441493                    text     => Wx::gettext('Use ?? (...) !! to avoid precedence bugs'), 
     
    455507 
    456508                # Fixes the following: 
    457                 # (1 == 1) ? 1 : 2 
    458                 # into: 
    459                 # (1 == 1) ?? 1 !! 2 
     509                #   (1 == 1) ? 1 : 2 
     510                # into: 
     511                #   (1 == 1) ?? 1 !! 2 
    460512                push @items, { 
    461513                    text     => Wx::gettext('Use ?? !! for the conditional operator'), 
     
    474526 
    475527                # Fixes the following: 
    476                 # $string .= "a"; 
    477                 # into: 
    478                 # $string ~= "a"; 
     528                #   $string .= "a"; 
     529                # into: 
     530                #   $string ~= "a"; 
    479531                push @items, { 
    480532                    text     => Wx::gettext('Use ~= for string concatenation'), 
     
    493545 
    494546                # Fixes the following: 
    495                 # $string =~ /abc/; 
    496                 # into: 
    497                 # $string ~~ /abc/; 
     547                #   $string =~ /abc/; 
     548                # into: 
     549                #   $string ~~ /abc/; 
    498550                push @items, { 
    499551                    text     => Wx::gettext('Use ~~ for pattern matching'), 
     
    512564 
    513565                # Fixes the following: 
    514                 # $string !~ /abc/; 
    515                 # into: 
    516                 # $string !~~ /abc/; 
     566                #   $string !~ /abc/; 
     567                # into: 
     568                #   $string !~~ /abc/; 
    517569                push @items, { 
    518570                    text     => Wx::gettext('Use !~~ for negated pattern matching'), 
     
    531583 
    532584                # Fixes the following: 
    533                 # 2 >> 1; 
    534                 # into: 
    535                 # 2 +> 1; 
     585                #   2 >> 1; 
     586                # into: 
     587                #   2 +> 1; 
    536588                push @items, { 
    537589                    text     => Wx::gettext('Use +> for numeric right shift'), 
     
    548600             
    549601                # Fixes the following: 
    550                 # 100 >> 1; 
    551                 # into: 
    552                 # 100 ~> 1; 
     602                #   100 >> 1; 
     603                # into: 
     604                #   100 ~> 1; 
    553605                push @items, { 
    554606                    text     => Wx::gettext('Use ~> for string right shift'), 
     
    566618 
    567619                # Fixes the following: 
    568                 # 2 << 1; 
    569                 # into: 
    570                 # 2 +< 1; 
     620                #   2 << 1; 
     621                # into: 
     622                #   2 +< 1; 
    571623                push @items, { 
    572624                    text     => Wx::gettext('Use +< for numeric left shift'), 
     
    583635             
    584636                # Fixes the following: 
    585                 # 100 << 1; 
    586                 # into: 
    587                 # 100 ~< 1; 
     637                #   100 << 1; 
     638                # into: 
     639                #   100 ~< 1; 
    588640                push @items, { 
    589641                    text     => Wx::gettext('Use ~< for string left shift'), 
     
    602654 
    603655                # Fixes the following: 
    604                 # $@; 
    605                 # into: 
    606                 # $!; 
     656                #   $@; 
     657                # into: 
     658                #   $!; 
    607659                push @items, { 
    608660                    text     => Wx::gettext('Use $! for eval errors'), 
     
    621673 
    622674                # Fixes the following: 
    623                 # $]; 
    624                 # into: 
    625                 # $::PERL_VERSION; 
     675                #   $]; 
     676                # into: 
     677                #   $::PERL_VERSION; 
    626678                push @items, { 
    627679                    text     => Wx::gettext('Use $::PERL_VERSION'), 
     
    649701            my $issue_line_no = $issue->{line} - 1; 
    650702            if($issue_line_no == $current_line_no) { 
     703                # Fixes the following: 
     704                #   some_weird_error(); 
     705                # into: 
     706                #   # some_weird_error(); 
    651707                push @items, { 
    652708                    text     => Wx::gettext('Comment error line'), 
     
    672728        if($selected_text && $selected_text =~ /[\n\r]/) { 
    673729             
     730            # Fixes the following: 
     731            #   faulty_code(); 
     732            # into: 
     733            #   try { 
     734            #       faulty_code(); 
     735            # 
     736            #       CATCH { 
     737            #           warn "oops: $!"; 
     738            #       } 
     739            #   } 
     740 
    674741            push @items, { 
    675742                text     => Wx::gettext('Surround with try { ... }'), 
Note: See TracChangeset for help on using the changeset viewer.