-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
r100-epidaurus #3599
r100-epidaurus #3599
Conversation
9f85150
to
0676b3b
Compare
02eeb71
to
95c9e16
Compare
@chuwy is out today |
95c9e16
to
b2974d8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @knservis,
So, all good for me. Though I have couple questions about scalafmt
-commits.
- Was it applied to to your PII Enrichment commit? It doesn't look so. If no then how does it work?
- As already mentioned I don't like bringing all these formatting tools straight inside code-base: otherwise we'll end up with ten different tools for linting and formatting, each one is doing some overly automatic job. I'd like to keep those out of working tree and use it rather as "conflict resolver" rather than "chief editor". I'm not going to block on it, but please consider leaving only Scala Common Enrich: apply automated code formatting #3532
name := "snowplow-common-enrich", | ||
version := "0.31.0-M1", | ||
description := "Common functionality for enriching raw Snowplow events", | ||
scalafmtConfig := file(".scalafmt.conf"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move this to separate set of settings, like BuildSettings.formatting
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -1 +1,5 @@ | |||
addSbtPlugin("me.lessis" % "bintray-sbt" % "0.3.0") | |||
|
|||
addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.0.0-RC13") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is coursier a part of scalafmt commit? Is it required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is some sort of bug in the plugin when using it with ivy. I could only get it to work with coursier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we use 1.0.1? It's been released since this commit.
EnrichmentRegistry, | ||
EnrichmentManager | ||
} | ||
import adapters.{AdapterRegistry, RawEvent} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still very hazy on these kind of indentations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. In this instance the alignment is a bit weird. There are three options:
- Change settings in scalafmt for all files
- Switch off formatting locally there
- In this particular case, move the
import outputs.EnrichedEvent
between the two multi imports so that scalafmt won't try to align them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What implications has first option?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will affect formatting in all files. If you want to experiment with it, just modify .scalafmt.conf
on the root of SCE and run sbt clean compile
. Then you can see the changes with git diff
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we fix this in the end?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is happening with this? I thought R100 was code complete...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was fixed afaict
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, sorry i did not respond to that comment. I thought that this is all resolved (#3599 (comment)). Yes that was addressed along with all other formatting
trait Enrichment { | ||
val version: DefaultArtifactVersion | ||
} | ||
trait Enrichment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, as we deleted its single member, is there any other justification for its existence left?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is useful as a "marker trait" enabling things like the EnrichmentMap here:
Line 65 in 362ebb5
type EnrichmentMap = Map[String, Enrichment] |
but I may be wrong
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it seems to enable some kind of reflection-based machinery, but I don't see why it cannot be implemented in less boilerplate and reflection-less way: https://github.com/snowplow/snowplow/blob/master/3-enrich/scala-common-enrich/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/enrichments/EnrichmentRegistry.scala#L330. Do you think it is worth to create an issue to explore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any opportunity to remove reflection is worth looking into. I created #3610
b2974d8
to
f9b9851
Compare
|
f9b9851
to
7bd87dd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 👍 , however I'm wondering if we couldn't make things more consistent regarding alignment.
Sometimes the formatted version feels weirder than the original.
@@ -1 +1,5 @@ | |||
addSbtPlugin("me.lessis" % "bintray-sbt" % "0.3.0") | |||
|
|||
addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.0.0-RC13") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we use 1.0.1? It's been released since this commit.
EnrichmentRegistry, | ||
EnrichmentManager | ||
} | ||
import adapters.{AdapterRegistry, RawEvent} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we fix this in the end?
@@ -0,0 +1,14 @@ | |||
style = default | |||
align = some | |||
maxColumn = 140 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we reduce this so that it at least fits github number of columns (I believe it's 120) or even lower? that will ease reviews
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BenFradet I am not sure what the GH recommended max width is. 120 sounds good to me, although it will cause some reformatting (e.g. 3-enrich/scala-common-enrich/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/adapters/registry/UrbanAirshipAdapter.scala L53)
@@ -494,7 +512,7 @@ object GoogleAnalyticsAdapter extends Adapter { | |||
* @return a translated params | |||
*/ | |||
private def translatePayload( | |||
originalParams: Map[String, String], | |||
originalParams: Map[String, String], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we exclude this type of alignment? doesn't make a lot of sense to me, if we can't that's fine...
case (None, _) => s"Request body is empty: no ${VendorName} event to process".failNel | ||
case (_, None) => s"Request body provided but content type empty, expected ${ContentType} for ${VendorName}".failNel | ||
case (_, Some(ct)) if ct != ContentType => s"Content type of ${ct} provided, expected ${ContentType} for ${VendorName}".failNel | ||
case (Some(body), _) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand why sometime =>
are aligned and sometimes members of the patmat are aligned, can we prioritize one over the others?
fomatting looks nice 👍 |
ff0e03f
to
5224015
Compare
5224015
to
5d16f1f
Compare
@BenFradet Fixed both |
65e7e25
to
15138ab
Compare
override def scramble(clearText: String): String = hash(clearText) | ||
def hash(text: String): String = { | ||
val bytes = hashFunction.digest(text.getBytes(TextEncoding)) | ||
String.format("%0" + bytes.size*2 + "x", new java.math.BigInteger(1, bytes)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chuwy What do you think about this formatting string? The objective is to keep the output at constant length. The byte array should have always the same length for the same algorithm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it looks good to me. Though I don't think I'm aware of all implications it has.
15138ab
to
c36fb68
Compare
@knservis can you add an example pii enrichment in https://github.com/snowplow/snowplow/tree/master/3-enrich/config/enrichments as part of #3472 ? |
and also reorder the commits so that Prepare for release is last both in order and chronologically. |
daaa656
to
354e8a3
Compare
it's because gh orders commits according to their timestamps |
e16671a
to
082ee77
Compare
082ee77
to
54dbe08
Compare
Also how do we deal with:
|
@BenFradet According to @alexanderdean this is not a showstopper and a very unlikely case. I could fix it on jayway probably. |
Let's create a bug issue to track this edge case |
created #3636 |
39e352b
to
4af8550
Compare
fe750c1
to
9c8b5c3
Compare
Exciting! |
TODO:
Known issues: