pre-commit / pre-commit/identify

salt sls files with python shebangs are not properly recognized

Open
#61 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
297
Forks
179
PR merge metrics
No merged PRs in 30d

Description

Some salt sls files are written in python directly, I've added those interpreters in a PR here https://github.com/chriskuehl/identify/pull/60 as well as disabled the executable checks since these files are not required to be and also disabled the optimization for skipping peeking at the file contents if we recognize the extension.. I do see how this a nice speedup though.. maybe the extensions.EXTENSIONS dict should be changed from:

EXTENSIONS = {
...
    'sh': {'text', 'shell'},
    'sls': {'text', 'salt'},
    'so': {'binary'},
...
}

to something like:

EXTENSIONS = {
...
    'sh': {
        'tags': {'text', 'shell'},
        },
    'sls': {
        'tags': {'text', 'salt'},
        'always-peek': True,
    },
    'so': {
        'tags': {'binary'},
    },
...
}

By changing each value to its own dict which could have an optional key always-peek(?) so then you could .get('always-peek', False) to check if the file should be inspected?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the proposed changes in pull request #60 and inspect the extensions.EXTENSIONS mapping described in the issue. Trace how .sls files are classified, including executable checks and the extension-based content-peek optimization. Done means Python-shebang Salt SLS files are recognized without requiring executable permissions.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.