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

pythonlib: add linting with ruff #4072

Merged
merged 17 commits into from
Jan 31, 2025
Prev Previous commit
Next Next commit
[autofix.ci] apply automated fixes
  • Loading branch information
autofix-ci[bot] authored Jan 31, 2025
commit e2d3dc5d52823bd4fc31c63bca653edcfe4b702e
3 changes: 1 addition & 2 deletions example/pythonlib/linting/2-ruff-check/build.mill
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package build
import mill._, pythonlib._

object `package` extends RootModule with PythonModule with RuffModule {
}
object `package` extends RootModule with PythonModule with RuffModule {}

/** See Also: src/main.py */

Expand Down
10 changes: 5 additions & 5 deletions pythonlib/src/mill/pythonlib/RuffModule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ trait RuffModule extends PythonModule {
*/
def ruffOptions: T[Seq[String]] = Task { Seq.empty[String] }

protected def configArgs: Task[Seq[String]] = Task.Anon {
protected def configArgs: Task[Seq[String]] = Task.Anon {
val cfg = ruffConfigFile()
if (os.exists(cfg.path)) Seq("--config", cfg.path.toString) else Seq.empty[String]
}
Expand Down Expand Up @@ -84,8 +84,8 @@ object RuffModule extends ExternalModule with RuffModule with TaskModule {
override def defaultCommandName(): String = "formatAll"

def formatAll(
sources: Tasks[Seq[PathRef]] = Tasks.resolveMainDefault("__.sources"),
@mainargs.arg(positional = true) ruffArgs: Args
sources: Tasks[Seq[PathRef]] = Tasks.resolveMainDefault("__.sources"),
@mainargs.arg(positional = true) ruffArgs: Args
): Command[Unit] = Task.Command {
runner().run(
// format: off
Expand All @@ -103,8 +103,8 @@ object RuffModule extends ExternalModule with RuffModule with TaskModule {
}

def checkAll(
sources: Tasks[Seq[PathRef]] = Tasks.resolveMainDefault("__.sources"),
@mainargs.arg(positional = true) ruffArgs: Args
sources: Tasks[Seq[PathRef]] = Tasks.resolveMainDefault("__.sources"),
@mainargs.arg(positional = true) ruffArgs: Args
): Command[Unit] = Task.Command {
runner().run(
// format: off
Expand Down
Loading