Skip to content
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

fix package --as-cran #602

Merged
merged 22 commits into from
Sep 28, 2022
Merged

fix package --as-cran #602

merged 22 commits into from
Sep 28, 2022

Conversation

donyunardi
Copy link
Contributor

@donyunardi
Copy link
Contributor Author

Some of the examples are over 5 seconds to run.

image

We could make synthetic_cdisc_data only get called once:

synthetic_cdisc_data_latest <- synthetic_cdisc_data("latest")
  ADSL <- synthetic_cdisc_data_latest$adsl
  ADAE <- synthetic_cdisc_data_latest$adae
  ADCM <- synthetic_cdisc_data_latest$adcm

If so, can I keep the code argument as is?

      cdisc_dataset("ADSL", ADSL, code = 'ADSL <- synthetic_cdisc_data("latest")$adsl'),
      cdisc_dataset("ADAE", ADAE, code = 'ADAE <- synthetic_cdisc_data("latest")$adae'),

@nikolas-burkoff @mhallal1
Let me know your thought.

@donyunardi
Copy link
Contributor Author

Hi @arkadiuszbeer
There's a linting error during the check workflow:

Warning: file=/github/workspace/R/tm_g_lineplot.R,line=221,col=2,[commented_code_linter] Commented code should be removed.

Warning: file=/github/workspace/R/tm_t_summary_by.R,line=341,col=2,[commented_code_linter] Commented code should be removed.

Warning: file=/github/workspace/R/utils.R,line=409,col=15,[vector_logic_linter] Conditional expressions require scalar logical operators (&& and ||)
Warning: file=/github/workspace/R/utils.R,line=420,col=22,[vector_logic_linter] Conditional expressions require scalar logical operators (&& and ||)

I'm not sure what to do about the commented code. Both lines look okay to me.
And for scalar logical operator, isn't in R we can do logical operator using & and &&?
Are we enforcing the usage of &&?

@mhallal1
Copy link
Collaborator

Some of the examples are over 5 seconds to run.

image

We could make synthetic_cdisc_data only get called once:

synthetic_cdisc_data_latest <- synthetic_cdisc_data("latest")
  ADSL <- synthetic_cdisc_data_latest$adsl
  ADAE <- synthetic_cdisc_data_latest$adae
  ADCM <- synthetic_cdisc_data_latest$adcm

If so, can I keep the code argument as is?

      cdisc_dataset("ADSL", ADSL, code = 'ADSL <- synthetic_cdisc_data("latest")$adsl'),
      cdisc_dataset("ADAE", ADAE, code = 'ADAE <- synthetic_cdisc_data("latest")$adae'),

@nikolas-burkoff @mhallal1 Let me know your thought.

@donyunardi Yeah i think that you keep the code argument as technically it is the same code but we are pulling it once instead of twice before launching the app.

@arkadiuszbeer
Copy link
Contributor

arkadiuszbeer commented Sep 20, 2022

hi @donyunardi

Hi @arkadiuszbeer There's a linting error during the check workflow:

Warning: file=/github/workspace/R/tm_g_lineplot.R,line=221,col=2,[commented_code_linter] Commented code should be removed.

Warning: file=/github/workspace/R/tm_t_summary_by.R,line=341,col=2,[commented_code_linter] Commented code should be removed.

Examples in files tm_g_lineplot.R,:221 and tm_t_summary_by.R:341 should not have ' (single quotation mark), becuase linter will treat it as end of comment.

Warning: file=/github/workspace/R/utils.R,line=409,col=15,[vector_logic_linter] Conditional expressions require scalar logical operators (&& and ||)
Warning: file=/github/workspace/R/utils.R,line=420,col=22,[vector_logic_linter] Conditional expressions require scalar logical operators (&& and ||)


I'm not sure what to do about the commented code. Both lines look okay to me. And for scalar logical operator, isn't in R we can do logical operator using `&` and `&&`? Are we enforcing the usage of `&&`?

No. For bit operations and vector operation we could use &, but for logical operation we should use &&

@donyunardi
Copy link
Contributor Author

Thanks @mhallal1 and @Polkas for the suggestion.

It looks good to me locally.
image

@arkadiuszbeer
I'm going to open a separate issue for the logical operator issue during lint check process.

@mhallal1 mhallal1 self-assigned this Sep 22, 2022
Copy link
Collaborator

@mhallal1 mhallal1 left a comment

Choose a reason for hiding this comment

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

Additionally, I got this note:

 Imports includes 26 non-default packages.
  Importing from so many packages makes the package vulnerable to any of
  them becoming unavailable.  Move as many as possible to Suggests and
  use conditionally.

@github-actions
Copy link
Contributor

github-actions bot commented Sep 22, 2022

Unit Tests Summary

    1 files    32 suites   12s ⏱️
140 tests 140 ✔️ 0 💤 0
155 runs  155 ✔️ 0 💤 0

Results for commit 8f6cae8.

♻️ This comment has been updated with latest results.

Copy link
Collaborator

@mhallal1 mhallal1 left a comment

Choose a reason for hiding this comment

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

Failing tests:
Screenshot from 2022-09-22 10-08-00

Copy link
Collaborator

@mhallal1 mhallal1 left a comment

Choose a reason for hiding this comment

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

So below is the time needed per example on main, given this I dont think we should set check = FALSE to all examples as it is important to check if these examples work or not. I suggest to set check = FALSE only where needed.
Screenshot from 2022-09-22 10-22-10

EDIT: I can see that the different in time needed is remarkable between my machine and yours @donyunardi , the benchmark should be whatever CRAN is using which we can not test for now as our packages are not on CRAN yet :(

@donyunardi
Copy link
Contributor Author

EDIT: I can see that the different in time needed is remarkable between my machine and yours @donyunardi , the benchmark should be whatever CRAN is using which we can not test for now as our packages are not on CRAN yet :(

True. So in this case, I only removed the check argument for the examples that were mentioned in my initial comments.
Hopefully that's good for now.

@donyunardi
Copy link
Contributor Author

Additionally, I got this note:

 Imports includes 26 non-default packages.
  Importing from so many packages makes the package vulnerable to any of
  them becoming unavailable.  Move as many as possible to Suggests and
  use conditionally.

There's nothing we can do about this for now.
Everything else is addressed.

@donyunardi donyunardi requested a review from mhallal1 September 27, 2022 21:48
@mhallal1 mhallal1 added the core label Sep 28, 2022
@mhallal1
Copy link
Collaborator

Let us create an issue for this as cran will shout out because of the number of imports (similar to insightsengineering/teal.modules.general#456)

Copy link
Collaborator

@mhallal1 mhallal1 left a comment

Choose a reason for hiding this comment

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

LGTM.
Let us create an issue for the number of imports as cran will complain about it (similar to insightsengineering/teal.modules.general#456)

This was referenced Sep 28, 2022
@donyunardi donyunardi merged commit e3ecbf9 into main Sep 28, 2022
@donyunardi donyunardi deleted the as_cran_fix@main branch September 28, 2022 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants