grass-addons
grass-addons copied to clipboard
[Bug] Fix or replace i.pr Perl scripts which fail with perlcritic
Name of the addon
i.pr
Describe the bug
Perl scripts for i.pr in src/imagery/i.pr/PRLIB/
trigger warnings from the perl linter in Super-Linter.
To Reproduce
Run perlcritique or perl linter from Super-Linter.
perlcritic .
Expected behavior
No linter issues from the code and enabled Perl checks in Super-Linter.
Screenshots
perlcritic:
src/imagery/i.pr/PRLIB/extract_functions.pl: "require" statement with library name as string at line 3, column 1. Use a bareword instead. (Severity: 5)
src/imagery/i.pr/PRLIB/extract_functions.pl: Code before strictures are enabled at line 5, column 1. See page 429 of PBP. (Severity: 5)
src/imagery/i.pr/PRLIB/extract_functions.pl: Bareword file handle opened at line 23, column 6. See pages 202,204 of PBP. (Severity: 5)
src/imagery/i.pr/PRLIB/extract_functions.pl: Two-argument "open" used at line 23, column 6. See page 207 of PBP. (Severity: 5)
src/imagery/i.pr/PRLIB/extract_functions.pl: Bareword file handle opened at line 101, column 6. See pages 202,204 of PBP. (Severity: 5)
src/imagery/i.pr/PRLIB/extract_functions.pl: Two-argument "open" used at line 101, column 6. See page 207 of PBP. (Severity: 5)
src/imagery/i.pr/PRLIB/extract_ps.pl: Code before strictures are enabled at line 3, column 1. See page 429 of PBP. (Severity: 5)
Super-Linter GitHub Action:
2021-10-02T07:49:28.2420328Z File:[./src/imagery/i.pr/PRLIB/extract_functions.pl]
2021-10-02T07:49:28.2449902Z ERROR! Found errors in [perl] linter!
2021-10-02T07:49:28.2450831Z ERROR:[Global symbol "@files" requires explicit package name (did you forget to declare "my @files"?) at ./src/imagery/i.pr/PRLIB/extract_functions.pl line 9.
2021-10-02T07:49:28.2452068Z Global symbol "$nfiles" requires explicit package name (did you forget to declare "my $nfiles"?) at ./src/imagery/i.pr/PRLIB/extract_functions.pl line 11.
2021-10-02T07:49:28.2453307Z Global symbol "@files" requires explicit package name (did you forget to declare "my @files"?) at ./src/imagery/i.pr/PRLIB/extract_functions.pl line 11.
2021-10-02T07:49:28.2454512Z Global symbol "$done" requires explicit package name (did you forget to declare "my $done"?) at ./src/imagery/i.pr/PRLIB/extract_functions.pl line 12.
2021-10-02T07:49:28.2455706Z Global symbol "$opt_f" requires explicit package name (did you forget to declare "my $opt_f"?) at ./src/imagery/i.pr/PRLIB/extract_functions.pl line 14.
2021-10-02T07:49:28.2457183Z Global symbol "$nfiles" requires explicit package name (did you forget to declare "my $nfiles"?) at ./src/imagery/i.pr/PRLIB/extract_functions.pl line 15.
2021-10-02T07:49:28.2460711Z Global symbol "$name" requires explicit package name (did you forget to declare "my $name"?) at ./src/imagery/i.pr/PRLIB/extract_functions.pl line 16.
2021-10-02T07:49:28.2461971Z Global symbol "$extension" requires explicit package name (did you forget to declare "my $extension"?) at ./src/imagery/i.pr/PRLIB/extract_functions.pl line 16.
2021-10-02T07:49:28.2463252Z Global symbol "@files" requires explicit package name (did you forget to declare "my @files"?) at ./src/imagery/i.pr/PRLIB/extract_functions.pl line 16.
2021-10-02T07:49:28.2464451Z Global symbol "$nfiles" requires explicit package name (did you forget to declare "my $nfiles"?) at ./src/imagery/i.pr/PRLIB/extract_functions.pl line 16.
2021-10-02T07:49:28.2465715Z Global symbol "$extension" requires explicit package name (did you forget to declare "my $extension"?) at ./src/imagery/i.pr/PRLIB/extract_functions.pl line 17.
2021-10-02T07:49:28.2467017Z Global symbol "$extension" requires explicit package name (did you forget to declare "my $extension"?) at ./src/imagery/i.pr/PRLIB/extract_functions.pl line 17.
2021-10-02T07:49:28.2468245Z Global symbol "$done" requires explicit package name (did you forget to declare "my $done"?) at ./src/imagery/i.pr/PRLIB/extract_functions.pl line 18.
2021-10-02T07:49:28.2469440Z Global symbol "@files" requires explicit package name (did you forget to declare "my @files"?) at ./src/imagery/i.pr/PRLIB/extract_functions.pl line 19.
2021-10-02T07:49:28.2470666Z Global symbol "$nfiles" requires explicit package name (did you forget to declare "my $nfiles"?) at ./src/imagery/i.pr/PRLIB/extract_functions.pl line 19.
2021-10-02T07:49:28.2471666Z ./src/imagery/i.pr/PRLIB/extract_functions.pl had compilation errors.]
2021-10-02T07:49:28.2472594Z ---------------------------
2021-10-02T07:49:28.2473091Z File:[./src/imagery/i.pr/PRLIB/extract_ps.pl]
2021-10-02T07:49:28.2492165Z ERROR! Found errors in [perl] linter!
2021-10-02T07:49:28.2493045Z ERROR:[Global symbol "@files" requires explicit package name (did you forget to declare "my @files"?) at ./src/imagery/i.pr/PRLIB/extract_ps.pl line 4.
2021-10-02T07:49:28.2494222Z Global symbol "$nfiles" requires explicit package name (did you forget to declare "my $nfiles"?) at ./src/imagery/i.pr/PRLIB/extract_ps.pl line 6.
2021-10-02T07:49:28.2495347Z Global symbol "@files" requires explicit package name (did you forget to declare "my @files"?) at ./src/imagery/i.pr/PRLIB/extract_ps.pl line 6.
2021-10-02T07:49:28.2496737Z Global symbol "$nfiles" requires explicit package name (did you forget to declare "my $nfiles"?) at ./src/imagery/i.pr/PRLIB/extract_ps.pl line 9.
2021-10-02T07:49:28.2497868Z Global symbol "$name" requires explicit package name (did you forget to declare "my $name"?) at ./src/imagery/i.pr/PRLIB/extract_ps.pl line 10.
2021-10-02T07:49:28.2499038Z Global symbol "$extension" requires explicit package name (did you forget to declare "my $extension"?) at ./src/imagery/i.pr/PRLIB/extract_ps.pl line 10.
2021-10-02T07:49:28.2500225Z Global symbol "@files" requires explicit package name (did you forget to declare "my @files"?) at ./src/imagery/i.pr/PRLIB/extract_ps.pl line 10.
2021-10-02T07:49:28.2501351Z Global symbol "$nfiles" requires explicit package name (did you forget to declare "my $nfiles"?) at ./src/imagery/i.pr/PRLIB/extract_ps.pl line 10.
2021-10-02T07:49:28.2503175Z Global symbol "$extension" requires explicit package name (did you forget to declare "my $extension"?) at ./src/imagery/i.pr/PRLIB/extract_ps.pl line 11.
2021-10-02T07:49:28.2504888Z Global symbol "$extension" requires explicit package name (did you forget to declare "my $extension"?) at ./src/imagery/i.pr/PRLIB/extract_ps.pl line 11.
2021-10-02T07:49:28.2506189Z Global symbol "$out" requires explicit package name (did you forget to declare "my $out"?) at ./src/imagery/i.pr/PRLIB/extract_ps.pl line 12.
2021-10-02T07:49:28.2507304Z Global symbol "$name" requires explicit package name (did you forget to declare "my $name"?) at ./src/imagery/i.pr/PRLIB/extract_ps.pl line 12.
2021-10-02T07:49:28.2508426Z Global symbol "@files" requires explicit package name (did you forget to declare "my @files"?) at ./src/imagery/i.pr/PRLIB/extract_ps.pl line 13.
2021-10-02T07:49:28.2509555Z Global symbol "$nfiles" requires explicit package name (did you forget to declare "my $nfiles"?) at ./src/imagery/i.pr/PRLIB/extract_ps.pl line 13.
2021-10-02T07:49:28.2510689Z Global symbol "$out" requires explicit package name (did you forget to declare "my $out"?) at ./src/imagery/i.pr/PRLIB/extract_ps.pl line 13.
2021-10-02T07:49:28.2511601Z ./src/imagery/i.pr/PRLIB/extract_ps.pl had compilation errors.]
Additional context
Super-Linter checks for Perl need to be disabled now.
This can be fixed by rewriting the script in Python.
Hello, I'm new to open source and i'm interested in solving this issue.Could you please help in getting started with this project and guide me through this issue. Thanks
Welcome @akshatakulkarni25 ! To get you started, please take a look at
https://grass.osgeo.org/contribute/development/ --> Quick links
there esp.
- How to contribute
- How to use git (if needed)
- GRASS Developers Mailing list (for questions and comments beyond this specific ticket)
With respect to this ticket, it would be ideal to rewrite the i.pr
(those in the subdirectories of https://github.com/OSGeo/grass-addons/tree/grass8/src/imagery/i.pr/PRLIB/) Perl scripts to Python, i.e. extract_functions.pl
and extract_ps.pl
.
The new scripts you may then submit as a pull request to this repository (for details, see the "How to use git" instructions above. And don't hesitate to ask if the instructions are unclear.
Greetings! I recently began exploring this project. If the issue is still open, I would like to contribute to this. I have experience fixing linter issues. My only concern is regarding the age of the issue. The last comment I see is over a year ago. It would be really helpful if I could get the current state of this issue. Thank you.
Hi @AnuRage-git As per the addon history this addon hasn't been touched for a while, so you are most welcome to contribute.
Hello @neteler . I have changed both the files. I do apologise for the delay in response for this small change. The issue was mostly change in function definitions in the new version of Perl. I have made those changes in the files and have initiated a pull request. Do let me know if any other change is required