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

Enable -Xlint and -Werror #461

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

som-snytt
Copy link

Linting on 2.13 such as required empty args,
inferred Any in sameElements of Array[_],
Timeout is double-valued, avoid Any.equals,
some elements unused, deprecations.
Allow JavaConverters.

Can't use nowarn and unused annotations
under 2.11/2.12.

@som-snytt som-snytt marked this pull request as ready for review December 21, 2021 19:18
Copy link
Member

@olafurpg olafurpg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍 Thank you for this contribution! I pushed an empty commit to trigger the CI.

Copy link
Member

@olafurpg olafurpg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to silence the new warnings when compiling the codebase? I don't like fatal warnings because they are painful to work with when coding locally (example: commenting out a println statement introduces a fatal unused warning).

image

@som-snytt
Copy link
Author

som-snytt commented Dec 27, 2021

Thanks for taking a look.

OK, less-fatal warnings. Ideally there would be a turn-key or push-button way to enable that only for continuous integration later in the workflow.

I see I added some -Wconf, maybe I forgot to clean-compile. This is only my second time using -Wconf outside testing -Wconf.

Edit: I don't see warnings with + test on clean repo. Maybe there is some other interaction; I'm not an sbt power user, so I have nothing in my environment which might futz with compiler options.

The doc failure is Failed to parse -Wconf configuration.

Locally, scalafmt rejects my trailing comma and exits:

➜  munit git:(tweak/options) ./bin/scalafmt --check
--- /home/amarki/projects/munit/build.sbt
+++ /home/amarki/projects/munit/build.sbt-formatted
@@ -165,3 +165,3 @@
           //"-Werror",    // not 2.12
-          "-Xfatal-warnings",
+          "-Xfatal-warnings"
         )

Edit: I see there is sbt:munit> scalafixCheckAll which is 2.12 and shows the extra output. 🎉

@som-snytt
Copy link
Author

som-snytt commented Dec 28, 2021

Tweaked the scalafix task to use current 2.12. That didn't help warnings, so 2.12. scalac options avoid warning.

Probably scalacenter/sbt-scalafix#262 showing mangling of -Wconf.

Now I've lost the doc command that failed, so I haven't reproduced that.

Linting on 2.13, but difficult to align 3.x.

Can't use unused annotation 2.12.
@som-snytt
Copy link
Author

Further exploration of perils of crossbuilding with lints.

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

Successfully merging this pull request may close these issues.

2 participants