play-samples icon indicating copy to clipboard operation
play-samples copied to clipboard

Format each sample project

Open ignasi35 opened this issue 5 years ago • 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 https://github.com/playframework/play-samples/pull/116#discussion_r518005653

ignasi35 avatar Nov 05 '20 15:11 ignasi35

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.

ignasi35 avatar Nov 05 '20 16:11 ignasi35

I like the idea of running scalafmt / javafmt for all examples. We currently have that commented out: https://github.com/playframework/play-samples/blob/f2a88965af5a574edff65dc15b33b3fd954cd6f5/.github/workflows/build-test.yml#L15-L25

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.

mkurz avatar Mar 04 '23 09:03 mkurz