Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop XmlData specific selection during string parsing #136

Merged
merged 2 commits into from
Sep 23, 2023

Conversation

geirolz
Copy link
Owner

@geirolz geirolz commented Sep 22, 2023

This PR fix BUG #124

Still wondering the implication of this changes

@geirolz geirolz self-assigned this Sep 22, 2023
Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scalastyle (reported by Codacy) found more than 10 potential problems in the proposed changes. Check the Files changed tab for more details.

import cats.xml.XmlData.*
import cats.xml.codec.Decoder
import cats.xml.utils.{impure, Debug, UnsafeValidator}

Check warning

Code scanning / Codacy-scalameta-pro (reported by Codacy)

This makes it easy to examine visually, and is simple to automate. Warning

Imports should be sorted alphabetically
testDataEquality[Seq[String]]
testDataEquality[Array[String]]

private def testDataEquality[T: Arbitrary](implicit

Check notice

Code scanning / Codacy-scalameta-pro (reported by Codacy)

Values should have minimum scope to avoid misuses. Note test

testDataEquality should have a smaller scope by using private[this]
@@ -74,3 +69,15 @@
)
}
}
sealed trait NodeContentInstances {

import cats.implicits.catsSyntaxEq

Check warning

Code scanning / Codacy-scalameta-pro (reported by Codacy)

Putting all imports at the beginning of the package can increase readability. Warning

Put imports in the beginning of the package
@@ -191,7 +191,7 @@
val decoderStr2: Decoder[String] = Decoder.decodeString

assertEquals(
obtained = decoderStr1.or(decoderStr2).decode(Xml.ofString("test")),
obtained = decoderStr1.or(decoderStr2).decode(Xml.string("test")),

Check warning

Code scanning / Codacy-scalameta-pro (reported by Codacy)

Prohibits usage of duplicated string literals. Warning test

The string literal 'test' appears 4 times in the file.
@@ -584,7 +584,7 @@
Decoder.decodeBoolean,
Decoder.decodeString
)
.decode(Xml.ofString("foo"))
.decode(Xml.string("foo"))

Check warning

Code scanning / Codacy-scalameta-pro (reported by Codacy)

Prohibits usage of duplicated string literals. Warning test

The string literal 'foo' appears 2 times in the file.
@@ -681,6 +675,8 @@
}
sealed trait XmlNodeInstances {

import cats.implicits.catsSyntaxEq

Check warning

Code scanning / Codacy-scalameta-pro (reported by Codacy)

Putting all imports at the beginning of the package can increase readability. Warning

Put imports in the beginning of the package
@@ -21,7 +21,7 @@

test("XmlPrinter.default.prettyString convert XmlData to string") {

val tree: Xml = Xml.ofString("VALUE")
val tree: Xml = Xml.string("VALUE")

Check warning

Code scanning / Codacy-scalameta-pro (reported by Codacy)

Prohibits usage of duplicated string literals. Warning test

The string literal 'VALUE' appears 3 times in the file.
@@ -86,12 +82,14 @@
}
private[xml] sealed trait XmlAttributeInstances {

import cats.implicits.catsSyntaxEq

Check warning

Code scanning / Codacy-scalameta-pro (reported by Codacy)

Putting all imports at the beginning of the package can increase readability. Warning

Put imports in the beginning of the package
case value: Double => double(value)
case value: BigInt => bigInt(value)
case value: BigDecimal => bigDecimal(value)
case value => string(value.toString)

Check notice

Code scanning / Codacy-scalameta-pro (reported by Codacy)

Prohibit case statement pattern match from being lowercase. Note

Lower case pattern matching.
@codecov
Copy link

codecov bot commented Sep 22, 2023

Codecov Report

Patch coverage: 84.61% and project coverage change: +4.03% 🎉

Comparison is base (064b74d) 61.07% compared to head (cf3cd6a) 65.11%.
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #136      +/-   ##
==========================================
+ Coverage   61.07%   65.11%   +4.03%     
==========================================
  Files          47       59      +12     
  Lines        1896     2680     +784     
  Branches       27      143     +116     
==========================================
+ Hits         1158     1745     +587     
- Misses        738      935     +197     
Files Changed Coverage Δ
core/src/main/scala/cats/xml/xmlParser.scala 72.22% <ø> (+0.79%) ⬆️
...src/main/scala/cats/xml/std/nodeSeqConverter.scala 71.42% <50.00%> (+5.32%) ⬆️
core/src/main/scala/cats/xml/xmlNode.scala 67.80% <57.14%> (+0.41%) ⬆️
core/src/main/scala/cats/xml/xmlAttribute.scala 52.45% <66.66%> (-1.03%) ⬇️
core/src/main/scala/cats/xml/XmlPrinter.scala 81.75% <68.18%> (+13.48%) ⬆️
core/src/main/scala/cats/xml/Xml.scala 76.71% <85.29%> (+8.21%) ⬆️
core/src/main/scala/cats/xml/NodeContent.scala 85.00% <85.71%> (-0.72%) ⬇️
core/src/main/scala/cats/xml/codec/Decoder.scala 75.36% <92.30%> (+12.00%) ⬆️
core/src/main/scala/cats/xml/codec/Encoder.scala 77.77% <100.00%> (+7.50%) ⬆️
core/src/main/scala/cats/xml/xmlData.scala 30.00% <100.00%> (-21.14%) ⬇️
... and 1 more

... and 44 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@geirolz geirolz merged commit 30321c5 into main Sep 23, 2023
19 of 20 checks passed
@geirolz geirolz deleted the Drop-data-parsing branch September 23, 2023 14:11
@geirolz geirolz added this to the v0.0.12 milestone Sep 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant