[
https://issues.apache.org/jira/browse/SPARK-20278?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Hyukjin Kwon updated SPARK-20278:
-
Description:
Currently, multi-dot separated variables in R is not allowed. For example,
{code}
setMethod("from_json", signature(x = "Column", schema = "structType"),
- function(x, schema, asJsonArray = FALSE, ...) {
+ function(x, schema, as.json.array = FALSE, ...) {
if (asJsonArray) {
jschema <- callJStatic("org.apache.spark.sql.types.DataTypes",
"createArrayType",
{code}
produces an error as below:
{code}
R/functions.R:2462:31: style: Words within variable and function names should
be separated by '_' rather than '.'.
function(x, schema, as.json.array = FALSE, ...) {
^
{code}
This seems against https://google.github.io/styleguide/Rguide.xml#identifiers
which says
{quote}
The preferred form for variable names is all lower case letters and words
separated with dots
{quote}
This looks because lintr https://github.com/jimhester/lintr follows
http://r-pkgs.had.co.nz/style.html as written in the README.md. Few cases seems
not following Google's one.
Per SPARK-6813, we follow Google's R Style Guide with few exceptions
https://google.github.io/styleguide/Rguide.xml. This is also merged into
Spark's website - https://github.com/apache/spark-website/pull/43
Also, we have no limit on function name. This rule also looks affecting to the
name of functions as written in the README.md.
{quote}
multiple_dots_linter: check that function and variable names are separated by _
rather than ..
{quote}
was:
Currently, multi-dot separated variables in R is not allowed. For example,
{code}
setMethod("from_json", signature(x = "Column", schema = "structType"),
- function(x, schema, asJsonArray = FALSE, ...) {
+ function(x, schema, as.json.array = FALSE, ...) {
if (asJsonArray) {
jschema <- callJStatic("org.apache.spark.sql.types.DataTypes",
"createArrayType",
{code}
produces an error as below:
{code}
R/functions.R:2462:31: style: Words within variable and function names should
be separated by '_' rather than '.'.
function(x, schema, as.json.array = FALSE, ...) {
^
{code}
This seems against https://google.github.io/styleguide/Rguide.xml#identifiers
which says
{quote}
The preferred form for variable names is all lower case letters and words
separated with dots
{quote}
This looks because lintr https://github.com/jimhester/lintr follows
http://r-pkgs.had.co.nz/style.html as written in the README.md. This guide line
seems against the rule.
Per SPARK-6813, we follow Google's R Style Guide with few exceptions
https://google.github.io/styleguide/Rguide.xml. This is also merged into
Spark's website - https://github.com/apache/spark-website/pull/43
Also, we have no limit on function name. This rule also looks affecting to the
name of functions as written in the README.md.
{quote}
multiple_dots_linter: check that function and variable names are separated by _
rather than ..
{quote}
> Disable 'multiple_dots_linter; lint rule that is against project's code style
> -
>
> Key: SPARK-20278
> URL: https://issues.apache.org/jira/browse/SPARK-20278
> Project: Spark
> Issue Type: Bug
> Components: SparkR
>Affects Versions: 2.2.0
>Reporter: Hyukjin Kwon
>Priority: Minor
>
> Currently, multi-dot separated variables in R is not allowed. For example,
> {code}
> setMethod("from_json", signature(x = "Column", schema = "structType"),
> - function(x, schema, asJsonArray = FALSE, ...) {
> + function(x, schema, as.json.array = FALSE, ...) {
> if (asJsonArray) {
>jschema <- callJStatic("org.apache.spark.sql.types.DataTypes",
> "createArrayType",
> {code}
> produces an error as below:
> {code}
> R/functions.R:2462:31: style: Words within variable and function names should
> be separated by '_' rather than '.'.
> function(x, schema, as.json.array = FALSE, ...) {
> ^
> {code}
> This seems against https://google.github.io/styleguide/Rguide.xml#identifiers
> which says
> {quote}
> The preferred form for variable names is all lower case letters and words
> separated with dots
> {quote}
> This looks because lintr https://github.com/jimhester/lintr follows
> http://r-pkgs.had.co.nz/style.html as written in the README.md. Few cases
> seems not following Google's one.
> Per SPARK-6813, we follow Google's R Style Guide with few exceptions
>