scalafix icon indicating copy to clipboard operation
scalafix copied to clipboard

Added validation on the classpath

Open daddykotex opened this issue 3 years ago • 1 comments

Address #962

This is a protection to avoid invalid entries from creeping into the SymbolTable loading process. When this happens, we get a pretty bad error that looks like:

error: Unable to load symbol table: error in opening zip file

This does not tell us much and we need to find the problematic entry (if we can figure out what's the problem). With this PR, an invalid we show up as an argument validation error either via run or via the validate function on Args.

Before:

error: Unable to load symbol table: zip END header not found
1 targets failed
assignments.api.fix Unable to load symbol table: zip END header not found

After:

error: Invalid classpath entry. Make sure your classpath
contains only directories or file that ends with
the following extension: [jar,zip,semanticdb]. The following path are invalid: /some/path/to/a/file.json

daddykotex avatar Jul 23 '22 01:07 daddykotex

One thing I realize when I went to bed is that because there are like 2-3 usages of Configured[Classpath]. We see the error 2-3 times. At first I thought it was my build tool but now I understand its my mistake and I need to fix that

daddykotex avatar Jul 23 '22 10:07 daddykotex

I guess this can be closed, and it will fix itself when upgrading meta to 4.5.14, whenever that is released.

daddykotex avatar Aug 24 '22 16:08 daddykotex

Thanks! I'll confirm manually that https://github.com/scalacenter/scalafix/issues/962 can be closed when the next scalameta bump PR is opened.

bjaglin avatar Aug 24 '22 16:08 bjaglin