Skip to main content

Linter, static analyzer, dialplan evaluator for FreeSWITCH XML configuration files

Project description

frslint

Linter for FreeSWITCH XML configuration files. Checks code style, finds common errors, and can auto-fix most issues. Able to run debug mode to follow the evalution steps in your freeswitch to follow where what is happen in your configuration.

About

This project is a hobby project. As I am tasked with maintaining some freeswitch systems and the freeswitch ecosystem was lacking any static analysis / debugging tools. It is not perfect, the code has its faults, not every case is covered yet, but I would like to continue improving this over time. Feel free to submit wishes / bug reports, so this tool can grow into something bigger.

Installation

pip install frslint

Or install from source:

git clone https://github.com/zimmer-yan/frslint
cd frslint
pip install -e .

Usage

Lint (code style)

Check for style issues:

frslint lint /etc/freeswitch/freeswitch.xml

Auto-fix what can be fixed:

frslint lint /etc/freeswitch/freeswitch.xml --fix

Options:

--fix                 Auto-fix fixable issues
--indent-size N       Expected indent size (default: 2)
--max-line-length N   Max line length (default: 120)
--max-blank-lines N   Max consecutive blank lines (default: 2)
--allow-tabs          Allow tabs instead of spaces
-f, --format json     Output json formatted
-v, --verbose         Verbose output

Analyze (static analysis)

Check for errors like undefined variables, invalid regex, etc:

frslint analyze /etc/freeswitch/freeswitch.xml

Options:

-f, --format json     Output json formatted
-v, --verbose         Verbose output

Debug

Trace dialplan execution for a given destination number:

frslint debug /etc/freeswitch/freeswitch.xml 1234
frslint debug /etc/freeswitch/freeswitch.xml 1234 -c public

Options:

-n, --network-addr      Network address of the caller
-c, --context-name      Name of the context to run (default: public)
-v, --verbose           Verbose output

What it checks

Lint:

  • Trailing whitespace
  • Tabs vs spaces
  • Indentation depth
  • Consecutive blank lines
  • Missing newline at EOF
  • Line length
  • Mixed line endings (CRLF/LF)

Analyze:

  • Undefined channel variables
  • Invalid regex patterns
  • Missing required attributes
  • Unknown applications

Exit codes

  • 0 - No issues found
  • 1 - Issues found (or unfixed issues when using --fix)

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

frslint-0.1.0.tar.gz (25.6 kB view details)

Uploaded Source

Built Distribution

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

frslint-0.1.0-py3-none-any.whl (35.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: frslint-0.1.0.tar.gz
  • Upload date:
  • Size: 25.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for frslint-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2542a02e8c004ad6ad6fbf7c0d0f4e18b197f992c7222cc66c0dfeada66d7bac
MD5 6b4905ad6dd5372e3a916852202b7001
BLAKE2b-256 f8c5f87182ea778b833cfdf1e98c24be7877372e3216dda80c592650e7b4ba1d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: frslint-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 35.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for frslint-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 58bdf2c665833531bcf3dbb3f8b5b4f6eb4bad287ddc3e4fdc909c730ccb089a
MD5 5bc6380dbbf4dd1acc58e46a7575cbfc
BLAKE2b-256 9097b00da8994b234cbd2988e75d15a089549c4ff273fd6b9259eebeea444fe8

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