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

Fix small issues with the tutorial docs #1654

Merged
merged 1 commit into from
Aug 14, 2022
Merged

Conversation

ssanj
Copy link
Contributor

@ssanj ssanj commented Aug 14, 2022

Fixed a couple of small discrepancies in the docs:

1 The diagnostic error states that this should be the error:

===========> Unreported <===========
test/NoLiteralArgumentsConfig.scala:16:20: error
  complete("done") // assert: NoLiteralArguments
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

but given the config and code provided:

/*
rule = NoLiteralArguments
NoLiteralArguments.disabledLiterals = [
  Int
  Boolean
]
 */
package test

class NoLiteralArgumentsConfig {
  def complete(message: String): Unit = ()
  def complete(count: Int): Unit = ()
  def complete(isSuccess: Boolean): Unit = ()
  complete("done") // ok, no error message
  complete(42) // assert: NoLiteralArguments
  complete(true) // assert: NoLiteralArguments
}

complete("done") should not report a lint error. (it also has the // ok, no error message comment)

Updated to report complete(42) as the error.

  1. NoLiteralArgumentsConfig#isDisabled is defined with a parameter named literal but that parameter is used as lit:
  def isDisabled(literal: Lit): Boolean = {
    val kind = lit.productPrefix.stripPrefix("Lit.") //should be literal.productPrefix or literal should be renamed to 'lit'
    disabledLiterals.contains(kind)
  }

Renamed literal: Lit -> lit: Lit as it coincides with the scalafix-named-literal-arguments on master

Copy link
Collaborator

@bjaglin bjaglin left a comment

Choose a reason for hiding this comment

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

Thanks @ssanj !

@bjaglin bjaglin merged commit 6d05a69 into scalacenter:main Aug 14, 2022
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