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

gts check/fix uses a list of files created by tslint #98

Closed
kjin opened this issue Dec 5, 2017 · 2 comments
Closed

gts check/fix uses a list of files created by tslint #98

kjin opened this issue Dec 5, 2017 · 2 comments
Assignees

Comments

@kjin
Copy link
Contributor

kjin commented Dec 5, 2017

See below comment

On my mac, gts check exits with code 0 before checking all files here. On linux this doesn't happen, and I get my clang-format error reports.

I combed gts dependencies for process.exit calls but couldn't find any. I believe unresolved Promises are somehow being ignored, and the event loops drains fully. Unsure about this...

@ofrobots
Copy link
Contributor

ofrobots commented Dec 6, 2017

I'm unable to reproduce this on your plugin-types branch. You will have to do some initial investigation yourself and report back.

@kjin
Copy link
Contributor Author

kjin commented Dec 6, 2017

The issue stems from me including generated git-ignored source files, which are being checked. I didn't realize that I had already fixed them locally, and CI kept failing because it was regenerating these source files.

This makes me think of two improvements we can make to avoid this problem (despite the questionable usage of generated source files in the linked PR, in general it's a use case we still want to support):

  • gts check and gts fix should show a list of files that clang-format takes issue with, if not the fixes that should be made/have been made themselves. I already talked about this in gts check can fail with no output #60 as being a low-priority improvement but I now think this would be extremely useful.
  • We should not use the list of files generated by tslint for formatting (this is the current behavior). It seems like Linter.getFileList(Linter.createProgram('...')) gets a list of files in a source dependency graph, making its return value a longer list than the list of files matching the glob specified in tsconfig.json. This is useful for linting, but undesirable for formatting.

@kjin kjin changed the title gts check/fix sometimes erroneously exits with code 0 gts check/fix uses a list of files created by tslint Dec 6, 2017
@kjin kjin closed this as completed in #99 Dec 12, 2017
kjin added a commit that referenced this issue Dec 12, 2017
Fixes #98

Use getRootFileNames instead of getSourceFiles when retrieving a list of files to format; the latter gets every file in the dependency graph constructed from files included in tsconfig.json.
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

No branches or pull requests

2 participants