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

[Feature Request]: Add Regex Check That Prohibits ColorHex Usage in Drawables Post Kitkat #5075

Closed
MohitGupta121 opened this issue Jun 27, 2023 · 0 comments · Fixed by #5123
Assignees
Labels
enhancement End user-perceivable enhancements. Impact: Low Low perceived user impact (e.g. edge cases). Work: Low Solution is clear and broken into good-first-issue-sized chunks.

Comments

@MohitGupta121
Copy link
Member

MohitGupta121 commented Jun 27, 2023

Is your feature request related to a problem? Please describe.

File Content Validation CI check that prohibits usages of colors other than component_colors in drawable files fails correctly on CI when violated, but the pattern that is being enforced cannot be supported by our current codebase, since we have not yet removed support for kitkat.

Describe the solution you'd like

Add regex check for drawables here in this particular test to check colors only uses from component colors.

Describe alternatives you've considered

No response

Additional context

See #5072, #5076, and #5081 (comment)

@MohitGupta121 MohitGupta121 added enhancement End user-perceivable enhancements. triage needed labels Jun 27, 2023
@MohitGupta121 MohitGupta121 self-assigned this Jun 27, 2023
@MohitGupta121 MohitGupta121 changed the title [Feature Request]: Add hex color regex test for drawables when kitkat support is completely deprecate [Feature Request]: Add hex color in regex prohibitedContent for drawables when kitkat support is completely deprecate Jun 27, 2023
@MohitGupta121 MohitGupta121 changed the title [Feature Request]: Add hex color in regex prohibitedContent for drawables when kitkat support is completely deprecate [Feature Request]: Add test for drawables file that checks color uses only component colors when kitkat support is completely deprecate Jun 28, 2023
@MohitGupta121 MohitGupta121 added Impact: Low Low perceived user impact (e.g. edge cases). Work: Low Solution is clear and broken into good-first-issue-sized chunks. and removed triage needed labels Jun 28, 2023
@adhiamboperes adhiamboperes changed the title [Feature Request]: Add test for drawables file that checks color uses only component colors when kitkat support is completely deprecate [Feature Request]: Add Regex Check That Prohibits ColorHex Usage in Drawables Post Kitkat Aug 10, 2023
BenHenning added a commit that referenced this issue Sep 19, 2023
## Explanation
Fixes #5075. 
This PR adds back the color hex regex check removed in #5076. This
requires a static check exemption for two vectors in the `drawable`
directory, `survey_nps_radio_selected_color.xml` and
`survey_nps_radio_unselected_color.xml`.

The check `file_path_regex: "app/src/main/res/drawable.*?/.+?\\.xml"`
blanket checks all drawables, including vectors. Since these cannot
fully be changed to use component colors yet, I think that the best
approach is to exempt them from the check.

This is a replacement of PR #5081, since #5081 would nolonger be a clean
revert.

## Essential Checklist
<!-- Please tick the relevant boxes by putting an "x" in them. -->
- [x] The PR title and explanation each start with "Fix #bugnum: " (If
this PR fixes part of an issue, prefix the title with "Fix part of
#bugnum: ...".)
- [x] Any changes to
[scripts/assets](https://github.com/oppia/oppia-android/tree/develop/scripts/assets)
files have their rationale included in the PR explanation.
- [x] The PR follows the [style
guide](https://github.com/oppia/oppia-android/wiki/Coding-style-guide).
- [x] The PR does not contain any unnecessary code changes from Android
Studio
([reference](https://github.com/oppia/oppia-android/wiki/Guidance-on-submitting-a-PR#undo-unnecessary-changes)).
- [x] The PR is made from a branch that's **not** called "develop" and
is up-to-date with "develop".
- [x] The PR is **assigned** to the appropriate reviewers
([reference](https://github.com/oppia/oppia-android/wiki/Guidance-on-submitting-a-PR#clarification-regarding-assignees-and-reviewers-section)).

## For UI-specific PRs only
<!-- Delete these section if this PR does not include UI-related
changes. -->
If your PR includes UI-related changes, then:
- Add screenshots for portrait/landscape for both a tablet & phone of
the before & after UI changes
- For the screenshots above, include both English and pseudo-localized
(RTL) screenshots (see [RTL
guide](https://github.com/oppia/oppia-android/wiki/RTL-Guidelines))
- Add a video showing the full UX flow with a screen reader enabled (see
[accessibility
guide](https://github.com/oppia/oppia-android/wiki/Accessibility-A11y-Guide))
- Add a screenshot demonstrating that you ran affected Espresso tests
locally & that they're passing

---------

Co-authored-by: Ben Henning <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement End user-perceivable enhancements. Impact: Low Low perceived user impact (e.g. edge cases). Work: Low Solution is clear and broken into good-first-issue-sized chunks.
2 participants