Skip to content

args after -- fail #1000

@pocc

Description

@pocc

Problem

Occasionally it is necessary to use -- to signify options that take an argument. When -- is used, any file arguments are ignored.

Description

I am using oclint, which identifies potential problems in c code. -- is required to specify compiler options. This is my current configuration:

[-- skipped for brevity --]

-   repo: local
    hooks:
    -   id: oclint
        name: oclint
        description: Find warnings/errors in C/CPP code
        entry: oclint
        types: [c]
        pass_filenames: true
        args: [
            -enable-clang-static-analyzer,
            -enable-global-analysis,
            --,
            -report-type=json,
            -DCMAKE_EXPORT_COMPILE_COMMANDS=ON,
        ]
        language: system

When running on a valid c file, I get this output:

oclint...................................................................Failed
hookid: oclint

oclint: Not enough positional command line arguments specified!
Must specify at least 1 positional argument: See: /usr/local/bin/oclint -help

Solution

Looking at the code, it looks like you are appending file arguments to the end instead of infixing them before --. A pull request that fixes this will be coming in a few.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions