Use lint***Filter instead of ***LintKeys for more reliable tests#5985
Merged
eed3si9n merged 1 commit intosbt:developfrom Oct 18, 2020
xirc:use-lint-xxx-filter-in-test
Merged
Use lint***Filter instead of ***LintKeys for more reliable tests#5985eed3si9n merged 1 commit intosbt:developfrom xirc:use-lint-xxx-filter-in-test
eed3si9n merged 1 commit intosbt:developfrom
xirc:use-lint-xxx-filter-in-test
Conversation
Below functions pass lintIncludeFilter and lintExcludeFilter to lintUnusedinstead of includeLintKeys and excludeLintKeys respectively. - sbt.internal.LintUnused#lintUnusedTask - sbt.internal.LintUnused#lintUnusedFunc Therefore, in the test, we had better to use lint***Filter instead of ***LintKeys.
eed3si9n
approved these changes
Oct 18, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Use
lint***Filterinstead of***LintKeysfor more reliable tests.I have found this improvement when I attempted to solve the issue #5849.
Problem
lintUnusedTaskpasses the result oflintExcludeFilteras the argument tolintUnused.sbt/main/src/main/scala/sbt/internal/LintUnused.scala
Lines 60 to 69 in 28833db
lintExcludeFilterexcludes watch related settings which has the prefixwatch.sbt/main/src/main/scala/sbt/internal/LintUnused.scala
Lines 24 to 27 in 28833db
But, in the test,
excludeLintKeysare passed tolintUnused.excludeLintKeysare used inlintExcludeFilter, and it doesn't exclude watch related settings.Thus, excluding watch related settings from lint keys are not well tested.
sbt/sbt/src/sbt-test/project/lint/build.sbt
Lines 11 to 13 in 28833db
I think I can say same thing also about
lintIncludeFilterandincludeLintKeys.Solution
lintExcludeFilterinstead ofexcludeLintKeysin the testlintIncludeFilterinstead ofincludeLintKeysin the test