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

Update scalafmt-core to 3.4.3 #1551

Merged
merged 1 commit into from
Feb 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
version = 3.3.3
version = 3.4.3
runner.dialect = scala213
project.git = true
docstrings.style = Asterisk
optIn.blankLineBeforeDocstring = true
Copy link
Collaborator

Choose a reason for hiding this comment

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

assumeStandardLibraryStripMargin = true
align.preset = none
onTestFailure = "To fix this, run `./bin/scalafmt` from the project base directory"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ object CompletionsOps {
}
names(setting).map { name =>
s""""$repeat${option(
Case.camelToKebab(name)
)}$description$message$action""""
Case.camelToKebab(name)
)}$description$message$action""""
}
}
}
Expand Down
9 changes: 9 additions & 0 deletions scalafix-core/src/main/scala/scalafix/patch/Patch.scala
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,19 @@ object Patch {
/** Remove this importee reference. */
def removeImportee(importee: Importee): Patch =
RemoveImportee(importee)

/** Add this importer to the global import list. */
def addGlobalImport(importer: Importer): Patch =
AddGlobalImport(importer)

/** Remove the token and insert this string at the same position. */
def replaceToken(token: Token, toReplace: String): Patch =
Add(token, "", toReplace, keepTok = false)

/** Remove all of the these tokens from the source file. */
def removeTokens(tokens: Iterable[Token]): Patch =
tokens.foldLeft(Patch.empty)(_ + Remove(_))

/** Remove this single token from the source file. */
def removeToken(token: Token): Patch =
Add(token, "", "", keepTok = false)
Expand All @@ -102,15 +106,19 @@ object Patch {
from.tokens.headOption.map(x => addRight(x, to))
}
}

/** Add this string to the right of this token. */
def addRight(tok: Token, toAdd: String): Patch =
Add(tok, "", toAdd)

/** Add this string to the right of this tree. */
def addRight(tree: Tree, toAdd: String): Patch =
tree.tokens.lastOption.fold(Patch.empty)(addRight(_, toAdd))

/** Add this string to the left of this token. */
def addLeft(tok: Token, toAdd: String): Patch =
Add(tok, toAdd, "")

/** Add this string to the left of this tree. */
def addLeft(tree: Tree, toAdd: String): Patch =
tree.tokens.headOption.fold(Patch.empty)(addLeft(_, toAdd))
Expand All @@ -132,6 +140,7 @@ object Patch {
symbol: v1.Symbol
)(implicit c: SemanticContext): Patch =
RemoveGlobalImport(v0.Symbol(symbol.value))

/**
* Place named import for this symbol at the bottom of the global import list
*/
Expand Down
4 changes: 2 additions & 2 deletions scalafix-core/src/main/scala/scalafix/v0/Synthetic.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ final case class Synthetic(
}
def structure: String =
s"""Synthetic(${position.structure}, "$text", List(${names
.map(_.structure)
.mkString(", ")}))"""
.map(_.structure)
.mkString(", ")}))"""
override def toString = syntax
}
2 changes: 2 additions & 0 deletions scalafix-core/src/main/scala/scalafix/v1/Rule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@ abstract class Rule(val name: RuleName) {
* for documentation purposes.
*/
def isLinter: Boolean = false

/**
* If true, allows this rule to be grouped together with other rewrite rules
* for documentation purposes.
*/
def isRewrite: Boolean = false

/**
* Indicates if this rule is incomplete and subject to breaking changes or
* removal in the future.
Expand Down
36 changes: 36 additions & 0 deletions scalafix-core/src/main/scala/scalafix/v1/SymbolInformation.scala
Original file line number Diff line number Diff line change
Expand Up @@ -85,93 +85,129 @@ final class SymbolInformation private[scalafix] (

/** @group utilty */
@utility def isSetter: Boolean = displayName.endsWith("_=")

/** @group utilty */
@utility def isDef: Boolean =
isMethod && isScala && !isVal && !isVar

/** @group language */
@language def isScala: Boolean = info.isScala

/** @group language */
@language def isJava: Boolean = info.isJava

/** @group kind */
@kind def isLocal: Boolean = info.isLocal

/** @group kind */
@kind def isField: Boolean = info.isField

/**
* Returns true for `val` `var` and `def` symbols in Scala, and true for Java
* methods.
* @group kind
*/
@kind def isMethod: Boolean = info.isMethod

/** @group kind */
@kind def isConstructor: Boolean = info.isConstructor

/** @group kind */
@kind def isMacro: Boolean = info.isMacro

/** @group kind */
@kind def isType: Boolean = info.isType

/** @group kind */
@kind def isParameter: Boolean = info.isParameter

/** @group kind */
@kind def isSelfParameter: Boolean = info.isSelfParameter

/** @group kind */
@kind def isTypeParameter: Boolean = info.isTypeParameter

/** @group kind */
@kind def isObject: Boolean = info.isObject

/** @group kind */
@kind def isPackage: Boolean = info.isPackage

/** @group kind */
@kind def isPackageObject: Boolean = info.isPackageObject

/** @group kind */
@kind def isClass: Boolean = info.isClass

/** @group kind */
@kind def isInterface: Boolean = info.isInterface

/** @group kind */
@kind def isTrait: Boolean = info.isTrait

/** @group property */
@property def isAbstract: Boolean = info.isAbstract

/** @group property */
@property def isFinal: Boolean = info.isFinal

/** @group property */
@property def isSealed: Boolean = info.isSealed

/** @group property */
@property def isImplicit: Boolean = info.isImplicit

/** @group property */
@property def isLazy: Boolean = info.isLazy

/** @group property */
@property def isCase: Boolean = info.isCase

/** @group property */
@property def isCovariant: Boolean = info.isCovariant

/** @group property */
@property def isContravariant: Boolean = info.isContravariant

/** @group property */
@property def isVal: Boolean = info.isVal

/** @group property */
@property def isVar: Boolean = info.isVar

/** @group property */
@property def isStatic: Boolean = info.isStatic

/** @group property */
@property def isPrimary: Boolean = info.isPrimary

/** @group property */
@property def isEnum: Boolean = info.isEnum

/** @group property */
@property def isDefault: Boolean = info.isDefault

/** @group access */
@access def isPrivate: Boolean = info.isPrivate

/** @group access */
@access def isPrivateThis: Boolean = info.isPrivateThis

/** @group access */
@access def isPrivateWithin: Boolean = info.isPrivateWithin

/** @group access */
@access def isProtected: Boolean = info.isProtected

/** @group access */
@access def isProtectedThis: Boolean = info.isProtectedThis

/** @group access */
@access def isProtectedWithin: Boolean = info.isProtectedWithin

/** @group access */
@access def isPublic: Boolean = info.isPublic

/** @group access */
@access def within: Option[Symbol] = info.within.map(Symbol(_))

Expand Down