GitHub user HyukjinKwon opened a pull request:

    https://github.com/apache/spark/pull/17590

    [SPARK-20278][R] Disable 'multiple_dots_linter' lint rule that is against 
project's code style

    ## What changes were proposed in this pull request?
    
    Currently, multi-dot separated variables in R is not allowed. For example,
    
    ```diff
     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",
    ```
    
    produces an error as below:
    
    ```
    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, ...) {
                                  ^~~~~~~~~~~~~
    ```
    
    This seems against 
https://google.github.io/styleguide/Rguide.xml#identifiers which says
    
    > The preferred form for variable names is all lower case letters and words 
separated with dots
    
    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 as "a few tweaks".
    
    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, it looks we have no limit on function name. This rule also looks 
affecting to the name of functions as written in the README.md.
    
    > `multiple_dots_linter`: check that function and variable names are 
separated by _ rather than ..
    
    
    ## How was this patch tested?
    
    Manually tested as below:
    
    ```R
     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",
    ```
    
    **Before**
    
    ```R
    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, ...) {
                                  ^~~~~~~~~~~~~
    ```
    
    **After**
    
    ```
    lintr checks passed.
    ```

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/HyukjinKwon/spark disable-dot-in-name

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/17590.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #17590
    
----
commit ed0dd869a24bc10cfce7dacc8b4b6d57c3ced6de
Author: hyukjinkwon <gurwls...@gmail.com>
Date:   2017-04-10T09:35:59Z

    Disable 'multiple_dots_linter' lint rule that is against project's code 
style

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to