Skip to content

Conversation

@miguelemosreverte
Copy link
Collaborator

@miguelemosreverte miguelemosreverte commented Apr 25, 2022

Ticket

https://jira/PER-123

Description

This is the project template

Types of changes

  • Refactor (non-breaking change which makes the codebase beautiful)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@miguelemosreverte
Copy link
Collaborator Author

Question @ffakenz @Ignacio-Rocca

Regarding scalafix

My experience with it was that it marked as errors unused imports and unused variables.

That is the advantage of using it.

My experience with it was that it also marked errors for files created during the akka-serverless development cycle.
(Files that are read only).

My opinion is that this experience is both not awe-inspiring regarding the pros (scalafmt = wow! scalafix = meh), and very cumbersome regarding the cons (basically its not compatible with akka-serverless)

So I put the opinion on the table and let you guys provide your opinions as well.

@miguelemosreverte miguelemosreverte changed the title [PER-123] improvement/ project template proposal [PER-123] - improvement/ project template proposal Apr 25, 2022
Copy link

@testagrossa testagrossa left a comment

Choose a reason for hiding this comment

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

we need to add following plugins:

// Versioning
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.9.0")
addSbtPlugin("com.dwijnand" % "sbt-dynver"    % "4.1.1")

// Packing and Publishing
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.8.1")
addSbtPlugin("com.mintbeans"    % "sbt-ecr"             % "0.16.0")

// Linting & Styling
addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.20")
addSbtPlugin("org.scalameta"             % "sbt-scalafmt" % "2.4.3")
addSbtPlugin("ch.epfl.scala"             % "sbt-scalafix" % "0.9.34")

addDependencyTreePlugin

Copy link

@testagrossa testagrossa left a comment

Choose a reason for hiding this comment

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

we miss .scalafix.conf file

# https://scalacenter.github.io/scalafix/docs/rules/overview.html
rules = [
  DisableSyntax
]

DisableSyntax.noThrows = true

Copy link

@testagrossa testagrossa left a comment

Choose a reason for hiding this comment

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

add .sbtops file

-J-Xms1G
-J-Xmx8G
-J-Xss1024M
-J-XX:MaxMetaspaceSize=2048M

@miguelemosreverte
Copy link
Collaborator Author

@testagrossa did you read the comment regarding scalafix?

@testagrossa
Copy link

@testagrossa did you read the comment regarding scalafix?

yes > akka-serverless projects will have to remove .scalafix if causes inconveniences, but it should be part of our template

@rockit-it
Copy link

@testagrossa did you read the comment regarding scalafix?

yes > akka-serverless projects will have to remove .scalafix if causes inconveniences, but it should be part of our template

same opinion here @miguelemosreverte

@miguelemosreverte
Copy link
Collaborator Author

@testagrossa @Ignacio-Rocca Roger Roger! scala-fix added then!

@miguelemosreverte
Copy link
Collaborator Author

@testagrossa @Ignacio-Rocca

ready!
approve?

.settings(
name := "template",
libraryDependencies += Testing.scalaTest
)
Copy link

@testagrossa testagrossa Apr 25, 2022

Choose a reason for hiding this comment

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

we miss to add the following settings to the project:

lazy val scalafixSettings: Seq[Setting[_]] = Seq(
  addCompilerPlugin(scalafixSemanticdb),
  semanticdbEnabled := true,
  scalafixOnCompile := true
)

and then do

.enablePlugins(DockerPlugin, AshScriptPlugin)
.settings(scalafixSettings)

and would be also nice to add

run / fork  := true
Test / fork := true

to the build.sbt

Choose a reason for hiding this comment

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

also would be nice to add the docker publish as part of the GHA

Copy link

@testagrossa testagrossa left a comment

Choose a reason for hiding this comment

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

app packaging is missing

Copy link

@testagrossa testagrossa left a comment

Choose a reason for hiding this comment

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

we also need to add the followings below scalaVersion and organization on build.sbt

ThisBuild / versionScheme   := Some("early-semver")
ThisBuild / dynverSeparator := "-"
ThisBuild / conflictManager := ConflictManager.latestRevision
ThisBuild / javacOptions ++= Seq("-source", "11", "-target", "11")
ThisBuild / scalacOptions += "-Ymacro-annotations"


// Packing and Publishing
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.8.1")
addSbtPlugin("com.mintbeans" % "sbt-ecr" % "0.16.0")
Copy link

@testagrossa testagrossa Apr 25, 2022

Choose a reason for hiding this comment

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

this is not needed right now (the ecr plugin)

@miguelemosreverte
Copy link
Collaborator Author

@testagrossa

In general all the feedback is welcomed, expect for the macro annotations.

I have not used them not even once in all my career. They will be not added to the project settings because they are clearly never used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants