• 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

96.0
/core/src/main/scala/pureconfig/error/ConfigReaderFailures.scala
1
/* This Source Code Form is subject to the terms of the Mozilla Public
2
 * License, v. 2.0. If a copy of the MPL was not distributed with this
3
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
package pureconfig.error
5

6
import scala.collection.mutable
7

8
/** A non-empty list of ConfigReader failures
9
  */
10
case class ConfigReaderFailures(head: ConfigReaderFailure, tail: ConfigReaderFailure*) {
11

12
  def toList: List[ConfigReaderFailure] = head :: tail.toList
9✔
13

UNCOV
14
  def +:(failure: ConfigReaderFailure): ConfigReaderFailures =
15
    ConfigReaderFailures(failure, this.toList: _*)
×
16

17
  def ++(that: ConfigReaderFailures): ConfigReaderFailures =
1✔
18
    ConfigReaderFailures(head, (tail ++ that.toList): _*)
7✔
19

20
  def prettyPrint(indentLevel: Int = 0): String = {
1✔
21
    def tabs(n: Int): String = " " * ((indentLevel + n) * 2)
3✔
22
    def descriptionWithOrigin(failure: ConfigReaderFailure, indent: Int): String = {
1✔
23
      val failureLines = failure.description.split("\n")
3✔
24
      (failure.origin.fold(s"${tabs(indent)}- ${failureLines.head}")(f =>
1✔
25
        s"${tabs(indent)}- (${f.description}) ${failureLines.head}"
1✔
26
      ) ::
27
        failureLines.tail.map(l => s"${tabs(indent + 1)}$l").toList).mkString("\n")
3✔
28
    }
29

30
    val linesBuffer = mutable.Buffer.empty[String]
3✔
31
    val (convertFailures, otherFailures) = this.toList.partition(_.isInstanceOf[ConvertFailure])
3✔
32

33
    val failuresByPath = convertFailures.asInstanceOf[List[ConvertFailure]].groupBy(_.path).toList.sortBy(_._1)
3✔
34

35
    otherFailures.foreach { failure =>
3✔
36
      linesBuffer += descriptionWithOrigin(failure, 0)
2✔
37
    }
38

39
    if (otherFailures.nonEmpty && convertFailures.nonEmpty) {
3✔
40
      linesBuffer += ""
2✔
41
    }
1✔
42

43
    failuresByPath.foreach { case (p, failures) =>
3✔
44
      linesBuffer += (tabs(0) + (if (p.isEmpty) s"at the root:" else s"at '$p':"))
3✔
45
      failures.foreach { failure =>
3✔
46
        linesBuffer += descriptionWithOrigin(failure, 1)
3✔
47
      }
48
    }
49
    linesBuffer.mkString(System.lineSeparator())
3✔
50
  }
51

52
  override def toString = toList.map(_.toString).mkString("ConfigReaderFailures(", ",", ")")
3✔
53
}
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