sgb-io / fta

Rust-based static analysis for TypeScript projects
https://ftaproject.dev
MIT License
99 stars 6 forks source link

fta-cli runs into line ending issue via bunx #130

Open fucksophie opened 5 months ago

fucksophie commented 5 months ago

Hello, this issue is really simple. Hopefully it's fixed soon.

/usr/bin/env: ‘node\r’: No such file or directory
/usr/bin/env: use -[v]S to pass options in shebang lines

The \r indicates that the shebang's newline is using CRLF's, which are opposite to Linux's LF's. To fix this, you have to run dos2unix ./node_modules/fta-cli/index.js.

sgb-io commented 5 months ago

Hey @fucksophie, we have e2e tests that test the built package on ubuntu and it seems to work ok. I also just tested on Ubuntu myself manually via npx (v2.0.0). (command used: npx fta-cli example-dir)

Can you confirm how you are using fta & what OS this is happening on?

fucksophie commented 5 months ago

As indicated in the issue report, this is Linux. The fta-cli index.js uses CRLFs, and this doesn't work on linux. You can see the bug in action here: https://git.sad.ovh/sophie/trillium/actions/runs/1

Sidenote: I am using bunx.

sgb-io commented 5 months ago

Thanks. It looks like this is specific to Bun, not linux:

root@DESKTOP-G5OFQHB:~# npx fta-cli fta-test
┌─────────────────────────────────┬────────────┬─────────────────────────────┬────────────┐
│ File                            ┆ Num. lines ┆ FTA Score (Lower is better) ┆ Assessment │
╞═════════════════════════════════╪════════════╪═════════════════════════════╪════════════╡
│ node_modules/fta-cli/index.js   ┆ 64         ┆ 44.91                       ┆ OK         │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
│ node_modules/fta-cli/check.js   ┆ 29         ┆ 39.50                       ┆ OK         │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
│ node_modules/fta-cli/targets.js ┆ 10         ┆ 8.16                        ┆ OK         │
└─────────────────────────────────┴────────────┴─────────────────────────────┴────────────┘
3 files analyzed in 0.0019s.
root@DESKTOP-G5OFQHB:~# bunx fta-cli fta-test
/usr/bin/env: ‘node\r’: No such file or directory

I'm not sure why bun has this problem and node doesn't