Skip to content

Conversation

@felixcheung
Copy link
Member

Clean out hundreds of style: Commented code should be removed. from lintr

Like these:

/opt/spark-1.6.0-bin-hadoop2.6/R/pkg/R/DataFrame.R:513:3: style: Commented code should be removed.
# sc <- sparkR.init()
  ^~~~~~~~~~~~~~~~~~~
/opt/spark-1.6.0-bin-hadoop2.6/R/pkg/R/DataFrame.R:514:3: style: Commented code should be removed.
# sqlContext <- sparkRSQL.init(sc)
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/spark-1.6.0-bin-hadoop2.6/R/pkg/R/DataFrame.R:515:3: style: Commented code should be removed.
# path <- "path/to/file.json"
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~

tried without @export or @Rdname, neither work
instead, added this #' @noRd to suppress .Rd file generation

also updated @family for DataFrame functions for longer descriptive text instead of dataframe_funcs
image

this covers most of 'Commented code' but I left out a few that looks legitimate.

@SparkQA
Copy link

SparkQA commented Nov 4, 2015

Test build #45012 has finished for PR 9463 at commit 4b136b3.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@yu-iskw
Copy link
Contributor

yu-iskw commented Nov 4, 2015

LGTM
@noRd is a good idea. We still have other commented code warnings which aren't realted to docs, right?

@yu-iskw
Copy link
Contributor

yu-iskw commented Nov 4, 2015

In my research, lintr have a bug of commented_code_linter.
I just reported the bug to the lintr community.
r-lib/lintr#118

R/RDD.R:754:20: style: Commented code should be removed.
#' take(rdd, 2L) # list(1, 2)
                   ^~~~~~~~~~

@felixcheung
Copy link
Member Author

@yu-iskw yes, there are roughly a dozen "commented code" warnings left but they are mostly false positives, like the example you quoted.
At this point I'd rather not change them for the sake of being clean. Besides, we still have some ways to go to be completely lintr clean (with the chosen settings)

@shivaram
Copy link
Contributor

shivaram commented Nov 5, 2015

@felixcheung Thanks for taking a shot at this. Can we remove the @export from these functions as well ? They are not exported in the public API so it seems thats not needed ?

@felixcheung
Copy link
Member Author

Done. they won't do anything because of @noRd

@felixcheung
Copy link
Member Author

@yu-iskw btw, these are two other false positives that you might want to follow up with lintr:

R/pkg/inst/tests/test_sparkSQL.R:907:53: style: Commented code should be removed.
  expect_equal(collect(select(df2, lpad(df2$a, 8, "#")))[1, 1], "###aaads")
                                                    ^~~~~~~~~~~~~~~~~~~~~~~

R/pkg/R/RDD.R:228:63: style: Commented code should be removed.
#' http://spark.apache.org/docs/latest/programming-guide.html#rdd-persistence.
                                                              ^~~~~~~~~~~~~~~~

@SparkQA
Copy link

SparkQA commented Nov 5, 2015

Test build #45092 has finished for PR 9463 at commit 037f0df.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@felixcheung
Copy link
Member Author

@shivaram ?

1 similar comment
@felixcheung
Copy link
Member Author

@shivaram ?

@shivaram
Copy link
Contributor

Sorry this slipped through. Will look at this tonight

@felixcheung
Copy link
Member Author

Could we push this, at least to master? that would really help dev running lintr for a much more manageable volume of warnings/errors

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you remove the @family from here ? Even though we have a noRd here it ends up generating the toRDD method as a link in the other DataFrame functions section

Copy link
Contributor

Choose a reason for hiding this comment

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

We might also need to remove the @rdname DataFrame here as it shows up in the DataFrame documentation page.

@shivaram
Copy link
Contributor

Sorry for the delay. I found one minor problem with toRDD -- otherwise LGTM.

@felixcheung
Copy link
Member Author

thanks for catching that, I did some test I suspect they are caused by generics.R, so removing those.

@SparkQA
Copy link

SparkQA commented Nov 13, 2015

Test build #45801 has finished for PR 9463 at commit f98bea2.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Nov 13, 2015

Test build #45803 has finished for PR 9463 at commit c8c0f2e.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@shivaram
Copy link
Contributor

Thanks @felixcheung - Looks good now. Merging this.

asfgit pushed a commit that referenced this pull request Nov 13, 2015
…mentation

Clean out hundreds of `style: Commented code should be removed.` from lintr

Like these:
```
/opt/spark-1.6.0-bin-hadoop2.6/R/pkg/R/DataFrame.R:513:3: style: Commented code should be removed.
# sc <- sparkR.init()
  ^~~~~~~~~~~~~~~~~~~
/opt/spark-1.6.0-bin-hadoop2.6/R/pkg/R/DataFrame.R:514:3: style: Commented code should be removed.
# sqlContext <- sparkRSQL.init(sc)
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/spark-1.6.0-bin-hadoop2.6/R/pkg/R/DataFrame.R:515:3: style: Commented code should be removed.
# path <- "path/to/file.json"
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~
```

tried without export or rdname, neither work
instead, added this `#' noRd` to suppress .Rd file generation

also updated `family` for DataFrame functions for longer descriptive text instead of `dataframe_funcs`
![image](https://cloud.githubusercontent.com/assets/8969467/10933937/17bf5b1e-8291-11e5-9777-40fc632105dc.png)

this covers *most* of 'Commented code' but I left out a few that looks legitimate.

Author: felixcheung <[email protected]>

Closes #9463 from felixcheung/rlintr.

(cherry picked from commit ed04846)
Signed-off-by: Shivaram Venkataraman <[email protected]>
@asfgit asfgit closed this in ed04846 Nov 13, 2015
dskrvk pushed a commit to dskrvk/spark that referenced this pull request Nov 13, 2015
…mentation

Clean out hundreds of `style: Commented code should be removed.` from lintr

Like these:
```
/opt/spark-1.6.0-bin-hadoop2.6/R/pkg/R/DataFrame.R:513:3: style: Commented code should be removed.
# sc <- sparkR.init()
  ^~~~~~~~~~~~~~~~~~~
/opt/spark-1.6.0-bin-hadoop2.6/R/pkg/R/DataFrame.R:514:3: style: Commented code should be removed.
# sqlContext <- sparkRSQL.init(sc)
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/spark-1.6.0-bin-hadoop2.6/R/pkg/R/DataFrame.R:515:3: style: Commented code should be removed.
# path <- "path/to/file.json"
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~
```

tried without export or rdname, neither work
instead, added this `#' noRd` to suppress .Rd file generation

also updated `family` for DataFrame functions for longer descriptive text instead of `dataframe_funcs`
![image](https://cloud.githubusercontent.com/assets/8969467/10933937/17bf5b1e-8291-11e5-9777-40fc632105dc.png)

this covers *most* of 'Commented code' but I left out a few that looks legitimate.

Author: felixcheung <[email protected]>

Closes apache#9463 from felixcheung/rlintr.
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.

4 participants