Lint

Lint Rules for Android Data Binding library

Лицензия

Лицензия

Категории

Категории

Данные
Группа

Группа

com.github.annypatel.databinding
Идентификатор

Идентификатор

lint
Последняя версия

Последняя версия

1.0.0-alpha2
Дата

Дата

Тип

Тип

jar
Описание

Описание

Lint
Lint Rules for Android Data Binding library
Ссылка на сайт

Ссылка на сайт

https://github.com/annypatel/databinding-lint/
Система контроля версий

Система контроля версий

https://github.com/annypatel/databinding-lint/

Скачать lint

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.github.annypatel.databinding/lint/ -->
<dependency>
    <groupId>com.github.annypatel.databinding</groupId>
    <artifactId>lint</artifactId>
    <version>1.0.0-alpha2</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.annypatel.databinding/lint/
implementation 'com.github.annypatel.databinding:lint:1.0.0-alpha2'
// https://jarcasting.com/artifacts/com.github.annypatel.databinding/lint/
implementation ("com.github.annypatel.databinding:lint:1.0.0-alpha2")
'com.github.annypatel.databinding:lint:jar:1.0.0-alpha2'
<dependency org="com.github.annypatel.databinding" name="lint" rev="1.0.0-alpha2">
  <artifact name="lint" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.annypatel.databinding', module='lint', version='1.0.0-alpha2')
)
libraryDependencies += "com.github.annypatel.databinding" % "lint" % "1.0.0-alpha2"
[com.github.annypatel.databinding/lint "1.0.0-alpha2"]

Зависимости

Библиотека не имеет зависимостей. Это самодостаточное приложение, которое не зависит ни от каких других библиотек.

Модули Проекта

Данный проект не имеет модулей.

databinding-lint

CircleCI Release License

The Data Binding Library allows you to bind UI components in your layouts to data sources in your app using a declarative format rather than programmatically. Data Binding is a very powerful library and if you are not careful with it, you will end up writing lots of business logic in your XML files. databinding-lint library provides set of lint checks to detect binding expressions with such logic.

Download

Download the latest artifact from Maven central at following coordinates:

implementation 'com.github.annypatel.databinding:lint-checks:1.0.0-alpha2'

Lint Checks

  • CastOperator - Detects cast operation in binding expression.

     res/layout/example.xml:5: Error: Cast operator in binding expression [CastOperator]
        android:text="@{(String) count}" />
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
  • UnaryOperator - Detects usage of unary operators +, -, ! and ~.

     res/layout/example.xml:5: Error: Unary operator in binding expression [UnaryOperator]
        android:text="@{+count}" />
        ~~~~~~~~~~~~~~~~~~~~~~~~
    
  • MathOperator - Detects usage of mathematical operators +, -, *, / and %.

     res/layout/example.xml:5: Error: Mathematical operator in binding expression [MathOperator]
         android:text="@{width * height}" />
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
  • BitShiftOperator - Detects usage of bit-shift operators <<, >> and >>>.

     res/layout/example.xml:5: Error: Bit-shift operator in binding expression [BitShiftOperator]
         android:text="@{x >> 2}" />
         ~~~~~~~~~~~~~~~~~~~~~~~~
    
  • CompareOperator - Detects usage of comparison operators <, <=, >, >=, == and !=.

     res/layout/example.xml:5: Error: Comparison operator in binding expression [CompareOperator]
         android:text="@{length > 0}" />
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
  • InstanceOfOperator - Detects usage of instanceof operator in binding expression.

     res/layout/example.xml:5: Error: InstanceOf operator in binding expression [InstanceOfOperator]
         android:text="@{data instanceof String}" />
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
  • BinaryOperator - Detects usage of binary operators &, | and ^.

     res/layout/example.xml:5: Error: Binary operator in binding expression [BinaryOperator]
         android:text="@{a | b}" />
         ~~~~~~~~~~~~~~~~~~~~~~~
    
  • AndOrOperator - Detects usage of And-Or operators && and ||.

     res/layout/example.xml:5: Error: AndOr operator in binding expression [AndOrOperator]
         android:text="@{a || b}" />
         ~~~~~~~~~~~~~~~~~~~~~~~~
    
  • TernaryOperator - Detects usage of ternary operator in binding expression.

     res/layout/example.xml:5: Error: Ternary operator in binding expression [TernaryOperator]
         android:text="@{a > b ? x : y}" />
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
  • NullCoalescingOperator - Detects usage of null coalescing ?? operator.

     res/layout/example.xml:5: Error: Null Coalescing operator in binding expression [NullCoalescingOperator]
         android:text="@{data ?? fallback}" />
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
  • GroupOperator - Detects usage of grouping () in binding expression.

     res/layout/example.xml:5: Error: Group operator in binding expression [GroupOperator]
         android:text="@{(width + height) / 2}" />
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
  • BracketOperator - Detects usage of bracket operator [] for accessing collections such as list[index] or map[key].

     res/layout/example.xml:5: Error: Bracket operator in binding expression [BracketOperator]
         android:text="@{list[1]}" />
         ~~~~~~~~~~~~~~~~~~~~~~~~~
    
  • ClassExtractionExpression - Detects .class access in binding expression.

     res/layout/example.xml:5: Error: Class extraction in binding expression [ClassExtractionExpression]
         android:text="@{String.class}" />
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
  • LiteralExpression - Detects hardcoded java literals in binding expression.

     res/layout/example.xml:5: Error: Literal in binding expression [LiteralExpression]
         android:text="@{\"Data\"}" />
         ~~~~~~~~~~~~~~~~~~~~~~~~~~
    
  • MethodCallExpression - Detects method calls in binding expressions.

     res/layout/example.xml:5: Error: Method call in binding expression [MethodCallExpression]
         android:text="@{String.valueOf(count)}" />
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
  • GlobalMethodCallExpression - Detects global method calls in binding expressions.

     res/layout/example.xml:5: Error: Global method call in binding expression [GlobalMethodCallExpression]
         android:text="@{valueOf(count)}" />
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    

Версии библиотеки

Версия
1.0.0-alpha2
1.0.0-alpha1