• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pureconfig / pureconfig / 16844894943

09 Aug 2025 03:28AM UTC coverage: 94.686% (-0.04%) from 94.726%
16844894943

Pull #1838

web-flow
Merge 12f0062cf into 38f73c635
Pull Request #1838: Rid of deprecated URL constructor

1 of 1 new or added line in 1 file covered. (100.0%)

95 existing lines in 26 files now uncovered.

2744 of 2898 relevant lines covered (94.69%)

2.43 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

82.14
/core/src/main/scala/pureconfig/backend/ConfigFactoryWrapper.scala
1
package pureconfig.backend
2

3
import java.io.File
4
import java.net.URL
5
import java.nio.file.Path
6

7
import com.typesafe.config._
8

9
import pureconfig._
10
import pureconfig.backend.ErrorUtil._
11
import pureconfig.error._
12

13
/** A wrapper of `com.typesafe.config.ConfigFactory` whose methods return [[scala.Either]] instead of throwing
14
  * exceptions
15
  */
16
object ConfigFactoryWrapper {
17
  private[this] val strictSettings = ConfigParseOptions.defaults.setAllowMissing(false)
4✔
18

19
  /** @see `com.typesafe.config.ConfigFactory.invalidateCaches()` */
UNCOV
20
  def invalidateCaches(): ConfigReader.Result[Unit] =
21
    unsafeToReaderResult(ConfigFactory.invalidateCaches())
×
22

23
  /** @see `com.typesafe.config.ConfigFactory.load()` */
24
  def load(): ConfigReader.Result[Config] =
1✔
25
    unsafeToReaderResult(ConfigFactory.load())
3✔
26

27
  /** @see `com.typesafe.config.ConfigFactory.load(Config)` */
28
  def load(conf: Config): ConfigReader.Result[Config] =
1✔
29
    unsafeToReaderResult(ConfigFactory.load(conf))
2✔
30

31
  /** @see `com.typesafe.config.ConfigFactory.defaultReference()` */
UNCOV
32
  def defaultReference(): ConfigReader.Result[Config] =
33
    unsafeToReaderResult(ConfigFactory.defaultReference())
×
34

35
  /** @see `com.typesafe.config.ConfigFactory.defaultApplication()` */
UNCOV
36
  def defaultApplication(): ConfigReader.Result[Config] =
37
    unsafeToReaderResult(ConfigFactory.defaultApplication())
×
38

39
  /** @see `com.typesafe.config.ConfigFactory.defaultOverrides()` */
UNCOV
40
  def defaultOverrides(): ConfigReader.Result[Config] =
41
    unsafeToReaderResult(ConfigFactory.defaultOverrides())
×
42

43
  /** @see `com.typesafe.config.ConfigFactory.systemProperties()` */
UNCOV
44
  def systemProperties(): ConfigReader.Result[Config] =
45
    unsafeToReaderResult(ConfigFactory.systemProperties())
×
46

47
  /** @see `com.typesafe.config.ConfigFactory.parseString()` */
48
  def parseString(s: String): ConfigReader.Result[Config] =
1✔
49
    unsafeToReaderResult(ConfigFactory.parseString(s))
4✔
50

51
  /** @see `com.typesafe.config.ConfigFactory.parseFile()` */
52
  def parseFile(file: File): ConfigReader.Result[Config] =
1✔
53
    unsafeToReaderResult(
3✔
54
      ConfigFactory.parseFile(file, strictSettings),
3✔
55
      onIOFailure = Some(CannotReadFile(file.toPath, _))
2✔
56
    )
57

58
  /** @see `com.typesafe.config.ConfigFactory.parseFile()` */
59
  def parseFile(path: Path): ConfigReader.Result[Config] =
1✔
60
    unsafeToReaderResult(
2✔
61
      ConfigFactory.parseFile(path.toFile, strictSettings),
2✔
62
      onIOFailure = Some(CannotReadFile(path, _))
1✔
63
    )
64

65
  /** @see `com.typesafe.config.ConfigFactory.parseResources()` */
66
  def parseResources(resource: String, classLoader: ClassLoader = null): ConfigReader.Result[Config] =
1✔
67
    unsafeToReaderResult(
2✔
68
      ConfigFactory.parseResources(resource, strictSettings.setClassLoader(classLoader)),
2✔
69
      onIOFailure = Some(CannotReadResource(resource, _))
1✔
70
    )
71

72
  /** @see `com.typesafe.config.ConfigFactory.parseURL()` */
73
  def parseURL(url: URL): ConfigReader.Result[Config] =
1✔
74
    unsafeToReaderResult(ConfigFactory.parseURL(url, strictSettings), onIOFailure = Some(CannotReadUrl(url, _)))
2✔
75

76
  /** Utility methods that parse a file and then calls `ConfigFactory.load` */
77
  def loadFile(path: Path): ConfigReader.Result[Config] =
1✔
78
    parseFile(path.toFile).flatMap(rawConfig => unsafeToReaderResult(ConfigFactory.load(rawConfig)))
2✔
79
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc