-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
lint: enforce layout naming conventions (activity_, fragment_, view_, dialog_) #19992
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
lint: enforce layout naming conventions (activity_, fragment_, view_, dialog_) #19992
Conversation
david-allison
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Output looks fine from an initial glance, looks good to go once code is cleaned up.
Thanks!!
lint-rules/src/test/java/com/ichi2/anki/lint/rules/ActivityLayoutPrefixDetectorTest.kt
Outdated
Show resolved
Hide resolved
lint-rules/src/main/java/com/ichi2/anki/lint/rules/ActivityLayoutPrefixDetector.kt
Outdated
Show resolved
Hide resolved
lint-rules/src/main/java/com/ichi2/anki/lint/rules/ActivityLayoutPrefixDetector.kt
Outdated
Show resolved
Hide resolved
lint-rules/src/main/java/com/ichi2/anki/lint/rules/DialogLayoutPrefixDetector.kt
Outdated
Show resolved
Hide resolved
lint-rules/src/main/java/com/ichi2/anki/lint/rules/ActivityLayoutPrefixDetector.kt
Outdated
Show resolved
Hide resolved
lint-rules/src/main/java/com/ichi2/anki/lint/rules/FragmentLayoutPrefixDetector.kt
Outdated
Show resolved
Hide resolved
david-allison
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems good, cheers! Needs a squash merge
This may need fixing once more classes are converted as part of the following issue, but I'll take responsibility for this.
| @@ -0,0 +1,94 @@ | |||
| /* | |||
| * Copyright (c) 2026 Sonal Yadav | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Use your mail as well
Eg:
* Copyright (c) 2025 Hari Srinivasan <[email protected]>
da36da5 to
cd9e055
Compare
(activity_, fragment_, view_, dialog_) Add email to copyright headers Refactor layout prefix detectors: extract shared utils, use Kotlin tests lint: enforce dialog_ prefix for Dialog layouts lint: enforce view_ prefix for View layouts lint: enforce fragment_ prefix for Fragment layouts lint: enforce activity_ prefix for Activity layouts
cd9e055 to
4339e95
Compare
Purpose / Description
Add lint rules to enforce layout file naming conventions (activity_, fragment_, view_, dialog_ prefixes) and fix existing violations.
Fixes
Approach
1)Created 4 custom lint detectors using ViewBinding class detection
2)Renamed non-compliant layout files and updated code references
How Has This Been Tested?
1)All lint-rules unit tests pass
2)Build successful (
./gradlew assemblePlayDebug)3)No remaining lint violations
Test config: macOS, JDK 21
Checklist
Please, go through these checks before submitting the PR.