Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

🐛 Rome returns non-zero exit code when called with excluded filename #4681

Open
1 task done
zachequi opened this issue Jul 10, 2023 · 3 comments
Open
1 task done
Labels
S-To triage Status: user report of a possible bug that needs to be triaged

Comments

@zachequi
Copy link

zachequi commented Jul 10, 2023

Environment information

CLI:
  Version:                      12.1.3
  Color support:                true

Platform:
  CPU Architecture:             x86_64
  OS:                           linux

Environment:
  ROME_LOG_DIR:                 unset
  NO_COLOR:                     unset
  TERM:                         "xterm-256color"
  JS_RUNTIME_VERSION:           "v18.7.0"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         "yarn/3.6.0"

Rome Configuration:
  Status:                       Loaded successfully
  Formatter disabled:           false
  Linter disabled:              false
  Organize imports disabled:    true
  VCS disabled:                 true

Workspace:
  Open Documents:               0

Discovering running Rome servers...

Running Rome Server: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

i The client isn't connected to any server but rage discovered this running Rome server.

Server:
  Version:                      12.1.3
  Name:                         rome_lsp
  CPU Architecture:             x86_64
  OS:                           linux

Workspace:
  Open Documents:               0

Other Active Server Workspaces:

Workspace:
  Open Documents:               5
  Client Name:                  Visual Studio Code
  Client Version:               1.79.2

Rome Server Log:

! Please review the content of the log file before sharing it publicly as it may contain sensitive information:
  * Path names that may reveal your name, a project name, or the name of your employer.
  * Source code
<Snipped to not include proprietary code information>

What happened?

  1. Setup rome to exclude a certain file pattern, e.g. *.generated.ts
  2. attempt to run rome on a set of files including at least one that is excluded, e.g. rome check --apply foo.ts bar.generated.ts
  3. Rome returns an io/InternalError and exit code of 1.
echo $./api.generated.ts lint ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  ✖ The file ./api.generated.ts was ignored
  

Fixed 1 file(s) in 676µs
Skipped 1 file(s)
internalError/io ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  ✖ No files were processed in the specified paths.
$ echo $?
1

Note this is a bit of a contrived example for simplicity of replication, in reality this is a common occurrence with e.g. lint-staged

Expected result

Rome should skip the excluded file gracefully and continue linting the remaining files returning a status code indicating whether the linting/formatting succeeded on the non-excluded files.

Code of Conduct

  • I agree to follow Rome's Code of Conduct
@zachequi zachequi added the S-To triage Status: user report of a possible bug that needs to be triaged label Jul 10, 2023
@zachequi
Copy link
Author

I encountered an issue here related to lint-staged, but now that I'm experimenting with more trivial examples calling rome directly it's less clear that what I have described above is comprehensive as reproduction steps. I'll take another crack at identifying precisely the scenarios where rome's exit code doesn't align with expectations and/or breaks conventions ecosystem tooling is expecting.

@ematipico
Copy link
Contributor

An option to suppress the error will be available in the next release #4622

Alternatively, you can use the nightly release to avail of that option

@zachequi
Copy link
Author

Awesome! Thank you so much, really appreciate the work you guys are doing here.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
S-To triage Status: user report of a possible bug that needs to be triaged
Projects
None yet
Development

No branches or pull requests

2 participants