Skip to content

Commit 6a0fa1e

Browse files
committed
Update scalafmt
1 parent 05ccc50 commit 6a0fa1e

36 files changed

+680
-369
lines changed

.scalafmt.conf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
version = 2.7.5
1+
version = 3.8.2
2+
runner.dialect = scala213

src/main/scala/io/github/dataunitylab/jsonoid/discovery/Anomaly.scala

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,28 @@ object AnomalyLevel {
1515
}
1616

1717
/** This is an anomaly for a value which is structurally valid, but falls
18-
* outside of the expected range.
18+
* outside of the expected range.
1919
*/
2020
case object Warning extends AnomalyLevel {
2121
override val order: Int = 1
2222
}
2323

24-
/** This is an anomaly which would cause the value to fail structural validation. */
24+
/** This is an anomaly which would cause the value to fail structural
25+
* validation.
26+
*/
2527
case object Fatal extends AnomalyLevel {
2628
override val order: Int = 2
2729
}
2830
}
2931

3032
/** Anomalies are potential violations of a schema according to a given value.
3133
*
32-
* @param path the path where this anomaly occurred
33-
* @param message a message describing this anomaly
34-
* @param anomalyLevel the level of this anomaly
34+
* @param path
35+
* the path where this anomaly occurred
36+
* @param message
37+
* a message describing this anomaly
38+
* @param anomalyLevel
39+
* the level of this anomaly
3540
*/
3641
final case class Anomaly(
3742
path: String,

src/main/scala/io/github/dataunitylab/jsonoid/discovery/DiscoverSchema.scala

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,15 @@ object DiscoverSchema {
4848
/** Perform split schema discovery by randomly splitting the input and
4949
* generating two different schemas.
5050
*
51-
* @param jsons an iterator of JSON objects to perform schema discovery on
52-
* @param propSet the property set to use for schema discovery
53-
* @param splitPercentage the percentage of the input to use for training
51+
* @param jsons
52+
* an iterator of JSON objects to perform schema discovery on
53+
* @param propSet
54+
* the property set to use for schema discovery
55+
* @param splitPercentage
56+
* the percentage of the input to use for training
5457
*
55-
* @return a tuple of the discovered schemas
58+
* @return
59+
* a tuple of the discovered schemas
5660
*/
5761
def splitDiscover(
5862
jsons: Iterator[JValue],
@@ -77,9 +81,12 @@ object DiscoverSchema {
7781

7882
/** Perform schema discovery on a set of JSON objects.
7983
*
80-
* @param jsons an iterator of JSON objects to perform schema discovery on
81-
* @param propSet the property set to use for schema discovery
82-
* @return the discovered schema
84+
* @param jsons
85+
* an iterator of JSON objects to perform schema discovery on
86+
* @param propSet
87+
* the property set to use for schema discovery
88+
* @return
89+
* the discovered schema
8390
*/
8491
def discover(
8592
jsons: Iterator[JValue]
@@ -94,8 +101,10 @@ object DiscoverSchema {
94101

95102
/** Discover a schema from a single JSON object.
96103
*
97-
* @param value the JSON object to discover the schema for
98-
* @param propSet the property set to use for schema discovery
104+
* @param value
105+
* the JSON object to discover the schema for
106+
* @param propSet
107+
* the property set to use for schema discovery
99108
*/
100109
@SuppressWarnings(Array("org.wartremover.warts.Recursion"))
101110
def discoverFromValue(
@@ -126,8 +135,10 @@ object DiscoverSchema {
126135

127136
/** Discover a schema from a set of fields in a JSON object.
128137
*
129-
* @param fields the fields to discover the schema for
130-
* @param propSet the property set to use for schema discovery
138+
* @param fields
139+
* the fields to discover the schema for
140+
* @param propSet
141+
* the property set to use for schema discovery
131142
*/
132143
private def discoverObjectFields(
133144
fields: Seq[JField]

src/main/scala/io/github/dataunitylab/jsonoid/discovery/EquivalenceRelation.scala

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import schemas._
77
*/
88
object EquivalenceRelations {
99

10-
/** An equivalence relation which considers objects equal if they have the same
11-
* set of keys.
10+
/** An equivalence relation which considers objects equal if they have the
11+
* same set of keys.
1212
*/
1313
implicit object LabelEquivalenceRelation extends EquivalenceRelation {
1414
def fuse(kind1: JsonSchema[_], kind2: JsonSchema[_]): Boolean = {
@@ -42,8 +42,8 @@ object EquivalenceRelations {
4242
}
4343
}
4444

45-
/** An equivalence relation which considers objects equal if all keys which are
46-
* in common between the objects have the same type.
45+
/** An equivalence relation which considers objects equal if all keys which
46+
* are in common between the objects have the same type.
4747
*/
4848
implicit object TypeMatchEquivalenceRelation extends EquivalenceRelation {
4949
def fuse(kind1: JsonSchema[_], kind2: JsonSchema[_]): Boolean = {
@@ -62,8 +62,8 @@ object EquivalenceRelations {
6262
}
6363
}
6464

65-
/** An equivalence relation which considers schemas equal if they have the same
66-
* type.
65+
/** An equivalence relation which considers schemas equal if they have the
66+
* same type.
6767
*/
6868
implicit object KindEquivalenceRelation extends EquivalenceRelation {
6969
def fuse(kind1: JsonSchema[_], kind2: JsonSchema[_]): Boolean = {
@@ -97,8 +97,10 @@ abstract class EquivalenceRelation extends Serializable {
9797

9898
/** Returns true if the two schemas should be considered equivalent.
9999
*
100-
* @param kind1 the first schema to compare
101-
* @param kind2 the second schem to compare
100+
* @param kind1
101+
* the first schema to compare
102+
* @param kind2
103+
* the second schem to compare
102104
*/
103105
def fuse(kind1: JsonSchema[_], kind2: JsonSchema[_]): Boolean
104106
}

src/main/scala/io/github/dataunitylab/jsonoid/discovery/ForeignKeyFinder.scala

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@ import utils.BloomFilter
55

66
/** Represents a discovered foreign key.
77
*
8-
* @constructor Create a new foreign key with two paths.
9-
* @param localPath the path of the referencing property
10-
* @param foreignPath the path of the referenced property
8+
* @constructor
9+
* Create a new foreign key with two paths.
10+
* @param localPath
11+
* the path of the referencing property
12+
* @param foreignPath
13+
* the path of the referenced property
1114
*/
1215
final case class ForeignKey(localPath: String, foreignPath: String)
1316

@@ -17,8 +20,10 @@ object ForeignKeyFinder extends SchemaWalker[BloomFilter[_]] {
1720

1821
/** Collect Bloom filters of all types in the schemas.
1922
*
20-
* @param schemas the schemas to search for filters
21-
* @return a map from paths to Bloom filters
23+
* @param schemas
24+
* the schemas to search for filters
25+
* @return
26+
* a map from paths to Bloom filters
2227
*/
2328
private def collectFiltersByPath(
2429
schema: JsonSchema[_]
@@ -37,7 +42,8 @@ object ForeignKeyFinder extends SchemaWalker[BloomFilter[_]] {
3742

3843
/** Returns a list of possible foreign keys.
3944
*
40-
* @param schema the schema to search for foreign keys
45+
* @param schema
46+
* the schema to search for foreign keys
4147
*/
4248
def findForeignKeys(schema: JsonSchema[_]): List[ForeignKey] = {
4349
val filters = collectFiltersByPath(schema)

src/main/scala/io/github/dataunitylab/jsonoid/discovery/Helpers.scala

Lines changed: 47 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,17 @@ object Helpers {
6060

6161
/** Expands an integer used for a minimum value to meet a given limit.
6262
*
63-
* @param current the current minimum value
64-
* @param limit the limit from the other schema
65-
* @param exclusive whether the current limit is exclusive or not
66-
* @param round the current round of expansion
63+
* @param current
64+
* the current minimum value
65+
* @param limit
66+
* the limit from the other schema
67+
* @param exclusive
68+
* whether the current limit is exclusive or not
69+
* @param round
70+
* the current round of expansion
6771
*
68-
* @return the new minimum value and whether it is exclusive
72+
* @return
73+
* the new minimum value and whether it is exclusive
6974
*/
7075
def expandInt(
7176
current: BigInt,
@@ -156,12 +161,17 @@ object Helpers {
156161

157162
/** Contracts an integer used for a maxium value to meet a given limit.
158163
*
159-
* @param current the current maximum value
160-
* @param limit the limit from the other schema
161-
* @param exclusive whether the current limit is exclusive or not
162-
* @param round the current round of expansion
164+
* @param current
165+
* the current maximum value
166+
* @param limit
167+
* the limit from the other schema
168+
* @param exclusive
169+
* whether the current limit is exclusive or not
170+
* @param round
171+
* the current round of expansion
163172
*
164-
* @return the new maximum value and whether it is exclusive
173+
* @return
174+
* the new maximum value and whether it is exclusive
165175
*/
166176
@SuppressWarnings(Array("org.wartremover.warts.Equals"))
167177
def contractInt(
@@ -237,15 +247,20 @@ object Helpers {
237247
foo(x, 2).sorted
238248
}
239249

240-
/** Determine if one minimum values the values of another,
241-
* considering whether each minimum is exclusive or not.
250+
/** Determine if one minimum values the values of another, considering whether
251+
* each minimum is exclusive or not.
242252
*
243-
* @param value1 the first minimum value
244-
* @param exclusive1 whether the first minimum value is exclusive
245-
* @param value2 the second minimum value
246-
* @param exclusive2 whether the second minimum value is exclusive
253+
* @param value1
254+
* the first minimum value
255+
* @param exclusive1
256+
* whether the first minimum value is exclusive
257+
* @param value2
258+
* the second minimum value
259+
* @param exclusive2
260+
* whether the second minimum value is exclusive
247261
*
248-
* @return true if the second value covers the first, false otherwise
262+
* @return
263+
* true if the second value covers the first, false otherwise
249264
*/
250265
@SuppressWarnings(Array("org.wartremover.warts.OptionPartial"))
251266
def isMinCoveredBy[A: Order](
@@ -269,14 +284,19 @@ object Helpers {
269284
value2.get <= value1.get
270285
}
271286

272-
/** Determine if one maximum value covers the values of another,
273-
* considering whether each maximum is exclusive or not.
287+
/** Determine if one maximum value covers the values of another, considering
288+
* whether each maximum is exclusive or not.
274289
*
275-
* @param value1 the first maximum value
276-
* @param exclusive1 whether the first maximum value is exclusive
277-
* @param value2 the second maximum value
278-
* @param exclusive2 whether the second maximum value is exclusive
279-
* @return true if the second value covers the first, false otherwise
290+
* @param value1
291+
* the first maximum value
292+
* @param exclusive1
293+
* whether the first maximum value is exclusive
294+
* @param value2
295+
* the second maximum value
296+
* @param exclusive2
297+
* whether the second maximum value is exclusive
298+
* @return
299+
* true if the second value covers the first, false otherwise
280300
*/
281301
@SuppressWarnings(Array("org.wartremover.warts.OptionPartial"))
282302
def isMaxCoveredBy[A: Order](
@@ -321,7 +341,7 @@ object Helpers {
321341
}
322342

323343
/** Find the intersection of two optional sets or None if neither set is
324-
* specified.
344+
* specified.
325345
*/
326346
def intersectOrNone[A](
327347
first: Option[Set[A]],
@@ -333,7 +353,8 @@ object Helpers {
333353
case (None, None) => None
334354
}
335355

336-
/** Find the union of two optional sets or None if neither set is specified. */
356+
/** Find the union of two optional sets or None if neither set is specified.
357+
*/
337358
def unionOrNone[A](
338359
first: Option[Set[A]],
339360
second: Option[Set[A]]

src/main/scala/io/github/dataunitylab/jsonoid/discovery/IncompatiblityCollector.scala

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,20 @@ final case class Incompatibility[T](path: String, property: ClassTag[T])
99

1010
object IncompatibilityCollector {
1111

12-
/** Give a more detailed incompatibility by
13-
* manually checking the type of these two schemas.
12+
/** Give a more detailed incompatibility by manually checking the type of
13+
* these two schemas.
1414
*
15-
* @param path the path of the potential incompatibility
16-
* @param s1 the first schema
17-
* @param s2 the second schema
18-
* @param tag the type of incompatibility to report
15+
* @param path
16+
* the path of the potential incompatibility
17+
* @param s1
18+
* the first schema
19+
* @param s2
20+
* the second schema
21+
* @param tag
22+
* the type of incompatibility to report
1923
*
20-
* @return an sequence of a single incompatibility if one exists
24+
* @return
25+
* an sequence of a single incompatibility if one exists
2126
*/
2227
def typeIncompat(
2328
path: String,
@@ -36,11 +41,15 @@ object IncompatibilityCollector {
3641

3742
/** Check for incompatibilities at a given path.
3843
*
39-
* @param base the base schema
40-
* @param other the other schema to check for incompatibilities
41-
* @param path the path of the potential incompatibility
44+
* @param base
45+
* the base schema
46+
* @param other
47+
* the other schema to check for incompatibilities
48+
* @param path
49+
* the path of the potential incompatibility
4250
*
43-
* @return a sequence of incompatibilities at the given path
51+
* @return
52+
* a sequence of incompatibilities at the given path
4453
*/
4554
@SuppressWarnings(
4655
Array(
@@ -186,10 +195,13 @@ object IncompatibilityCollector {
186195

187196
/** Check for incompatibilities across an entire schema..
188197
*
189-
* @param base the base schema
190-
* @param other the other schema to check for incompatibilities
198+
* @param base
199+
* the base schema
200+
* @param other
201+
* the other schema to check for incompatibilities
191202
*
192-
* @return a sequence of incompatibilities at the given path
203+
* @return
204+
* a sequence of incompatibilities at the given path
193205
*/
194206
def findIncompatibilities(
195207
base: JsonSchema[_],

src/main/scala/io/github/dataunitylab/jsonoid/discovery/JsonoidParams.scala

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,19 @@ import schemas.{PropertySet, PropertySets}
44

55
/** Parameters used during the discovery process.
66
*
7-
* @param additionalProperties whether `additionalProperties` is set to true in generated schemas
8-
* @param er the equivalence relation to use during the discovery process
9-
* @param extendedFormats whether to include extended formats
10-
* @param formatThreshold the fraction of values that must match a given format for [[schemas.FormatProperty]] to consider the format valid
11-
* @param maxExamples the maximum number of examples to be kept for any examples property
12-
* @param resetFormatLength whether to reset max/min length of strings with [[schemas.FormatProperty]]
7+
* @param additionalProperties
8+
* whether `additionalProperties` is set to true in generated schemas
9+
* @param er
10+
* the equivalence relation to use during the discovery process
11+
* @param extendedFormats
12+
* whether to include extended formats
13+
* @param formatThreshold
14+
* the fraction of values that must match a given format for
15+
* [[schemas.FormatProperty]] to consider the format valid
16+
* @param maxExamples
17+
* the maximum number of examples to be kept for any examples property
18+
* @param resetFormatLength
19+
* whether to reset max/min length of strings with [[schemas.FormatProperty]]
1320
*/
1421
final case class JsonoidParams(
1522
val additionalProperties: Boolean = false,

0 commit comments

Comments
 (0)