Skip to main content

Tooling for interacting with AppOmni's ALIGN Parsers

Project description

AppOmni ALIGN Tools

Tools for working with ALIGN parser files, including a schema validator/linter.

Installation

Using Poetry:

poetry add appomni-align-tools

Using pip:

pip install appomni-align-tools

Tools

ALIGN Linter

A linter for validating ALIGN parser files. The linter checks for:

  • Valid ALIGN commands
  • Valid field paths according to the schema
  • Valid enum values
  • Type compatibility for conversions

Usage

Basic usage:

align-lint path/to/file.conf --schema path/to/schema.json

Lint multiple files:

align-lint path/to/*.conf --schema path/to/schema.json

Options:

  • --schema: Path to JSON schema file (required)
  • --verbose, -v: Enable verbose output

GitHub Action

Add this to your repository's workflow file (e.g., .github/workflows/align-lint.yml):

name: ALIGN Linter

on:
  push:
    paths:
      - '**.conf'
  pull_request:
    paths:
      - '**.conf'

jobs:
  lint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      
      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: '3.12'
          
      - name: Install Poetry
        run: |
          pipx install poetry
          
      - name: Install dependencies
        run: |
          poetry install appomni-align-tools

      - name: Run ALIGN linter
        env:
          SCHEMA_PATH: ${{ inputs.schema-path || 'schemas/ACES.json' }}
        run: |
          poetry run align-lint $(find . -name "*.conf") --schema "$SCHEMA_PATH"

Supported Commands

The linter validates the following ALIGN commands:

  • append
  • copy
  • convert
  • convert_nested
  • date
  • dedupe
  • del
  • from_json
  • http
  • parse_ip
  • parse_sql
  • parse_user_agent
  • regex_capture
  • rename
  • set
  • split
  • to_json
  • translate

Development

Setup

# Install dependencies
poetry install

# Run tests
pytest tests/

Supporting Changes to Align

Generate new Lexer, Listener, and Parser via ANTLR and push generated files into align folder.

antlr4 -Dlanguage=Python3 -o align Align.g4

Adding New Validations

The linter can be extended by adding new validation methods to the AlignParserLinter class in linter.py.

GitHub Annotations

When used in GitHub Actions, the linter will create annotations in pull requests for any issues found, showing:

  • The specific line and column where the issue was found
  • A description of the error
  • The file containing the error

This makes it easy to spot and fix issues directly in the PR interface.

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

appomni_align_tools-0.1.0.tar.gz (14.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

appomni_align_tools-0.1.0-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

File details

Details for the file appomni_align_tools-0.1.0.tar.gz.

File metadata

  • Download URL: appomni_align_tools-0.1.0.tar.gz
  • Upload date:
  • Size: 14.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.5 Darwin/24.2.0

File hashes

Hashes for appomni_align_tools-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a7a3024d6c8127ef799608d7f24dac412ac025189efd97813e4efc682a537932
MD5 f93cd38bab80f950fabc29453ce4a801
BLAKE2b-256 032d7d492fdc612909319147625b65c505bf0bd2d7d9f681f177e463280bd506

See more details on using hashes here.

File details

Details for the file appomni_align_tools-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for appomni_align_tools-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1ae4856ddb0e31d3d62af05cff565932703bb61fbed2a1493d606d2c7d8b596c
MD5 c1c6ad6672ef81b71d6e376169d60191
BLAKE2b-256 e8f572c55d6e854db508d72d5c53ac49da7c4de96b076d4d0497a755912caf51

See more details on using hashes here.

Supported by

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