Skip to content

Commit c606e04

Browse files
committed
to fix code style issues
1 parent 51cbbfe commit c606e04

File tree

8 files changed

+17
-21
lines changed

8 files changed

+17
-21
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ This file is auto-generate by a github hook please modify r.md if you don't want
33
-->
44
![Build Status](https://github.com/SOFTNETWORK-APP/generic-resource-api/workflows/Build/badge.svg)
55
[![Scala Steward badge](https://img.shields.io/badge/Scala_Steward-helping-blue.svg?style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAQCAMAAAARSr4IAAAAVFBMVEUAAACHjojlOy5NWlrKzcYRKjGFjIbp293YycuLa3pYY2LSqql4f3pCUFTgSjNodYRmcXUsPD/NTTbjRS+2jomhgnzNc223cGvZS0HaSD0XLjbaSjElhIr+AAAAAXRSTlMAQObYZgAAAHlJREFUCNdNyosOwyAIhWHAQS1Vt7a77/3fcxxdmv0xwmckutAR1nkm4ggbyEcg/wWmlGLDAA3oL50xi6fk5ffZ3E2E3QfZDCcCN2YtbEWZt+Drc6u6rlqv7Uk0LdKqqr5rk2UCRXOk0vmQKGfc94nOJyQjouF9H/wCc9gECEYfONoAAAAASUVORK5CYII=)](https://scala-steward.org)
6-
[![codecov](https://codecov.io/gh/SOFTNETWORK-APP/generic-resource-api/branch/main/graph/badge.svg)](https://codecov.io/gh/SOFTNETWORK-APP/generic-resource-api/)
6+
[![codecov](https://codecov.io/gh/SOFTNETWORK-APP/generic-resource-api/branch/feature%2Fquality/graph/badge.svg)](https://codecov.io/gh/SOFTNETWORK-APP/generic-resource-api/)
77
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/122252a6bdfb41c3af16d31f8cefaecc)](https://www.codacy.com/gh/SOFTNETWORK-APP/generic-resource-api/dashboard?utm_source=github.com&utm_medium=referral&utm_content=SOFTNETWORK-APP/generic-resource-api&utm_campaign=Badge_Grade)
88
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
99

api/src/main/scala/app/softnetwork/resource/api/ResourceApi.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import akka.actor.typed.ActorSystem
44
import app.softnetwork.persistence.jdbc.query.JdbcSchema.SchemaType
55
import app.softnetwork.persistence.jdbc.query.JdbcSchemaProvider
66
import app.softnetwork.persistence.launch.PersistentEntity
7+
import app.softnetwork.persistence.launch.PersistenceGuardian._
78
import app.softnetwork.resource.launch.GenericResourceApplication
89
import app.softnetwork.resource.message.ResourceEvents.ResourceEvent
910
import app.softnetwork.resource.message.ResourceMessages.{ResourceCommand, ResourceResult}
@@ -13,8 +14,6 @@ import app.softnetwork.resource.persistence.typed.ResourceBehavior
1314
trait ResourceApi extends GenericResourceApplication[Resource] with JdbcSchemaProvider {
1415
def jdbcSchemaType: SchemaType = this.schemaType
1516

16-
import app.softnetwork.persistence.launch.PersistenceGuardian._
17-
1817
override def resourceEntity
1918
: ActorSystem[_] => PersistentEntity[ResourceCommand, Resource, ResourceEvent, ResourceResult] =
2019
_ => ResourceBehavior

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ ThisBuild / organization := "app.softnetwork"
3131

3232
name := "resource"
3333

34-
ThisBuild / version := "0.1.1"
34+
ThisBuild / version := "0.1.2"
3535

3636
ThisBuild / scalaVersion := "2.12.15"
3737

common/src/main/scala/app/softnetwork/resource/config/ResourceSettings.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import com.typesafe.config.{Config, ConfigFactory}
55
import com.typesafe.scalalogging.StrictLogging
66
import configs.Configs
77

8+
import scala.collection.JavaConverters._
9+
810
object ResourceSettings extends StrictLogging {
911

1012
lazy val config: Config = ConfigFactory.load()
@@ -19,8 +21,6 @@ object ResourceSettings extends StrictLogging {
1921

2022
val LibraryDirectory: String = config.getString("resource.library-directory")
2123

22-
import scala.collection.JavaConverters._
23-
2424
val ImageSizes: Map[String, ImageSize] = config
2525
.getStringList("resource.images.sizes")
2626
.asScala

core/src/main/scala/app/softnetwork/resource/service/GenericResourceService.scala

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import app.softnetwork.resource.handlers.{GenericResourceHandler, ResourceHandle
1313
import app.softnetwork.resource.message.ResourceMessages._
1414
import com.softwaremill.session.CsrfDirectives._
1515
import com.softwaremill.session.CsrfOptions._
16-
import org.softnetwork.session.model.Session
16+
import org.softnetwork.session.model.Session._
1717
import app.softnetwork.persistence.service.Service
1818
import app.softnetwork.resource.spi._
1919
import app.softnetwork.serialization.commonFormats
@@ -38,8 +38,6 @@ trait GenericResourceService
3838

3939
implicit def formats: Formats = commonFormats
4040

41-
import Session._
42-
4341
val route: Route = {
4442
pathPrefix(ResourceSettings.ResourcePath) {
4543
library ~ images ~ resource()

core/src/main/scala/app/softnetwork/resource/spi/LocalFileSystemProvider.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import app.softnetwork.utils.{Base64Tools, ImageTools, MimeTypeTools}
1313
import com.typesafe.scalalogging.StrictLogging
1414

1515
import java.nio.file.{Files, LinkOption, Path, Paths}
16+
import java.util.stream.Collectors
17+
import scala.collection.JavaConverters._
1618
import scala.util.matching.Regex
1719
import scala.util.{Failure, Success, Try}
1820

@@ -154,8 +156,6 @@ trait LocalFileSystemProvider extends ResourceProvider with StrictLogging {
154156
override def listResources(uri: String): List[SimpleResource] = {
155157
Try {
156158
val dir = Paths.get(rootDir, LibraryDirectory, uri)
157-
import java.util.stream.Collectors
158-
import scala.collection.JavaConverters._
159159
Files
160160
.list(dir)
161161
.filter(path =>

testkit/src/main/scala/app/softnetwork/resource/scalatest/ResourceToLocalFileSystemTestKit.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package app.softnetwork.resource.scalatest
22

33
import akka.actor.typed.ActorSystem
44
import app.softnetwork.persistence.launch.PersistentEntity
5+
import app.softnetwork.persistence.launch.PersistenceGuardian._
56
import app.softnetwork.persistence.query.InMemoryJournalProvider
67
import app.softnetwork.resource.message.ResourceEvents.ResourceEvent
78
import app.softnetwork.resource.message.ResourceMessages.{ResourceCommand, ResourceResult}
@@ -15,8 +16,6 @@ import org.scalatest.Suite
1516

1617
trait ResourceToLocalFileSystemTestKit extends GenericResourceTestKit[Resource] { _: Suite =>
1718

18-
import app.softnetwork.persistence.launch.PersistenceGuardian._
19-
2019
override def resourceEntity
2120
: ActorSystem[_] => PersistentEntity[ResourceCommand, Resource, ResourceEvent, ResourceResult] =
2221
_ => ResourceBehavior

testkit/src/test/scala/app/softnetwork/resource/handlers/ResourceHandlerSpec.scala

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,20 @@ class ResourceHandlerSpec
2626

2727
implicit lazy val system: ActorSystem[_] = typedSystem()
2828

29-
var _bytes: Array[Byte] = _
29+
var bytes: Array[Byte] = _
3030

31-
var _md5: String = _
31+
var md5: String = _
3232

3333
val uri: Option[String] = Some("/resources")
3434

3535
override def beforeAll(): Unit = {
3636
super.beforeAll()
3737
val path =
3838
Paths.get(Thread.currentThread().getContextClassLoader.getResource("avatar.png").getPath)
39-
_bytes = Files.readAllBytes(path)
40-
_md5 = HashTools
39+
bytes = Files.readAllBytes(path)
40+
md5 = HashTools
4141
.hashStream(
42-
new ByteArrayInputStream(_bytes)
42+
new ByteArrayInputStream(bytes)
4343
)
4444
.getOrElse("")
4545
val dir = new Directory(new File(rootDir))
@@ -79,7 +79,7 @@ class ResourceHandlerSpec
7979
assert(Files.exists(Paths.get(s"$rootDir${uri.getOrElse("")}/load")))
8080
?("load", LoadResource("load")) await {
8181
case r: ResourceLoaded =>
82-
r.resource.md5 shouldBe _md5
82+
r.resource.md5 shouldBe md5
8383
for (size <- ImageSizes.values) {
8484
loadResource("load", uri, None, Seq(SizeOption(size)): _*) match {
8585
case Some(_) =>
@@ -140,9 +140,9 @@ class ResourceHandlerSpec
140140
?(
141141
entityId,
142142
if (update) {
143-
UpdateResource(entityId, _bytes, uri)
143+
UpdateResource(entityId, bytes, uri)
144144
} else {
145-
CreateResource(entityId, _bytes, uri)
145+
CreateResource(entityId, bytes, uri)
146146
}
147147
)
148148
}

0 commit comments

Comments
 (0)