Lint Rules

To help developers discover potential problems at compile time and keep API usage consistent, Hikage provides a built-in set of Android Lint rules.

Rule List

The following are all Lint rules currently in effect (Only effective for Kotlin language).

hikage-core

Issue IDCategorySeverityPriorityBrief Description
MissingHikageAttributeNamespaceopen in new windowCORRECTNESSERROR6Hikage attribute missing namespace.
DuplicateHikageAttributeopen in new windowCORRECTNESSERROR6Hikage attribute duplicate.
ReplaceWithHikageAttributeNamespaceShortcutsopen in new windowUSABILITYWARNING5Hikage attribute namespace usage.
IneffectiveHikageLayoutAttributeopen in new windowCORRECTNESSWARNING5Hikage layout attribute ineffective.
CreateIdInHikageAttributeopen in new windowCORRECTNESSERROR6Hikage attribute creates ID resource.
MissingIdInHikageAttributeopen in new windowCORRECTNESSERROR6Hikage attribute ID resource missing.
InvalidHikageAttributeNameopen in new windowCORRECTNESSERROR6Hikage attribute name invalid.
InvalidHikageAttributeResourceReferenceopen in new windowCORRECTNESSERROR6Hikage attribute resource reference invalid.
InvalidHikageAttributeColorValueopen in new windowCORRECTNESSERROR6Hikage attribute color value invalid.
TooLongHikageAttributeStringopen in new windowCORRECTNESSERROR6Hikage attribute string too long.
HikagableBeyondScopeopen in new windowCORRECTNESSERROR10Hikagable beyond scope.
MissingHikagableAnnotationopen in new windowCORRECTNESSERROR10Missing @Hikagable annotation.
ReplaceWithHikageSafeTypeCastopen in new windowUSABILITYWARNING5Hikage safe type cast usage.
UseHikageResourcesScopeopen in new windowCORRECTNESSWARNING5Hikage resources scope violation.
RemoveHikagePerformerAliasopen in new windowCORRECTNESSWARNING6Hikage performer import alias.
ReplaceWithGeneratedHikagePerformeropen in new windowUSABILITYWARNING5Hikage generated performer function usage.

How to Disable or Adjust Rules

If you want to disable a specific rule or change its severity, you can create a lint.xml file in the project root.

The following example

<?xml version="1.0" encoding="UTF-8"?>
<lint>
    <issue id="ReplaceWithGeneratedHikagePerformer" severity="ignore" />
    <issue id="ReplaceWithHikageSafeTypeCast" severity="error" />
</lint>

Common severity values are:

  • ignore
  • warning
  • error
  • fatal

You can also control them directly in Gradle.

The following example

android {
    lint {
        disable += "ReplaceWithGeneratedHikagePerformer"
        warning += "ReplaceWithHikageSafeTypeCast"
        error += "MissingHikagableAnnotation"
    }
}

If you only want to check part of the rules, you can also use checkOnly.

The following example

android {
    lint {
        checkOnly += setOf(
            "ReplaceWithGeneratedHikagePerformer",
            "MissingHikagableAnnotation"
        )
    }
}

Feedback

Currently, most Lint detectors are completed by AI Agent, and there may still be issues, such as complex UAST scenarios that have not been tested. If you find that a Lint rule is misreporting or the Quick Fix cannot correctly fix the problem during use, you can provide an Issue ID to directly feedback to us on GitHub Issuesopen in new window.

If you think some rules are not reasonable and overly restrictive on the code, or if you have some new rule suggestions, please also feel free to provide feedback to us, and we will evaluate and adjust them.