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

Support Scala 2.13.12 #789

Merged
merged 12 commits into from
Sep 18, 2023
Merged

Support Scala 2.13.12 #789

merged 12 commits into from
Sep 18, 2023

Conversation

saeltz
Copy link
Collaborator

@saeltz saeltz commented Sep 11, 2023

Fixes #780.
Fixes #754.

Closes #781.

Multiple things were changed:

  • Updated to Scala 2.13.12
  • Renamed context used twice in the same scope in inspections
  • Added explicit type annotation to postTypeTraverser in inspections
  • Added explicit type annotation to val inspections in tests
  • Disabled UnnecessaryConversion inspection on Scala 2.13.12
  • Changed the FeedbackTest to compile with new property in StoreReporter.Info
  • Ran fix on the entire codebase (it failed somehow in GitHub Actions after my changes and then reformatted many files)

Best to review hiding whitespaces.

@codecov-commenter
Copy link

Codecov Report

Patch coverage: 81.52% and project coverage change: -1.62% ⚠️

Comparison is base (9392826) 87.22% compared to head (c990982) 85.61%.
Report is 1 commits behind head on master.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #789      +/-   ##
==========================================
- Coverage   87.22%   85.61%   -1.62%     
==========================================
  Files         141      141              
  Lines        1527     1529       +2     
  Branches      254      258       +4     
==========================================
- Hits         1332     1309      -23     
- Misses        195      220      +25     
Files Changed Coverage Δ
...main/scala/com/sksamuel/scapegoat/Inspection.scala 97.36% <ø> (ø)
...t/inspections/collections/JavaConversionsUse.scala 0.00% <0.00%> (ø)
...pections/collections/PredefIterableIsMutable.scala 14.28% <0.00%> (ø)
...t/inspections/collections/PredefSeqIsMutable.scala 14.28% <0.00%> (ø)
...tions/collections/PredefTraversableIsMutable.scala 14.28% <0.00%> (ø)
...nspections/unneccesary/UnnecessaryConversion.scala 3.84% <3.84%> (-96.16%) ⬇️
...la/com/sksamuel/scapegoat/inspections/AnyUse.scala 100.00% <100.00%> (ø)
...samuel/scapegoat/inspections/AvoidToMinusOne.scala 90.90% <100.00%> (ø)
...amuel/scapegoat/inspections/BooleanParameter.scala 100.00% <100.00%> (ø)
...ksamuel/scapegoat/inspections/DoubleNegation.scala 100.00% <100.00%> (ø)
... and 120 more

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@saeltz saeltz marked this pull request as ready for review September 11, 2023 19:21
@saeltz saeltz requested a review from mccartney September 11, 2023 19:22
@mccartney
Copy link
Collaborator

I am only wondering about isScala21312. I guess the subsequent future versions should be covered too, right?
Obv. we can decide later.

Copy link
Collaborator

@mccartney mccartney left a comment

Choose a reason for hiding this comment

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

Reviewed all commits except mine and they LGTM


val isScala213 = shortScalaVersion == "2.13"
val isScala213: Boolean = shortScalaVersion == "2.13"
val isScala21312: Boolean = scalaVersion == "2.13.12"
Copy link
Contributor

Choose a reason for hiding this comment

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

what if instead of string comparison, we'll try to use major/minor/patch versions as numbers?
Something like this, but ensuring that the split is 'safe':

val (major, minor, patch) = scalaVersion.split('.').map(_.toInt)
val isScala213: Boolean = major == 2 && minor == 13
val isScala21312OrLater: Boolean = isScala213 && patch >= 12

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good idea! We'd welcome your PR with this small change.

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks to become a gotcha for new 2.13 versions. Probably can find some time this week to raise this as an MR.

How lenient do we want to be here when we can't parse the string?

  • Fail fast (as scapegoat is full cross-built, might not be the worst)
  • Fail per component (2.13.231-snapshot could still be understood as 2.13.??? so the is 2.13 check would still work)
  • Fallback to something (not sure there's a sane default considering 2.12/2.13 though)

Copy link
Collaborator

Choose a reason for hiding this comment

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

I still think what @saeltz mentioned here would be a good amendment.

Copy link
Contributor

Choose a reason for hiding this comment

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

#826 raised here :)

@saeltz saeltz merged commit 0703cd5 into scapegoat-scala:master Sep 18, 2023
9 checks passed
@saeltz saeltz deleted the scala-21312 branch September 18, 2023 08:09
@saeltz
Copy link
Collaborator Author

saeltz commented Sep 18, 2023

@mccartney, are you in for a new release?

@mccartney
Copy link
Collaborator

Forgot to mention here, but 2.1.3 has been out for a few days with this.

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.

Scala 2.13.12 UnnecessaryConversionTest failing in latest Scala community build
6 participants