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 scalafix stuff… #1333

Merged
merged 3 commits into from
Sep 13, 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
15 changes: 14 additions & 1 deletion .scalafix3.conf
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
# Same as .scalafix.conf, but for RemoveUnused commented out
rules = [
DisableSyntax,
# RemoveUnused
# RemoveUnused,
OrganizeImports,
NoValInForComprehension,
# ProcedureSyntax
]
DisableSyntax.noFinalize = true
DisableSyntax.noIsInstanceOf = true
DisableSyntax.noReturns = true

// `rules` on compilation
triggered.rules = [
DisableSyntax
]

OrganizeImports {
coalesceToWildcardImportThreshold = 6
expandRelative = true
groups = ["*", "re:javax?\\.", "scala."]
groupedImports = AggressiveMerge
removeUnused = false # added for Scala 3
}
2 changes: 1 addition & 1 deletion modules/build/src/main/scala/scala/build/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import scala.annotation.tailrec
import scala.build.EitherCps.{either, value}
import scala.build.Inputs.VirtualScript.VirtualScriptNameRegex
import scala.build.Ops.*
import scala.build.actionable.ActionablePreprocessor
import scala.build.compiler.{ScalaCompiler, ScalaCompilerMaker}
import scala.build.errors.*
import scala.build.internal.{Constants, CustomCodeWrapper, MainClass, Util}
Expand All @@ -23,7 +24,6 @@ import scala.collection.mutable.ListBuffer
import scala.concurrent.duration.DurationInt
import scala.util.Properties
import scala.util.control.NonFatal
import scala.build.actionable.ActionablePreprocessor

trait Build {
def inputs: Inputs
Expand Down
3 changes: 1 addition & 2 deletions modules/build/src/main/scala/scala/build/Inputs.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@ import java.nio.charset.StandardCharsets
import java.security.MessageDigest

import scala.annotation.tailrec
import scala.build.Inputs.WorkspaceOrigin
import scala.build.Inputs.{Element, WorkspaceOrigin}
import scala.build.errors.{BuildException, InputsException}
import scala.build.internal.Constants
import scala.build.internal.zip.WrappedZipInputStream
import scala.build.options.Scope
import scala.build.preprocessing.ScopePath
import scala.util.Properties
import scala.util.matching.Regex
import scala.build.Inputs.Element

final case class Inputs(
elements: Seq[Inputs.Element],
Expand Down
4 changes: 1 addition & 3 deletions modules/build/src/main/scala/scala/build/bsp/BspClient.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import java.net.URI
import java.nio.file.Paths
import java.util.concurrent.{ConcurrentHashMap, ExecutorService}

import ch.epfl.scala.bsp4j.Location

import scala.build.Position.File
import scala.build.errors.{BuildException, CompositeBuildException, Diagnostic, Severity}
import scala.build.postprocessing.LineConversion
Expand Down Expand Up @@ -197,7 +195,7 @@ class BspClient(
new b.Diagnostic(range, diag.message)

diag.relatedInformation.foreach { relatedInformation =>
val location = new Location(path.toNIO.toUri.toASCIIString, range)
val location = new b.Location(path.toNIO.toUri.toASCIIString, range)
val related = new b.DiagnosticRelatedInformation(location, relatedInformation.message)
bDiag.setRelatedInformation(List(related).asJava)
}
Expand Down
5 changes: 3 additions & 2 deletions modules/build/src/main/scala/scala/build/bsp/BspImpl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ import org.eclipse.lsp4j.jsonrpc.messages.ResponseError

import java.io.{InputStream, OutputStream}
import java.util.concurrent.{CompletableFuture, Executor}
import scala.build.*

import scala.build.EitherCps.{either, value}
import scala.build.*
import scala.build.actionable.ActionablePreprocessor
import scala.build.bloop.BloopServer
import scala.build.compiler.BloopCompiler
import scala.build.errors.{BuildException, Diagnostic, ParsingInputsException}
Expand All @@ -20,7 +22,6 @@ import scala.concurrent.duration.DurationInt
import scala.concurrent.{ExecutionContext, Future, Promise}
import scala.jdk.CollectionConverters.*
import scala.util.{Failure, Success}
import scala.build.actionable.ActionablePreprocessor

/** The implementation for [[Bsp]].
*
Expand Down
3 changes: 2 additions & 1 deletion modules/build/src/main/scala/scala/build/bsp/package.scala
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package scala.build

import ch.epfl.scala.bsp4j as b
import ch.epfl.scala.bsp4j.SourcesItem
import ch.epfl.scala.bsp4j as b

import java.util.concurrent.CompletableFuture

import scala.jdk.CollectionConverters.*

package object bsp {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package scala.build.internal.markdown

import scala.annotation.tailrec
import scala.build.internal.AmmUtil
import scala.build.internal.markdown.MarkdownCodeBlock
import scala.build.internal.Name
import scala.build.internal.{AmmUtil, Name}

/** A util for extraction and wrapping of code blocks in Markdown files.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
package scala.build.preprocessing
import scala.build.Logger
import scala.build.Ops._
import scala.build.errors.{BuildException, CompositeBuildException}
import scala.build.errors.{BuildException, CompositeBuildException, DirectiveErrors}
import scala.build.options.ConfigMonoid
import scala.build.preprocessing.directives.{
DirectiveHandler,
DirectiveUtil,
ProcessedDirective,
ScopedDirective,
StrictDirective
}
import scala.build.errors.DirectiveErrors
import scala.build.preprocessing.directives.DirectiveUtil

object DirectivesProcessor {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package scala.build.preprocessing

import java.nio.charset.StandardCharsets

import scala.build.EitherCps.{either, value}
import scala.build.errors.BuildException
import scala.build.internal.markdown.MarkdownCodeWrapper
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import dependency.AnyDependency
import dependency.parser.DependencyParser

import java.nio.charset.StandardCharsets

import scala.build.EitherCps.{either, value}
import scala.build.Ops.*
import scala.build.errors.*
Expand Down
3 changes: 1 addition & 2 deletions modules/cli/src/main/scala/scala/cli/commands/Bsp.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ import scala.build.{Build, CrossSources, Inputs, PersistentDiagnosticLogger, Sou
import scala.cli.CurrentParams
import scala.cli.commands.util.CommonOps._
import scala.cli.commands.util.SharedOptionsUtil._
import scala.cli.config.{ConfigDb, Keys}
import scala.concurrent.Await
import scala.concurrent.duration.Duration
import scala.cli.config.{ConfigDb, Keys}
import scala.cli.commands.util.CommonOps.SharedDirectoriesOptionsOps

object Bsp extends ScalaCommand[BspOptions] {
override def hidden = true
Expand Down
3 changes: 1 addition & 2 deletions modules/cli/src/main/scala/scala/cli/commands/Clean.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ import caseapp._

import scala.build.internal.Constants
import scala.build.{Inputs, Os}
import scala.cli.CurrentParams
import scala.cli.commands.util.CommonOps._
import scala.cli.ScalaCli
import scala.cli.{CurrentParams, ScalaCli}

object Clean extends ScalaCommand[CleanOptions] {
override def group = "Main"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import java.io.File
import scala.build.options.Scope
import scala.build.{Build, BuildThreads, Builds, Os}
import scala.cli.CurrentParams
import scala.cli.commands.util.CommonOps.SharedDirectoriesOptionsOps
import scala.cli.commands.util.SharedOptionsUtil._
import scala.cli.config.{ConfigDb, Keys}
import scala.cli.commands.util.CommonOps.SharedDirectoriesOptionsOps

object Compile extends ScalaCommand[CompileOptions] {
override def group = "Main"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package scala.cli.commands

import caseapp.core.help.RuntimeCommandsHelp
import caseapp.core.{Error, RemainingArgs}
import scala.cli.commands.util.SharedOptionsUtil.*

import scala.build.internal.Constants
import scala.cli.commands.util.SharedOptionsUtil.*
import scala.cli.{CurrentParams, ScalaCliHelp}

class Default(
Expand Down
4 changes: 2 additions & 2 deletions modules/cli/src/main/scala/scala/cli/commands/Doc.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ import scala.build.errors.BuildException
import scala.build.interactive.InteractiveFileOps
import scala.build.internal.Runner
import scala.cli.CurrentParams
import scala.cli.commands.util.CommonOps.SharedDirectoriesOptionsOps
import scala.cli.commands.util.SharedOptionsUtil._
import scala.cli.config.{ConfigDb, Keys}
import scala.cli.errors.ScaladocGenerationFailedError
import scala.util.Properties
import scala.cli.config.{ConfigDb, Keys}
import scala.cli.commands.util.CommonOps.SharedDirectoriesOptionsOps

object Doc extends ScalaCommand[DocOptions] {
override def group = "Main"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import java.io.File
import scala.build.internal.{Constants, ExternalBinaryParams, FetchExternalBinary, Runner}
import scala.build.{Build, BuildThreads, Logger}
import scala.cli.CurrentParams
import scala.cli.commands.util.CommonOps.SharedDirectoriesOptionsOps
import scala.cli.commands.util.SharedOptionsUtil._
import scala.cli.config.{ConfigDb, Keys}
import scala.cli.packaging.Library
import scala.util.Properties
import scala.cli.config.{ConfigDb, Keys}
import scala.cli.commands.util.CommonOps.SharedDirectoriesOptionsOps

object Metabrowse extends ScalaCommand[MetabrowseOptions] {
override def hidden = true
Expand Down
3 changes: 2 additions & 1 deletion modules/cli/src/main/scala/scala/cli/commands/Package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ import java.io.{ByteArrayOutputStream, OutputStream}
import java.nio.charset.StandardCharsets
import java.nio.file.attribute.FileTime
import java.util.zip.{ZipEntry, ZipOutputStream}
import scala.build.*

import scala.build.EitherCps.{either, value}
import scala.build.Ops.*
import scala.build.*
import scala.build.errors.*
import scala.build.interactive.InteractiveFileOps
import scala.build.internal.Util.*
Expand Down
5 changes: 2 additions & 3 deletions modules/cli/src/main/scala/scala/cli/commands/Repl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@ import coursier.error.{FetchError, ResolutionError}

import scala.build.EitherCps.{either, value}
import scala.build._
import scala.build.errors.{BuildException, FetchingDependenciesError, CantDownloadAmmoniteError}
import scala.build.errors.{BuildException, CantDownloadAmmoniteError, FetchingDependenciesError}
import scala.build.internal.Runner
import scala.build.options.{BuildOptions, JavaOpt, Scope}
import scala.cli.CurrentParams
import scala.cli.commands.Run.maybePrintSimpleScalacOutput
import scala.cli.commands.util.CommonOps._
import scala.cli.commands.util.SharedOptionsUtil._
import scala.util.Properties
import scala.cli.config.{ConfigDb, Keys}
import scala.cli.commands.util.CommonOps.SharedDirectoriesOptionsOps
import scala.util.Properties

object Repl extends ScalaCommand[ReplOptions] {
override def group = "Main"
Expand Down
3 changes: 2 additions & 1 deletion modules/cli/src/main/scala/scala/cli/commands/Run.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ import caseapp.*

import java.io.File
import java.util.concurrent.CompletableFuture

import scala.build.EitherCps.{either, value}
import scala.build.*
import scala.build.errors.BuildException
import scala.build.internal.{Constants, Runner, ScalaJsLinkerConfig}
import scala.build.options.{BuildOptions, JavaOpt, Platform, ScalacOpt}
import scala.build.*
import scala.cli.CurrentParams
import scala.cli.commands.run.RunMode
import scala.cli.commands.util.CommonOps.SharedDirectoriesOptionsOps
Expand Down
2 changes: 1 addition & 1 deletion modules/cli/src/main/scala/scala/cli/commands/Test.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import scala.build.options.{BuildOptions, JavaOpt, Platform, Scope}
import scala.build.testrunner.AsmTestRunner
import scala.build.{Build, BuildThreads, Builds, CrossKey, Logger, Positioned}
import scala.cli.CurrentParams
import scala.cli.commands.util.CommonOps.SharedDirectoriesOptionsOps
import scala.cli.commands.util.SharedOptionsUtil._
import scala.cli.config.{ConfigDb, Keys}
import scala.cli.commands.util.CommonOps.SharedDirectoriesOptionsOps

object Test extends ScalaCommand[TestOptions] {
override def group = "Main"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import caseapp.core.RemainingArgs

import scala.build.Logger
import scala.build.bloop.BloopThreads
import scala.build.blooprifle.{BloopRifle, BloopRifleConfig}
import scala.build.blooprifle.internal.{Constants, Operations}
import scala.build.blooprifle.{BloopRifle, BloopRifleConfig}
import scala.build.internal.OsLibc
import scala.cli.CurrentParams
import scala.cli.commands.{ScalaCommand, SharedOptions}
import scala.cli.commands.util.CommonOps._
import scala.cli.commands.util.SharedCompilationServerOptionsUtil._
import scala.cli.commands.util.SharedOptionsUtil._
import scala.cli.commands.{ScalaCommand, SharedOptions}
import scala.concurrent.Await
import scala.concurrent.duration.Duration

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@ import dependency._
import scala.build.EitherCps.{either, value}
import scala.build.Logger
import scala.build.errors.BuildException
import scala.build.internal.{Constants, FetchExternalBinary, Runner}
import scala.build.internal.{
Constants,
ExternalBinary,
ExternalBinaryParams,
FetchExternalBinary,
Runner
}
import scala.cli.ScalaCli
import scala.cli.commands.util.CommonOps._
import scala.util.Properties
import scala.build.internal.ExternalBinaryParams
import scala.build.internal.ExternalBinary
import scala.cli.commands.util.JvmUtils
import scala.util.Properties

abstract class PgpExternalCommand extends ExternalCommand {
def progName: String = ScalaCli.progName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,30 @@ import java.nio.file.Paths
import java.time.{Instant, LocalDateTime, ZoneOffset}
import java.util.concurrent.Executors
import java.util.function.Supplier
import scala.build.*

import scala.build.EitherCps.{either, value}
import scala.build.Ops.*
import scala.build.*
import scala.build.compiler.ScalaCompilerMaker
import scala.build.errors.{BuildException, CompositeBuildException, NoMainClassFoundError}
import scala.build.internal.Util
import scala.build.internal.Util.ScalaDependencyOps
import scala.build.options.publish.{ComputeVersion, Developer, License, Vcs, Signer as PSigner}
import scala.build.options.publish.{ComputeVersion, Developer, License, Signer => PSigner, Vcs}
import scala.build.options.{BuildOptions, ConfigMonoid, PublishContextualOptions, Scope}
import scala.cli.CurrentParams
import scala.cli.commands.pgp.PgpExternalCommand
import scala.cli.commands.publish.{PublishParamsOptions, PublishRepositoryOptions}
import scala.cli.commands.util.CommonOps.SharedDirectoriesOptionsOps
import scala.cli.commands.util.MainClassOptionsUtil.*
import scala.cli.commands.util.PublishUtils.*
import scala.cli.commands.util.SharedOptionsUtil.*
import scala.cli.commands.util.{BuildCommandHelpers, ScalaCliSttpBackend}
import scala.cli.commands.util.SharedOptionsUtil.*
import scala.cli.commands.util.PublishUtils.*
import scala.cli.commands.{
MainClassOptions,
Package => PackageCmd,
ScalaCommand,
SharedOptions,
WatchUtil,
Package as PackageCmd
WatchUtil
}
import scala.cli.config.{ConfigDb, Keys}
import scala.cli.errors.{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ import scala.cli.commands.config.ThrowawayPgpSecret
import scala.cli.commands.pgp.{KeyServer, PgpProxyMaker}
import scala.cli.commands.publish.{OptionCheck, PublishSetupOptions, SetSecret}
import scala.cli.commands.util.JvmUtils
import scala.cli.commands.util.PublishUtils._
import scala.cli.config.{ConfigDb, Keys}
import scala.cli.errors.MissingPublishOptionError
import scala.cli.signing.shared.PasswordOption
import scala.cli.util.ConfigPasswordOptionHelpers._
import scala.cli.commands.util.PublishUtils._

final case class PgpSecretKeyCheck(
options: PublishSetupOptions,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package scala.cli.commands.util

import scala.build.{Build, Logger}
import scala.build.errors.MainClassError
import scala.build.{Build, Logger}
import scala.cli.commands.ScalaCommand

trait BuildCommandHelpers { self: ScalaCommand[_] =>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package scala.cli.commands.util
import coursier.core.Version

import scala.build.internal.FetchExternalBinary
import scala.build.options.BuildOptions
import scala.cli.commands.FmtOptions
import scala.cli.commands.util.SharedOptionsUtil._
import scala.util.Properties

import coursier.core.Version

object FmtOptionsUtil {
implicit class FmtOptionsOps(v: FmtOptions) {
import v._
Expand Down
Loading