Skip to content

Insert kdocs #1406

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Insert kdocs #1406

wants to merge 5 commits into from

Conversation

AndreiKingsley
Copy link
Collaborator

closes #1386

* ### Examples:
* ```kotlin
* // Insert a new column "age" under the column group with path ("info", "personal").
* df.insert(age).under(pathOf("info", "personal"))
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd love the examples, the main problem as usual - the update of these examples, but if we are close to the 1.0 - let's practice with it

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

One day we can move it to tests and add to KDocs using kodex ;)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Actually yes! That's already possible. You can use @sample [link.to.sample]; KoDEx even recognizes // SampleStart etc, so we can reuse Korro samples even :)

Copy link
Collaborator

Choose a reason for hiding this comment

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

I just never used this before because I preferred the examples be clickable, but maybe this kdoc/dokka team is working on that!

* }.under("math")
* ```
*
* @param name The name of the new column to be created and inserted.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Honestly, for the gods of readability I'd prefer @param [name] The name with brackets - it helps me to read KDocs in the code

Copy link
Collaborator

@Jolanrensen Jolanrensen left a comment

Choose a reason for hiding this comment

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

good job :)

@@ -83,7 +83,7 @@ internal class InsertAfter0 : AbstractInterpreter<PluginDataFrameSchema>() {

override fun Arguments.interpret(): PluginDataFrameSchema {
return receiver.df.asDataFrame()
.insert(receiver.column.asDataColumn()).after(column.col.path)
.insert(receiver.column.asDataColumn()).after { column.col.path }
Copy link
Collaborator

Choose a reason for hiding this comment

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

this does nothing, the compiler plugin lives in kotlin now ;P

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I just like the whole project be able to build. May be we should disable build of plugin module then?

@@ -137,6 +137,11 @@ internal const val COL_TYPE_INSTANT =
"kotlinx.datetime.Instant is deprecated in favor of kotlin.time.Instant. Either migrate to kotlin.time.Instant and use ColType.StdlibInstant or use ColType.DeprecatedInstant. $MESSAGE_1_0 and migrated to kotlin.time.Instant in 1.1."
internal const val COL_TYPE_INSTANT_REPLACE = "ColType.DeprecatedInstant"

internal const val INSERT_AFTER_COL_PATH =
"This `after()` overload will be removed in favor of `after { }` with Column Selection" +
Copy link
Collaborator

Choose a reason for hiding this comment

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

unnecessary line break

* ### Examples:
* ```kotlin
* // Insert a new column "age" under the column group with path ("info", "personal").
* df.insert(age).under(pathOf("info", "personal"))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Actually yes! That's already possible. You can use @sample [link.to.sample]; KoDEx even recognizes // SampleStart etc, so we can reuse Korro samples even :)

* // for subsequent rows, it's the sum of the two previous Fibonacci values.
* val dfWithFibonacci = df.insert("fibonacci") {
* if (index() < 2) 1
* else prev()!!.newValue<Int>() + prev()!!.prev()!!.newValue<Int>()
Copy link
Collaborator

Choose a reason for hiding this comment

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

eyy! Now possible because of the switch to AddExpression, nice ;)

*/
interface InsertSelectingOptions

/**
Copy link
Collaborator

Choose a reason for hiding this comment

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

Don't forget everything explicitly written in Kotlin code needs to be bold. You forgot one insert and all braces and commas should also be bold

* **[`insert`][insert]**`(column: `[`DataColumn`][DataColumn]`)`
*
* {@include [Indent]}
* `| `[`insert`][insert]`(name: `[`String`][String]`, infer: `[`Infer`][Infer]`, rowExpression: `[`RowExpression`][RowExpression]` }`
Copy link
Collaborator

Choose a reason for hiding this comment

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

hmm this 'or' looks a bit weird. I think it would look better on the same line as the previous insert, but then the line might be a bit too long. Or it could have grouping braces ()

*
* Works only with existing column groups.
* To insert into a new column group, use the overloads:
* `under(path: ColumnPath)` or `under(column: String)`.
Copy link
Collaborator

Choose a reason for hiding this comment

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

could you create and link to an issue if we're gonna fix this?

* ### Examples:
* ```kotlin
* // Insert a new column "age" under the column group with path ("info", "personal").
* df.insert(age).under(pathOf("info", "personal"))
Copy link
Collaborator

Choose a reason for hiding this comment

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

I just never used this before because I preferred the examples be clickable, but maybe this kdoc/dokka team is working on that!

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.

Add KDoc for Insert
3 participants