From 479206bf9f58678743b1302fd5a6498db1889714 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sun, 22 Aug 2021 06:28:25 +0200 Subject: [PATCH 1/2] Update scalafmt-core to 3.0.0 --- .scalafmt.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.scalafmt.conf b/.scalafmt.conf index dee978305..a429b95b3 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,4 +1,4 @@ -version=2.7.5 +version=3.0.0 maxColumn = 100 project.git = true align.preset = none From f42a9b1a8533ab4096595eb235ffcf8d1c654326 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sun, 22 Aug 2021 06:28:35 +0200 Subject: [PATCH 2/2] Reformat with scalafmt 3.0.0 --- cli/src/main/scala/mdoc/Variable.scala | 60 ++++++++++--------- .../scala/mdoc/internal/cli/InputFile.scala | 15 +++-- .../mdoc/internal/CompatClassloader.scala | 4 +- .../livereload/UndertowLiveReload.scala | 17 +++--- .../mdoc/internal/markdown/Markdown.scala | 4 +- .../internal/markdown/MdocExtensions.scala | 7 ++- .../mdoc/internal/pos/BinarySearch.scala | 21 +++---- .../mdoc/internal/pos/TokenEditDistance.scala | 8 +-- .../scala/mdoc/document/CompileResult.scala | 12 ++-- .../src/main/scala/tests/cli/StringFS.scala | 17 +++--- 10 files changed, 93 insertions(+), 72 deletions(-) diff --git a/cli/src/main/scala/mdoc/Variable.scala b/cli/src/main/scala/mdoc/Variable.scala index dd48187ed..524709e15 100644 --- a/cli/src/main/scala/mdoc/Variable.scala +++ b/cli/src/main/scala/mdoc/Variable.scala @@ -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 @@ -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, diff --git a/cli/src/main/scala/mdoc/internal/cli/InputFile.scala b/cli/src/main/scala/mdoc/internal/cli/InputFile.scala index a3a777ca8..5d2602ca3 100644 --- a/cli/src/main/scala/mdoc/internal/cli/InputFile.scala +++ b/cli/src/main/scala/mdoc/internal/cli/InputFile.scala @@ -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, diff --git a/mdoc/src/main/scala/mdoc/internal/CompatClassloader.scala b/mdoc/src/main/scala/mdoc/internal/CompatClassloader.scala index 1fd82023f..4750bebbc 100644 --- a/mdoc/src/main/scala/mdoc/internal/CompatClassloader.scala +++ b/mdoc/src/main/scala/mdoc/internal/CompatClassloader.scala @@ -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]) { diff --git a/mdoc/src/main/scala/mdoc/internal/livereload/UndertowLiveReload.scala b/mdoc/src/main/scala/mdoc/internal/livereload/UndertowLiveReload.scala index 2c6ab90fc..133211a26 100644 --- a/mdoc/src/main/scala/mdoc/internal/livereload/UndertowLiveReload.scala +++ b/mdoc/src/main/scala/mdoc/internal/livereload/UndertowLiveReload.scala @@ -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, diff --git a/mdoc/src/main/scala/mdoc/internal/markdown/Markdown.scala b/mdoc/src/main/scala/mdoc/internal/markdown/Markdown.scala index 317864ded..71175416b 100644 --- a/mdoc/src/main/scala/mdoc/internal/markdown/Markdown.scala +++ b/mdoc/src/main/scala/mdoc/internal/markdown/Markdown.scala @@ -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 diff --git a/mdoc/src/main/scala/mdoc/internal/markdown/MdocExtensions.scala b/mdoc/src/main/scala/mdoc/internal/markdown/MdocExtensions.scala index 0ad665e9e..e152274ba 100644 --- a/mdoc/src/main/scala/mdoc/internal/markdown/MdocExtensions.scala +++ b/mdoc/src/main/scala/mdoc/internal/markdown/MdocExtensions.scala @@ -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 diff --git a/mdoc/src/main/scala/mdoc/internal/pos/BinarySearch.scala b/mdoc/src/main/scala/mdoc/internal/pos/BinarySearch.scala index 4243af90e..e4a4ba7d3 100644 --- a/mdoc/src/main/scala/mdoc/internal/pos/BinarySearch.scala +++ b/mdoc/src/main/scala/mdoc/internal/pos/BinarySearch.scala @@ -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], diff --git a/mdoc/src/main/scala/mdoc/internal/pos/TokenEditDistance.scala b/mdoc/src/main/scala/mdoc/internal/pos/TokenEditDistance.scala index 3f80aedd4..f5efa4b96 100644 --- a/mdoc/src/main/scala/mdoc/internal/pos/TokenEditDistance.scala +++ b/mdoc/src/main/scala/mdoc/internal/pos/TokenEditDistance.scala @@ -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] diff --git a/runtime/src/main/scala/mdoc/document/CompileResult.scala b/runtime/src/main/scala/mdoc/document/CompileResult.scala index d0b6a8fbb..27ce27c0a 100644 --- a/runtime/src/main/scala/mdoc/document/CompileResult.scala +++ b/runtime/src/main/scala/mdoc/document/CompileResult.scala @@ -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 diff --git a/tests/unit/src/main/scala/tests/cli/StringFS.scala b/tests/unit/src/main/scala/tests/cli/StringFS.scala index b79fe8d51..2b5690a56 100644 --- a/tests/unit/src/main/scala/tests/cli/StringFS.scala +++ b/tests/unit/src/main/scala/tests/cli/StringFS.scala @@ -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, @@ -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,