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

RPG Lint reporting 'No reference to definition' incorrectly #358

Closed
Gregory1701 opened this issue Jan 2, 2025 · 6 comments · Fixed by #359
Closed

RPG Lint reporting 'No reference to definition' incorrectly #358

Gregory1701 opened this issue Jan 2, 2025 · 6 comments · Fixed by #359

Comments

@Gregory1701
Copy link

Gregory1701 commented Jan 2, 2025

It seems that sometimes the Lint functionality has a hard time recognizing that a variable is being used. I see this a fair amount and it mostly seems like the 'No reference to definition' is incorrectly thrown when the variable is used in the call to another procedure.

I can copy/paste the below code into a new source member and the linter immediately throws the 'No ref...' lint error.

**Free

Ctl-Opt Main(Lint_Test);
Ctl-Opt ActGrp(*Caller);

Dcl-s errorCPF Char(7) Import('_EXCP_MSGID');

Dcl-Proc Lint_Test;

  Dcl-Pi Lint_Test;

  End-Pi;

  Dcl-s error_msg like(t_error_msg);

  exsr set_error_msg;

  Monitor;

  On-Error;
    common_dblog(pgm_sts.thisPgm:'Initialize':%Trim(errorCPF) + ' - Error occurred.');
  EndMon;

  Return;

  Begsr set_error_msg;

    error_msg = 'Error message';

  Endsr;

  On-Exit;

End-Proc Lint_Test;

Context Version
Code for IBM i version 2.14.5
Visual Studio Code version 1.96.2
Operating System win32_x64
Active extensions
Code for IBM i Walkthroughs (vscode-ibmi-walkthroughs): 0.5.0
Configuration Editing (configuration-editing): 1.0.0
Db2 for IBM i (vscode-db2i): 1.7.0
ESLint (vscode-eslint): 3.0.10
Emmet (emmet): 1.0.0
Error Lens (errorlens): 3.22.0
Extension Authoring (extension-editing): 1.0.0
GistPad (gistfs): 0.6.0
Git (git): 1.0.0
Git Base (git-base): 1.0.0
GitHub (github): 0.0.1
GitHub Authentication (github-authentication): 0.0.2
GitHub Copilot (copilot): 1.254.0
GitHub Copilot Chat (copilot-chat): 0.23.2
GitLab Workflow (gitlab-workflow): 5.25.1
IBM i Debug (ibmidebug): 2.0.2
IBM i Project Explorer (vscode-ibmi-projectexplorer): 2.12.0
JSON Language Features (json-language-features): 1.0.0
Jira and Bitbucket (Atlassian Labs) (atlascode): 3.2.1
Merge Conflict (merge-conflict): 1.0.0
NPM support for VS Code (npm): 1.0.1
Node Debug Auto-attach (debug-auto-launch): 1.0.0
Postman (postman-for-vscode): 1.5.1
Prettier - Code formatter (prettier-vscode): 11.0.0
RPGLE (vscode-rpgle): 0.28.5
Server Ready Action (debug-server-ready): 1.0.0
Source Orbit (vscode-sourceorbit): 1.0.2
TODO Highlight (vscode-todo-highlight): 1.0.5
TypeScript and JavaScript Language Features (typescript-language-features): 1.0.0
WSL (remote-wsl): 0.88.5
YAML (vscode-yaml): 1.15.0

Remote system
Setting Value
IBM i OS V7R5M0
Tech Refresh 4
CCSID Origin 37
Runtime CCSID 37
Default CCSID 37
SSHD CCSID ?
cqsh true
SQL Enabled
Source dates Disabled

Enabled features

/QOpenSys/pkgs/bin /usr/bin /QSYS.lib/ILEDITOR.lib /QSYS.LIB /QIBM/ProdData/IBMiDebugService/bin /QOpenSys/QIBM/ProdData/JavaVM/jdk80 /QOpenSys/QIBM/ProdData/JavaVM/jdk11 /QOpenSys/QIBM/ProdData/JavaVM/jdk17
bash attr GETNEWLIBL.PGM QZDFMDB2.PGM startDebugService.sh 64bit 64bit 64bit
find iconv
git setccsid
grep uname
ls
md5sum
sort
stat
tar
tn5250
Shell env
Variants
{
  "american": "#@$",
  "local": "#@$",
  "qsysNameRegex": {}
}
@SJLennon
Copy link
Contributor

SJLennon commented Jan 2, 2025

@Gregory1701
Just to clarify where the "No reference to definition" occurs, which I had trouble telling from the above, I copied your code (and removed the blank lines) and did "format document" to reset to my indentation.
This is what I'm seeing:
image

Here's my code:

**Free
Ctl-Opt Main(Lint_Test);
Ctl-Opt ActGrp(*Caller);
Dcl-s errorCPF Char(7) Import('_EXCP_MSGID');
Dcl-Proc Lint_Test;
  Dcl-Pi Lint_Test;
  End-Pi;
  Dcl-s error_msg like(t_error_msg);
  exsr set_error_msg;
  Monitor;
  On-Error;
    common_dblog(pgm_sts.thisPgm:'Initialize':%Trim(errorCPF) + ' - Error occurred.');
  EndMon;
  Return;
  Begsr set_error_msg;
    error_msg = 'Error message';
  Endsr;
  On-Exit;
End-Proc Lint_Test;

@Gregory1701
Copy link
Author

Hey @worksofliam were you able to reproduce this issue?

@worksofliam worksofliam transferred this issue from codefori/vscode-ibmi Jan 8, 2025
@worksofliam
Copy link
Contributor

I am able to recreate. Working on it now.

@worksofliam worksofliam linked a pull request Jan 10, 2025 that will close this issue
@worksofliam
Copy link
Contributor

@Gregory1701 I solved your problem, which had shown another issue with SQL statements. Both are fixed in a PR and I will release today.

@worksofliam
Copy link
Contributor

Out in 0.28.6.

@Gregory1701
Copy link
Author

Nice, thanks @worksofliam !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants