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.0.0 #548

Merged
merged 2 commits into from
Aug 22, 2021
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
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=2.7.5
version=3.0.0
maxColumn = 100
project.git = true
align.preset = none
Expand Down
60 changes: 32 additions & 28 deletions cli/src/main/scala/mdoc/Variable.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import scala.meta.inputs.Position
*
* Example, the code fence below has two statements:
*
* - The first statement has a single variable with name `x`
* - The second statement has a two variables with names `y` and `z`
* - The first statement has a single variable with name `x`
* - The second statement has a two variables with names `y` and `z`
*
* {{{
* ```scala mdoc
Expand All @@ -18,32 +18,36 @@ import scala.meta.inputs.Position
* ```
* }}}
*
* @param name the variable name, for example `x`
* @param staticType the pretty-printed static type of this variable, for example `List[Int]`
* @param runtimeValue the runtime value of this variable.
* @param indexOfVariableInStatement the index of this variable in the enclosing statement.
* For example, in `val (a, b) = ???` the variable `a` has index
* 0 and variable `b` has index `1`.
* @param totalVariablesInStatement The total number of variables in this statements. For example,
* in `val a = N` the total number is 1 and for `val (a, b) = ...` the
* total number is 2.
* @param indexOfStatementInCodeFence the index of the enclosing statement within the enclosing code fence.
* For example, in
* {{{
* ```scala
* val x = 1
* val y = 2
* ```
* }}}
* The variable `y` has index 1 and variable `x` has index 0.
* @param totalStatementsInCodeFence the total number of statement in the enclosing code fence.
* For example, the total number is 2 for the code fence below.
* {{{
* ```scala
* val x = 1
* val y = 2
* ```
* }}}
* @param name
* the variable name, for example `x`
* @param staticType
* the pretty-printed static type of this variable, for example `List[Int]`
* @param runtimeValue
* the runtime value of this variable.
* @param indexOfVariableInStatement
* the index of this variable in the enclosing statement. For example, in `val (a, b) = ???` the
* variable `a` has index 0 and variable `b` has index `1`.
* @param totalVariablesInStatement
* The total number of variables in this statements. For example, in `val a = N` the total number
* is 1 and for `val (a, b) = ...` the total number is 2.
* @param indexOfStatementInCodeFence
* the index of the enclosing statement within the enclosing code fence. For example, in
* {{{
* ```scala
* val x = 1
* val y = 2
* ```
* }}}
* The variable `y` has index 1 and variable `x` has index 0.
* @param totalStatementsInCodeFence
* the total number of statement in the enclosing code fence. For example, the total number is 2
* for the code fence below.
* {{{
* ```scala
* val x = 1
* val y = 2
* ```
* }}}
*/
final class Variable private[mdoc] (
val name: String,
Expand Down
15 changes: 10 additions & 5 deletions cli/src/main/scala/mdoc/internal/cli/InputFile.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,16 @@ import scala.meta.internal.io.PathIO
import metaconfig.Input
import java.nio.file.Files

/** @param relpath the input filename relativized by its input directory.
* @param inputFile the input file to read from.
* @param outputFile the output file to write to.
* @param inputDirectory directory enclosing the input file.
* @param outputDirectory directory enclosing the output file.
/** @param relpath
* the input filename relativized by its input directory.
* @param inputFile
* the input file to read from.
* @param outputFile
* the output file to write to.
* @param inputDirectory
* directory enclosing the input file.
* @param outputDirectory
* directory enclosing the output file.
*/
case class InputFile(
relpath: RelativePath,
Expand Down
4 changes: 2 additions & 2 deletions mdoc/src/main/scala/mdoc/internal/CompatClassloader.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import mdoc.internal.pos.PositionSyntax._

object CompatClassloader {

/** Utility to get SystemClassLoader/ClassLoader urls in java8 and java9+
* Based upon: https://gist.github.com/hengyunabc/644f8e84908b7b405c532a51d8e34ba9
/** Utility to get SystemClassLoader/ClassLoader urls in java8 and java9+ Based upon:
* https://gist.github.com/hengyunabc/644f8e84908b7b405c532a51d8e34ba9
*/
def getURLs(classLoader: ClassLoader): Seq[URL] = {
if (classLoader.isInstanceOf[URLClassLoader]) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,16 @@ object UndertowLiveReload {
*
* See LiveReload protocol for more details: http://livereload.com/api/protocol/
*
* @param root the root directory to serve files from.
* @param host the hostname of the server.
* @param preferredPort the preferred port of the server. If the port is not free,
* the first free port that is an increment of this port is picked.
* For example, if preferredPort == 4000 and 4000 is not free, then
* 4001 will be picked instead.
* @param reporter the reporter to use for logging purposes.
* @param root
* the root directory to serve files from.
* @param host
* the hostname of the server.
* @param preferredPort
* the preferred port of the server. If the port is not free, the first free port that is an
* increment of this port is picked. For example, if preferredPort == 4000 and 4000 is not
* free, then 4001 will be picked instead.
* @param reporter
* the reporter to use for logging purposes.
*/
def apply(
root: Path,
Expand Down
4 changes: 2 additions & 2 deletions mdoc/src/main/scala/mdoc/internal/markdown/Markdown.scala
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ object Markdown {

/** Defines the default markdown settings.
*
* Do not use directly. The default flexmark settings have special keys set
* up by mdoc to keep track of certain document-specific information like path.
* Do not use directly. The default flexmark settings have special keys set up by mdoc to keep
* track of certain document-specific information like path.
*/
def mdocSettings(context: Context): MutableDataSet = {
// Scalac doesn't understand that it has to box the values, so we do it manually for primitives
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ object MdocExtensions {

/** Defines mdoc's markdown extensions.
*
* Inspired by CommonMark formatter options so that pandoc understands it.
* https://github.com/vsch/flexmark-java/blob/master/flexmark-java-samples/src/com/vladsch/flexmark/samples/FormatConverterCommonMark.java#L27-L37
* Inspired by CommonMark formatter options so that pandoc understands it.
* https://github.com/vsch/flexmark-java/blob/master/flexmark-java-samples/src/com/vladsch/flexmark/samples/FormatConverterCommonMark.java#L27-L37
*
* @return A sequence of extensions to be applied to Flexmark's options.
* @return
* A sequence of extensions to be applied to Flexmark's options.
*/
def mdoc(context: Context): List[Extension] = {
plain
Expand Down
21 changes: 11 additions & 10 deletions mdoc/src/main/scala/mdoc/internal/pos/BinarySearch.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,18 @@ object BinarySearch {

/** Binary search using a custom compare function.
*
* scala.util.Searching does not support the ability to search an IndexedSeq
* by a custom mapping function, you must search by an element of the same
* type as the elements of the Seq.
* scala.util.Searching does not support the ability to search an IndexedSeq by a custom mapping
* function, you must search by an element of the same type as the elements of the Seq.
*
* @param array Must be sorted according to compare function so that for all
* i > j, compare(array(i), array(i)) == Greater.
* @param compare Callback used at every guess index to determine whether
* the search element has been found, or whether to search
* above or below the guess index.
* @return The first element where compare(element) == Equal. There is no guarantee
* which element is chosen if many elements return Equal.
* @param array
* Must be sorted according to compare function so that for all i > j, compare(array(i),
* array(i)) == Greater.
* @param compare
* Callback used at every guess index to determine whether the search element has been found,
* or whether to search above or below the guess index.
* @return
* The first element where compare(element) == Equal. There is no guarantee which element is
* chosen if many elements return Equal.
*/
def array[T](
array: Array[T],
Expand Down
8 changes: 4 additions & 4 deletions mdoc/src/main/scala/mdoc/internal/pos/TokenEditDistance.scala
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ object TokenEditDistance {

/** Build utility to map offsets between two slightly different strings.
*
* @param original The original snapshot of a string, for example the latest
* semanticdb snapshot.
* @param revised The current snapshot of a string, for example open buffer
* in an editor.
* @param original
* The original snapshot of a string, for example the latest semanticdb snapshot.
* @param revised
* The current snapshot of a string, for example open buffer in an editor.
*/
def apply(original: IndexedSeq[Token], revised: IndexedSeq[Token]): TokenEditDistance = {
val buffer = Array.newBuilder[MatchingToken]
Expand Down
12 changes: 8 additions & 4 deletions runtime/src/main/scala/mdoc/document/CompileResult.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,18 @@ object CompileResult {
sealed trait CompileError extends CompileResult

/** Compiler reported an error message during typechecking.
* @param message the typechecking error message (without position formatting)
* @param pos the range position inside the code fence
* @param message
* the typechecking error message (without position formatting)
* @param pos
* the range position inside the code fence
*/
final case class TypeError(message: String, pos: RangePosition) extends CompileError

/** Compiler reported an error message during parsing.
* @param message the syntax error message (without position formatting)
* @param pos the range position inside the code fence
* @param message
* the syntax error message (without position formatting)
* @param pos
* the range position inside the code fence
*/
final case class ParseError(message: String, pos: RangePosition) extends CompileError

Expand Down
17 changes: 10 additions & 7 deletions tests/unit/src/main/scala/tests/cli/StringFS.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@ object StringFS {
*
* Use `asString` for the inverse, go from a temporary directory to a string.
*
* @param layout the string representing the directory layout.
* NOTE. Lines starting with forward slash / are always interpreted
* as the start of a new file entry.
* @param root the temporary directory to apply the layout markup.
* If not provided, defaults to a fresh temporary directory.
* @param layout
* the string representing the directory layout. NOTE. Lines starting with forward slash / are
* always interpreted as the start of a new file entry.
* @param root
* the temporary directory to apply the layout markup. If not provided, defaults to a fresh
* temporary directory.
*/
def fromString(
layout: String,
Expand Down Expand Up @@ -73,8 +74,10 @@ object StringFS {
* assert(asString(fromString(layout)) == layout)
* }}}
*
* @param root the directory to print as a string
* @param includePath an optional filter function to exclude files
* @param root
* the directory to print as a string
* @param includePath
* an optional filter function to exclude files
*/
def asString(
root: AbsolutePath,
Expand Down