Skip to content
This repository has been archived by the owner on Jul 8, 2019. It is now read-only.

Required to point to the tslint-cli.js file when running on windows #170

Open
ghost opened this issue Aug 10, 2017 · 6 comments
Open

Required to point to the tslint-cli.js file when running on windows #170

ghost opened this issue Aug 10, 2017 · 6 comments

Comments

@ghost
Copy link

ghost commented Aug 10, 2017

In order to get tslint working I have had to set the path directly to the javascript file for the CLI

It looks like it maybe should call tslint as an executable on windows using the .cmd wrapper instead of prefixing it with node.

Updating the config to this resolved the issue for me

sonar.ts.tslint.path=node_modules\tslint\lib\tslint-cli.js

Otherwise just fails silently, it looks like it is sucessful, but no issues are imported

Running SonarQube Version 6.5 (build 27846) and v1.1.0 of the SonarTsPlugin

@habbo656
Copy link

habbo656 commented Aug 23, 2017

I had the same issue. I tried to run lint with the produced command (-X switch). TSLint complained about a missing file or directory:

      throw er; // Unhandled 'error' event
      ^

Error: ENOENT: no such file or directory, open '<project-path>\target\sonar\.sonartmp\8843665497511539779.tmp'
    at Error (native)

I run it again and changed the --out parameter to something like <project-path>\target\sonar\tslint-result.json
that was working. It seems that the .sonartmp directory needs to be created before tslint is started.

mkdir target\sonar\.sonartmp

node D:\<...>\node_modules\tslint\bin\tslint --format json --out D:\<...>\target\sonar\.sonartmp\8843665497511539779.tmp --config D:\<...>\tslint.json 

It is working also with the solution described by @kingsleymasters .

@Pablissimo
Copy link
Owner

So @habbo656 I think your issue is different, in that it looks like maybe the user account running the scanner doesn't have permissions to create folders and write to the filesystem? I've seen similar on TFS installs before - the plugin relies on the scanner having created the temporary folder for it and that it can write to it so I'd check permissioning first.

@kingsleymasters I'm not sure why you're seeing that unless there's been a change to how tslint's getting installed with newer versions. Failing silently is rubbish, sorry about that - what version of tslint do you have in use? And what version of Node?

@habbo656
Copy link

I forgot to mention that I'm using maven-sonar-plugin. I don't think that this are permission issues.

@Pablissimo
Copy link
Owner

Does everything up to the .sonartmp path component exist on disk?

@habbo656
Copy link

Yes, I run mvn clean sonar:sonar it created /target/sonar/ directories.

@ghost
Copy link
Author

ghost commented Aug 23, 2017

@Pablissimo

I have a reproduction for you I am using node 6.10.2 and tslint 5.5.0. I've taken these command lines from the sonarqube logs.

Succeeds

node C:\Users\[REMOVED]\AppData\Roaming\npm\node_modules\tslint\lib\tslint-cli.js --format json --out D:\TeamCity\buildAgent\work\1f282a2c9f5495cf\.scannerwork\.sonartmp\2766165142984384394.tmp --config D:\TeamCity\buildAgent\work\1f282a2c9f5495cf\[REMOVED]\app\tslint.json D:/TeamCity/buildAgent/work/1f282a2c9f5495cf/REMOVED]/app/src/client/app/app.module.ts

Fails

node C:\Users\[REMOVED]\AppData\Roaming\npm\tslint --format json --out D:\TeamCity\buildAgent\work\1f282a2c9f5495cf\.scannerwork\.sonartmp\2766165142984384394.tmp --config D:\TeamCity\buildAgent\work\1f282a2c9f5495cf\[REMOVED]\app\tslint.json D:/TeamCity/buildAgent/work/1f282a2c9f5495cf/REMOVED]/app/src/client/app/app.module.ts

I think it fails as its trying to call tslint using node, but on windows tslint is a batch file, workaround works perfectly so maybe just needs documenting...

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

No branches or pull requests

2 participants