A linter for ksy files.
Project description
ksylint
Check kaitai .ksy files for errors and style flaws.
Installation
pip install ksylint
Usage
ksylint hello_world.ksy
Missing style guide tests (TODO)
- General formatting
- Use block YAML style in most general cases, unless explicitly specified/allowed otherwise.
- Formatting of maps-inside-sequences MUST have - delimiter and first map element on the same first line.
- Meta section (meta)
- xref — keys inside MUST be in alphabetic order
- license — MUST be a valid SPDX license expression
- ks-version — SHOULD list lowest possible KS compiler version that is able to compile this file.
- KS syntax allows usage of some top-level elements deep inside the hierarchy — this can be useful during development, for example, for purpose of grafting one .ksy file into another quickly. However, in production-quality .ksy files, one MUST NOT use keys like title, imports or ks-version (i.e. everything except explicitly listed in a list above) on intermediate levels.
- The following keys are reserved for internal use (i.e. debugging and test running) and MUST NOT be used in general-purpose .ksy files: ks-debug, ks-opaque-types
- Documentation
- Single-line documentation strings SHOULD BE formatted using raw unquoted string literals.
- Multi-line SHOULD BE formatted using YAML literal style scalar, i.e. using : | syntax.
- Lines should be wrapped to be 80 columns long. If it doesn’t fit into single line after wrapping, then it’s a multi-line docstring, so use proper multi-line syntax.
- There is no formal conversion of docstrings into language-specific docstrings now in KS, but generally we SHOULD keep it close to CommonMark formatting, i.e.:
- paragraphs separated by an empty line
- bullet lists created by an asterisk * and a space at the beginning of the line
- use backticks ` to wrap identifiers and small pieces of code
- Sequence attributes
- Attribute identifiers
- Trailing padding
Not checked
- All identifiers, docstrings, comments and generally all human-readable text SHOULD be kept in English, unless there’s a very good reason not to do so.
- application — SHOULD name a particular application, if there’s any; if there are too many to list (for example, network packet formats or executables are used virtually everywhere), then one SHOULD omit this field.
- file-extension — if there’s only one extension, MUST be a string; if there are several, MUST be an sequence in block form and SHOULD order extensions from most popular extension to least popular.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ksylint-0.3.1.tar.gz
(8.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
ksylint-0.3.1-py3-none-any.whl
(20.6 kB
view details)
File details
Details for the file ksylint-0.3.1.tar.gz.
File metadata
- Download URL: ksylint-0.3.1.tar.gz
- Upload date:
- Size: 8.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a7bfecca71899d81ad1ccd36b01ec54fcbed5dcb3f6b429782c27b14f75dd6fb
|
|
| MD5 |
a793ce1ea0be76bc9bb2a031ba99aa9d
|
|
| BLAKE2b-256 |
f49f5a23c75c0663c61dd66d96350fe9daac7038fa03499ba2ee2c4e4ceac4e4
|
File details
Details for the file ksylint-0.3.1-py3-none-any.whl.
File metadata
- Download URL: ksylint-0.3.1-py3-none-any.whl
- Upload date:
- Size: 20.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d0b8cff164921540372cfb917920f8e4b9abf966a1e47b0a4997907aaaf675eb
|
|
| MD5 |
9e8844d3b519057c30886a0139e3090c
|
|
| BLAKE2b-256 |
9d7b010bc69de4aa7ea91b43aec203000d784e483651234dceeea82061982132
|