Skip to main content

Convert android gradle lint outputs to a GitLab valid json code quality result file

Project description

Android Lint to Gitlab Code Quality Report

PyPI version

Convert android gradle lint outputs to a GitLab valid json code quality result file.

Thanks to the author of the original project ansible-lint-to-junit-xml and to author of yaml-lint fork yaml-lint-to-junit-xml

Quickstart

Install android-lint-to-glcq with pip:

pip install android-lint-to-glcq

Or you can simply get this repo and install with setup.py

Usage

Run ./gradlew :app:lintDebug and use a file to pass the output

./gradlew :app:lintDebug
android-lint-to-glcq <relative path to lint xml report> <absolute path to project root> > <output file>

Features

Example

Running ./gradlew :app:lintDebug on my Android project results in:

<?xml version="1.0" encoding="UTF-8"?>
<issues format="6" by="lint 7.0.1">

    <issue
        id="FragmentTagUsage"
        severity="Warning"
        message="Replace the &lt;fragment> tag with FragmentContainerView."
        category="Correctness"
        priority="5"
        summary="Use FragmentContainerView instead of the &lt;fragment> tag"
        explanation="FragmentContainerView replaces the &lt;fragment> tag as the preferred                 way of adding fragments via XML. Unlike the &lt;fragment> tag, FragmentContainerView                 uses a normal `FragmentTransaction` under the hood to add the initial fragment,                 allowing further FragmentTransaction operations on the FragmentContainerView                 and providing a consistent timing for lifecycle events."
        url="https://developer.android.com/reference/androidx/fragment/app/FragmentContainerView.html"
        urls="https://developer.android.com/reference/androidx/fragment/app/FragmentContainerView.html"
        errorLine1="        &lt;fragment"
        errorLine2="         ~~~~~~~~">
        <location
            file="/Users/vlad/StudioProjects/Company/fleet/app/src/main/res/layout/activity_main.xml"
            line="13"
            column="10"/>
    </issue>

</issues>

Running android-lint-to-glcq on gradle lint outputs looks line this:

./gradlew :app:lintDebug
android-lint-to-glcq app/lint/reports/lint-results-debug.xml /Users/vlad/StudioProjects/Company/fleet/ > results/android-lint-results.xml

Would result in:

[
  {
    "description": "Use FragmentContainerView instead of the <fragment> tag",
    "severity": "major",
    "fingerprint": "f753a37f26e791db8d499657e23f9caa",
    "location": {
      "path": "fleet/app/src/main/res/layout/activity_main.xml",
      "lines": {
        "begin": "13"
      }
    }
  }
]

And final result:

result

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

android-lint-to-glcq-0.1.3.tar.gz (4.4 kB view hashes)

Uploaded Source

Built Distribution

android_lint_to_glcq-0.1.3-py2.py3-none-any.whl (4.9 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page