playframework/play-samples

Format each sample project

ignasi35 opened this issue · 2 comments

We could add something like https://github.com/akka/akka-guide/blob/54a81ce729ef07e1f9b97f0f15a4ff7d60e4d0ed/scripts/format-all.sh and even remove the separate Travis jobs.
WDYT?

Code, click to exapnd
#!/usr/bin/env bash

declare -r tutorial_root="docs-source/docs/modules/microservices-tutorial/examples"

find ${tutorial_root} -name .scalafmt.conf |
while read result
do
	pushd $(dirname $result)
	sbt scalafmtAll
	popd
done

find ${tutorial_root} -name pom.xml |
while read result
do
	pushd $(dirname $result)
	mvn spotless:apply
	popd
done

Originally posted by @ennru in #116 (comment)

I think running the most stable samples in a single travis job could be benefinicial.

If memory serves, here's the usual suspect with more recent flakiness or failures:

  • play-xxx-grpc
  • play-xxx-websocket
  • play-scala-tls

At least.

mkurz commented

I like the idea of running scalafmt / javafmt for all examples. We currently have that commented out:

jobs:
# check-code-style:
# name: Code Style
# uses: playframework/.github/.github/workflows/cmd.yml@v3
# with:
# cmd: sbt validateCode
tests:
name: Tests
# needs:
# - "check-code-style"

We could place a global scalafmt config in the root folder and have format script that copies that scalamt config into each project and then goes through the projects and runs validateCode. Very similiar to the test script (even combine those two).
Also maybe same approach is needed with the commons.sbt files which contains the validate commands.