-
Notifications
You must be signed in to change notification settings - Fork 464
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
License check breaks if file has no package declaration #135
Comments
@chrisbanes I think I understand the cause of your exception. IIUC, Spotless needs a way of identifying what counts as the 'top' of a source file so that it can reliably put the specified license header just above. By default, we look for the substring "package" to identify the top of Kotlin files. However, it seems in your case that you have a Kotlin file that doesn't start with "package", so Spotless cannot find the 'top' of the file. It occurs to me that we don't provide a |
Note: I've just edited my previous comment for clarity. |
We do provide a way to specify the start of the file manually. The easiest workaround is to avoid the default package. If you don't want to change that, then you have to provide the regex yourself, e.g. something like |
Oops, I missed that. Thanks for correcting me @nedtwigg. 😜 |
The default package is used a lot more in Kotlin files, since you can have extensions methods, etc. Thanks though, |
Is it required to use the default package in Kotlin, or just more convenient? If it's required, maybe we should update our docs to include this tip. |
It's more convenience |
Roger. I'll close this for now. If enough future users bump into this same issue, maybe we'll put the |
I got the following exception:
The text was updated successfully, but these errors were encountered: