flxbl-io / sfp

A build system for modular development in Salesforce
https://docs.flxbl.io/sfp/
MIT License
31 stars 18 forks source link

Codacy is not importing needed @types #140

Open richard-giraud opened 1 week ago

richard-giraud commented 1 week ago

Describe the bug It looks like Codacy isn't able to leverage the @types/git-url-parse package, which results in odd error messages. Specifically, it gives the following:

I don't believe there is an error type that could possibly apply here, suggesting that it's badly communicated error.

This was observed with https://github.com/flxbl-io/sfp/pull/138, where the above error messages were generated.

To Reproduce

  1. Create a new branch.
  2. Find an imported code element that uses a @type library not appearing in this file: https://github.com/codacy/codacy-eslint/blob/master/package.json. (E.g., the git-url-parse package in src/core/package/SfpPackageInquirer.ts);
  3. Modify a line that involves the imported resource.
  4. Build and test locally.
  5. Observe there are no errors.
  6. Commit and push the changes.
  7. Create a PR.
  8. Observe that Codacy starts the validation, then gives an odd error message.

Expected behavior The code passes without error (in the case of the referenced PR) or the error messages would make more sense.

Screenshots

Image

Platform Details (please complete the following information): This is with GitHub workflow on the https://github.com/flxbl-io/sfp/pull/138 PR.

Additional context It looks like this may be a limitation of how Codacy is configured/works. I found an old GitHub Issue (from back before when they hid their Issues) that says that they don't do an npm install when running on their cloud, and that is causing the error. https://web.archive.org/web/20201123173420/https://github.com/codacy/codacy-eslint/issues/920

This report is from 2020, so it may no longer be relevant. However, it would explain the error type.

If this turns out to be the case, the solution is likely move the checks into the GitHub workflow:

  1. npm install
  2. npm run build
  3. Run Codacy CLI to perform the analysis.
  4. Upload the results to Codacy.