Changeset 5519
- Timestamp:
- 06/23/09 21:03:01 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Padre-Plugin-Perl6/lib/Padre/Plugin/Perl6/Perl6Document.pm
r5518 r5519 239 239 my $var_name = $1; 240 240 241 # Fixes the following: 242 # $foo = 1; 243 # into: 244 # my $foo; 245 # $foo = 1; 241 246 push @items, { 242 247 text => sprintf( Wx::gettext('Insert declaration for %s'), $var_name), … … 265 270 foreach my $keyword (@flow_control_keywords) { 266 271 if($keyword eq $routine_name) { 272 # Fixes the following: 273 # if() { }; 274 # into: 275 # if () { }; 267 276 push @items, { 268 277 text => sprintf( Wx::gettext('Insert a space after %s'), $keyword ), … … 281 290 } 282 291 } 292 # Fixes the following: 293 # foo(); 294 # into: 295 # sub foo() { 296 # #XXX-implement 297 # } 298 # foo(); 283 299 push @items, { 284 300 text => sprintf( Wx::gettext('Insert routine %s'), $routine_name), … … 300 316 } elsif($issue_msg =~ /^Obsolete use of . to concatenate strings/i) { 301 317 318 # Fixes the following: 319 # $string = "a" . "b"; 320 # into: 321 # $string = "a" ~ "b"; 302 322 push @items, { 303 323 text => Wx::gettext('Use ~ instead of . for string concatenation'), … … 315 335 } elsif($issue_msg =~ /^Obsolete use of -> to call a method/i) { 316 336 337 # Fixes the following: 338 # P->foo; 339 # into: 340 # P.foo; 317 341 push @items, { 318 342 text => Wx::gettext('Use . for method call'), … … 330 354 } elsif($issue_msg =~ /^Obsolete use of C\+\+ constructor syntax/i) { 331 355 356 # Fixes the following: 357 # new Foo; 358 # into: 359 # Foo.new; 332 360 push @items, { 333 361 text => Wx::gettext('Use Perl 6 constructor syntax'), … … 346 374 } elsif($issue_msg =~ /^Obsolete use of C-style "for \(;;\)" loop/i) { 347 375 376 # Fixes the following: 377 # for(;;) { }; 378 # into: 379 # loop(;;) { }; 348 380 push @items, { 349 381 text => Wx::gettext('Use loop (;;) for looping'), … … 361 393 } elsif($issue_msg =~ /^Obsolete use of \[-1\] subscript to access final element/i) { 362 394 395 # Fixes the following: 396 # [-1]; 397 # into: 398 # [*-1]; 363 399 push @items, { 364 400 text => Wx::gettext('Use [*-1] to access final element'), … … 376 412 } elsif($issue_msg =~ /^Obsolete use of rand\(N\)/i) { 377 413 414 # Fixes the following: 415 # rand(10); 416 # into: 417 # 10.pick; 378 418 push @items, { 379 419 text => Wx::gettext('Use N.pick for a random number'), … … 389 429 }; 390 430 431 # Fixes the following: 432 # rand(10); 433 # into: 434 # (1..10).pick; 391 435 push @items, { 392 436 text => Wx::gettext('Use (1..N).pick for a random number'), … … 404 448 } elsif($issue_msg =~ /^Please use \.\.\* for indefinite range/i) { 405 449 450 # Fixes the following: 451 # [1..]; 452 # into: 453 # [1..*]; 406 454 push @items, { 407 455 text => Wx::gettext('Use [N..*] for indefinite range'), … … 419 467 } elsif($issue_msg =~ /^Please use \!\! rather than \:\:/i) { 420 468 469 # Fixes the following: 470 # 1 == 2 ?? 1 :: 2; 471 # into: 472 # 1 == 2 ?? 1 !! 2; 421 473 push @items, { 422 474 text => Wx::gettext('Use !! for conditional operator else clause'), … … 435 487 436 488 # 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; 440 492 push @items, { 441 493 text => Wx::gettext('Use ?? (...) !! to avoid precedence bugs'), … … 455 507 456 508 # Fixes the following: 457 # (1 == 1) ? 1 : 2458 # into: 459 # (1 == 1) ?? 1 !! 2509 # (1 == 1) ? 1 : 2 510 # into: 511 # (1 == 1) ?? 1 !! 2 460 512 push @items, { 461 513 text => Wx::gettext('Use ?? !! for the conditional operator'), … … 474 526 475 527 # Fixes the following: 476 # $string .= "a";477 # into: 478 # $string ~= "a";528 # $string .= "a"; 529 # into: 530 # $string ~= "a"; 479 531 push @items, { 480 532 text => Wx::gettext('Use ~= for string concatenation'), … … 493 545 494 546 # Fixes the following: 495 # $string =~ /abc/;496 # into: 497 # $string ~~ /abc/;547 # $string =~ /abc/; 548 # into: 549 # $string ~~ /abc/; 498 550 push @items, { 499 551 text => Wx::gettext('Use ~~ for pattern matching'), … … 512 564 513 565 # Fixes the following: 514 # $string !~ /abc/;515 # into: 516 # $string !~~ /abc/;566 # $string !~ /abc/; 567 # into: 568 # $string !~~ /abc/; 517 569 push @items, { 518 570 text => Wx::gettext('Use !~~ for negated pattern matching'), … … 531 583 532 584 # Fixes the following: 533 # 2 >> 1;534 # into: 535 # 2 +> 1;585 # 2 >> 1; 586 # into: 587 # 2 +> 1; 536 588 push @items, { 537 589 text => Wx::gettext('Use +> for numeric right shift'), … … 548 600 549 601 # Fixes the following: 550 # 100 >> 1;551 # into: 552 # 100 ~> 1;602 # 100 >> 1; 603 # into: 604 # 100 ~> 1; 553 605 push @items, { 554 606 text => Wx::gettext('Use ~> for string right shift'), … … 566 618 567 619 # Fixes the following: 568 # 2 << 1;569 # into: 570 # 2 +< 1;620 # 2 << 1; 621 # into: 622 # 2 +< 1; 571 623 push @items, { 572 624 text => Wx::gettext('Use +< for numeric left shift'), … … 583 635 584 636 # Fixes the following: 585 # 100 << 1;586 # into: 587 # 100 ~< 1;637 # 100 << 1; 638 # into: 639 # 100 ~< 1; 588 640 push @items, { 589 641 text => Wx::gettext('Use ~< for string left shift'), … … 602 654 603 655 # Fixes the following: 604 # $@;605 # into: 606 # $!;656 # $@; 657 # into: 658 # $!; 607 659 push @items, { 608 660 text => Wx::gettext('Use $! for eval errors'), … … 621 673 622 674 # Fixes the following: 623 # $];624 # into: 625 # $::PERL_VERSION;675 # $]; 676 # into: 677 # $::PERL_VERSION; 626 678 push @items, { 627 679 text => Wx::gettext('Use $::PERL_VERSION'), … … 649 701 my $issue_line_no = $issue->{line} - 1; 650 702 if($issue_line_no == $current_line_no) { 703 # Fixes the following: 704 # some_weird_error(); 705 # into: 706 # # some_weird_error(); 651 707 push @items, { 652 708 text => Wx::gettext('Comment error line'), … … 672 728 if($selected_text && $selected_text =~ /[\n\r]/) { 673 729 730 # Fixes the following: 731 # faulty_code(); 732 # into: 733 # try { 734 # faulty_code(); 735 # 736 # CATCH { 737 # warn "oops: $!"; 738 # } 739 # } 740 674 741 push @items, { 675 742 text => Wx::gettext('Surround with try { ... }'),
Note: See TracChangeset
for help on using the changeset viewer.
