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

Fixes #1882: NumericInput tests are shifted to a new folder and their package is updated to match the directory structure. #1919

Merged
merged 9 commits into from
Oct 1, 2020

Conversation

soamOne
Copy link
Contributor

@soamOne soamOne commented Sep 29, 2020

Explanation

Fixes #1882: In this PR we shift the numericinput test files to a new folder called numericinput. The package in the files is
updated to match the directory structure of the files. The Bazel files are also updated
with the correct directory structure.

Checklist

  • The PR title starts with "Fix #bugnum: ", followed by a short, clear summary of the changes. (If this PR fixes part of an issue, prefix the title with "Fix part of #bugnum: ...".)
  • The PR explanation includes the words "Fixes #bugnum: ..." (or "Fixes part of #bugnum" if the PR only partially fixes an issue).
  • The PR follows the style guide.
  • The PR does not contain any unnecessary auto-generated code from Android Studio.
  • The PR is made from a branch that's not called "develop".
  • The PR is made from a branch that is up-to-date with "develop".
  • The PR's branch is based on "develop" and not on any other branch.
  • The PR is assigned to an appropriate reviewer in both the Assignees and the Reviewers sections.

@soamOne soamOne requested a review from BenHenning as a code owner September 29, 2020 19:54
@soamOne
Copy link
Contributor Author

soamOne commented Sep 29, 2020

@BenHenning @rt4914 PTAL.

@soamOne
Copy link
Contributor Author

soamOne commented Sep 30, 2020

Hey @rt4914 @BenHenning, Why are the Kotlin tests failing due to import statements, even though the last PR passed these tests?

@aggarwalpulkit596
Copy link
Contributor

@soamOne the lints are failing. Could you fix those ? Also you can check locally by running ktlint --android

@soamOne
Copy link
Contributor Author

soamOne commented Sep 30, 2020

Hey @rt4914 @BenHenning, Why are the Kotlin tests failing due to import statements, even though the last PR passed these tests?

@aggarwalpulkit596 can you please help with this?

@anandwana001
Copy link
Contributor

anandwana001 commented Sep 30, 2020

Hi @soamOne

Ktlint is failing because you have a few unused imports in these files. I had mentioned the files and the line number, you can check and remove these lines which are unused. Also, remember while removing that the imports should be in lexicographical order else ktlint fail again. To automate this lexicographical order you can reformat the code from the menu option.

numericinput/NumericInputEqualsRuleClassifierProviderTest.kt:13:1: Unnecessary import
numericinput/NumericInputIsGreaterThanOrEqualToRuleClassifierProviderTest.kt:13:1: Unnecessary import
numericinput/NumericInputIsGreaterThanRuleClassifierProviderTest.kt:13:1: Unnecessary import
numericinput/NumericInputIsInclusivelyBetweenRuleClassifierProviderTest.kt:13:1: Unnecessary import
numericinput/NumericInputIsLessThanOrEqualToRuleClassifierProviderTest.kt:13:1: Unnecessary import
numericinput/NumericInputIsLessThanRuleClassifierProviderTest.kt:13:1: Unnecessary import

You can simply remove them using optimize imports. Also, for the future works, I suggest you set macro as per description here https://github.com/oppia/oppia-android/wiki/Ktlint-Guide#macros

This will reformat your code and also optimize the imports, so there will be few chances of ktlint fails.
You can also run ktlint on your local machine as per the instruction here https://github.com/oppia/oppia-android/wiki/Ktlint-Guide#commands

@anandwana001 anandwana001 assigned BenHenning and soamOne and unassigned BenHenning Sep 30, 2020
@BenHenning
Copy link
Member

You can also run the ktlint tool on the command line with '-F' to automatically fix linter errors, though it's good practice to make sure that you know how to manually fix them as well. :)

Copy link
Member

@BenHenning BenHenning left a comment

Choose a reason for hiding this comment

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

Thanks @soamOne! The changes generally look good, but please fix the ktlint errors and I'll take one more pass on this PR.

R.styleable.ProfileInputView_isPasswordInput,
/** defVal= */ false
)
R.styleable.ProfileInputView_isPasswordInput,
Copy link
Contributor

Choose a reason for hiding this comment

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

@soamOne You have changed indentation here, fixing that would solve the ktlint error

@@ -68,8 +68,8 @@ class StartSnapHelper : LinearSnapHelper() {
return if (helper.getDecoratedEnd(child) >=
helper.getDecoratedMeasurement(child) / 2 &&
helper.getDecoratedEnd(
child
) > 0
child
Copy link
Contributor

Choose a reason for hiding this comment

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

Same applies here

@soamOne
Copy link
Contributor Author

soamOne commented Sep 30, 2020

Thanks a lot @rt4914 @aggarwalpulkit596 @anandwana001 @prayutsu !!
@BenHenning can you please take a look now, thanks!

Copy link
Contributor

@anandwana001 anandwana001 left a comment

Choose a reason for hiding this comment

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

@soamOne thanks
LGTM, one last thing.

@@ -61,7 +61,8 @@ class ProfileInputView @JvmOverloads constructor(
if (
attributes.getBoolean(
R.styleable.ProfileInputView_isPasswordInput,
/** defVal= */ false
/** defVal= */
false
Copy link
Contributor

Choose a reason for hiding this comment

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

One last thing from my side, could you make these in one line?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, will do!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

Copy link
Member

Choose a reason for hiding this comment

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

This doesn't appear done yet--please fix.

@prayutsu prayutsu self-requested a review September 30, 2020 10:13
Copy link
Contributor

@prayutsu prayutsu left a comment

Choose a reason for hiding this comment

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

@soamOne Looks good to me, thanks!

Copy link
Contributor

@anandwana001 anandwana001 left a comment

Choose a reason for hiding this comment

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

LGTM, Thanks @soamOne

@anandwana001 anandwana001 assigned BenHenning and unassigned soamOne Sep 30, 2020
This reverts commit 37a57fd.
Copy link
Member

@BenHenning BenHenning left a comment

Choose a reason for hiding this comment

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

Thanks @soamOne! The PR LGTM, but please fix the extra change in ProfileInputView.kt.

@@ -61,7 +61,8 @@ class ProfileInputView @JvmOverloads constructor(
if (
attributes.getBoolean(
R.styleable.ProfileInputView_isPasswordInput,
/** defVal= */ false
/** defVal= */
false
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't appear done yet--please fix.

@BenHenning BenHenning assigned soamOne and unassigned BenHenning Sep 30, 2020
@soamOne
Copy link
Contributor Author

soamOne commented Sep 30, 2020

@BenHenning i tried fixing that but for some reason the checks were failing, so i reverted it.

@BenHenning
Copy link
Member

@soamOne what specific check was failing? It's important to make sure we don't undo work that we previously mentioned was completed, and to be specific about why changes can't be done otherwise reviewers don't have sufficient context to review the code. :)

@soamOne
Copy link
Contributor Author

soamOne commented Oct 1, 2020

@BenHenning I get your point :)
Actually the app module Robolectric checks were failing with a java.lang.RuntimeException.

@BenHenning
Copy link
Member

Thanks @soamOne! Feel free to ask for help if needed (e.g. if an error that you encounter doesn't make sense).

@BenHenning
Copy link
Member

BenHenning commented Oct 1, 2020

Also, when you encounter an exception you should provide:

  • The steps you did to trigger it
  • The stack trace you’re seeing
  • Your initial thoughts of what’s going wrong and what you’ve tried to fix

Without this information, it’s hard for others to help since they don’t have as much context as you on the inner workings of your PR.

@soamOne
Copy link
Contributor Author

soamOne commented Oct 1, 2020

@BenHenning can you PTAL now, thanks :)

@soamOne soamOne requested a review from BenHenning October 1, 2020 19:18
Copy link
Member

@BenHenning BenHenning left a comment

Choose a reason for hiding this comment

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

This looks good, thanks @soamOne!

@BenHenning
Copy link
Member

Going ahead and merging this since everything is looking good.

@BenHenning BenHenning merged commit de89de7 into oppia:develop Oct 1, 2020
@soamOne soamOne deleted the numeric-input-tests branch October 1, 2020 20:48
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.

Shift NumericInput Rules test to separate sub-package
5 participants