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

Implement changes from Intellij Code Inspection #3104

Merged
merged 12 commits into from
Feb 4, 2022

Conversation

kitbellew
Copy link
Collaborator

No description provided.

@kitbellew kitbellew force-pushed the code branch 2 times, most recently from 96eba75 to aa761c7 Compare February 3, 2022 18:25
@kitbellew kitbellew requested a review from tgodzik February 3, 2022 18:43
@kitbellew kitbellew requested a review from dos65 February 3, 2022 18:43
Copy link
Contributor

@tgodzik tgodzik left a comment

Choose a reason for hiding this comment

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

LGTM! I just added some comments. For some of the unused stuff we could add compiler options and verify that on CI with scalafix. We do that in Metals via:

Comment on lines 80 to 82
val src = Source.fromFile(atFile)
try builder ++= src.getLines()
finally src.close()
Copy link
Contributor

Choose a reason for hiding this comment

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

You could also use scala.util.Using

Suggested change
val src = Source.fromFile(atFile)
try builder ++= src.getLines()
finally src.close()
builder ++= Using.resource(Source.fromFile(atFile))(_.getLines())

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done, thank you, didn't know about this

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it's only available for scala 2.13. added this package for 2.12:

https://index.scala-lang.org/bigwheel/util-backports/util-backports/2.1

Comment on lines 84 to 86
val src = scala.io.Source.fromURL(url)
try src.getLines().mkString("", "\n", "\n")
finally src.close()
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
val src = scala.io.Source.fromURL(url)
try src.getLines().mkString("", "\n", "\n")
finally src.close()
builder ++= Using.resource(scala.io.Source.fromURL(url))(_.getLines().mkString("", "\n", "\n"))

or something along these lines

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done as well

Copy link
Collaborator Author

@kitbellew kitbellew left a comment

Choose a reason for hiding this comment

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

... For some of the unused stuff we could add compiler options ...

thank you, added the compiler options. let's do scalafix later, if you don't mind; not very experienced with it.

Comment on lines 80 to 82
val src = Source.fromFile(atFile)
try builder ++= src.getLines()
finally src.close()
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done, thank you, didn't know about this

Comment on lines 84 to 86
val src = scala.io.Source.fromURL(url)
try src.getLines().mkString("", "\n", "\n")
finally src.close()
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done as well

@kitbellew kitbellew merged commit 8e02778 into scalameta:master Feb 4, 2022
@kitbellew kitbellew deleted the code branch February 4, 2022 03:07
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.

3 participants