Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Fix or replace i.pr Perl scripts which fail with perlcritic #619

Closed
wenzeslaus opened this issue Oct 2, 2021 · 5 comments · Fixed by #1008
Closed

[Bug] Fix or replace i.pr Perl scripts which fail with perlcritic #619

wenzeslaus opened this issue Oct 2, 2021 · 5 comments · Fixed by #1008
Labels
bug Something isn't working good first issue Good for newcomers Perl Related code is in Perl Python Related code is in Python

Comments

@wenzeslaus
Copy link
Member

wenzeslaus commented Oct 2, 2021

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.

@wenzeslaus wenzeslaus added the bug Something isn't working label Oct 2, 2021
wenzeslaus added a commit to wenzeslaus/grass-addons that referenced this issue Oct 7, 2021
wenzeslaus added a commit that referenced this issue Oct 7, 2021
* Add Super-Linter job from core.
* Skip Perl checks (more config needed or waits for #619 and #620).
* Skip XML checks (more config needed or waits for wx.metadata, #625).
@wenzeslaus wenzeslaus changed the title [Bug] i.pr Perl scripts fail with perlcritic and Super-Linter [Bug] Fix or replace i.pr Perl scripts which fail with perlcritic Oct 7, 2021
@wenzeslaus wenzeslaus added Perl Related code is in Perl Python Related code is in Python good first issue Good for newcomers labels Oct 7, 2021
IvanMarchesini pushed a commit to IvanMarchesini/grass-addons that referenced this issue Feb 24, 2022
* Add Super-Linter job from core.
* Skip Perl checks (more config needed or waits for OSGeo#619 and OSGeo#620).
* Skip XML checks (more config needed or waits for wx.metadata, OSGeo#625).
@akshatakulkarni25
Copy link

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

@neteler
Copy link
Member

neteler commented Sep 3, 2022

Welcome @akshatakulkarni25 !
To get you started, please take a look at

https://grass.osgeo.org/contribute/development/
--> Quick links

there esp.

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.

@AnuRage-git
Copy link
Contributor

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.

@neteler
Copy link
Member

neteler commented Dec 28, 2023

Hi @AnuRage-git As per the addon history this addon hasn't been touched for a while, so you are most welcome to contribute.

@AnuRage-git
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers Perl Related code is in Perl Python Related code is in Python
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants