Skip to content

--ignore does not appear to work for directories #4212

Description

@zfields

Directories specified in the --ignore list still appear in the result list.

$ scancode --version
ScanCode version: 32.3.3
ScanCode Output Format version: 4.0.0
SPDX License list version: 3.26

I tried the following basic invocations...

scancode --ignore build/* --verbose --json-pp - .

The way it evaluated the glob without parenthesis in the options was interesting...

"options": {
        "input": [
          "build/CMakeFiles",
          "build/CTestTestfile.cmake",
          "build/DartConfiguration.tcl",
          "build/Makefile",
          "build/Testing",
          "build/_deps",
          "build/cmake_install.cmake",
          "build/compile_commands.json",
          "build/generated-includes",
          "build/libnote_c.a",
          "build/libnote_c.so",
          "build/test",
          "."
        ],
        "--ignore": [
          "build/CMakeCache.txt"
        ],
        "--json-pp": "-",
        "--verbose": true
      },

I tried putting parenthesis in around the ignore, then it captures the ignore literally, and gets the input correct (but that results in no filtering)...

scancode --ignore "build/*" --verbose --json-pp - .

but I still see these in my output...

$ scancode --ignore "note-c/build/*" --verbose --json-pp - .
 Setup plugin: pre_scan:ignore...
 Setup plugin: output:json-pp...
Collect file inventory...
Run pre-scans...
 Run pre-scan: ignore...
Save scan results...
 Save scan results as: json-pp...
{
  "headers": [
    {
      "tool_name": "scancode-toolkit",
      "tool_version": "32.3.3",
      "options": {
        "input": [
          "."
        ],
        "--ignore": [
          "build/*"
        ],
        "--json-pp": "-",
        "--verbose": true
      },
      "notice": "Generated with ScanCode and provided on an \"AS IS\" BASIS, WITHOUT WARRANTIES\nOR CONDITIONS OF ANY KIND, either express or implied. No content created from\nScanCode should be considered or used as legal advice. Consult an Attorney\nfor any legal advice.\nScanCode is a free software code scanning tool from nexB Inc. and others.\nVisit https://github.com/nexB/scancode-toolkit/ for support and download.",
      "start_timestamp": "2025-03-25T132932.971187",
      "end_timestamp": "2025-03-25T132933.313648",
      "output_format_version": "4.0.0",
      "duration": 0.3424708843231201,
      "message": null,
      "errors": [],
      "warnings": [],
      "extra_data": {
        "system_environment": {
          "operating_system": "linux",
          "cpu_architecture": "64",
          "platform": "Linux-6.8.0-55-generic-x86_64-with-glibc2.36",
          "platform_version": "#57-Ubuntu SMP PREEMPT_DYNAMIC Wed Feb 12 23:42:21 UTC 2025",
          "python_version": "3.11.2 (main, Nov 30 2024, 21:22:50) [GCC 12.2.0]"
        },
        "spdx_license_list_version": "3.26",
        "files_count": 202
      }
    }
  ],
  "files": [
    {
      "path": "note-c",
      "type": "directory",
      "scan_errors": []
    },
...
    {
      "path": "note-c/build",
      "type": "directory",
      "scan_errors": []
    },
    {
      "path": "note-c/build/_deps",
      "type": "directory",
      "scan_errors": []
    },
    {
      "path": "note-c/build/_deps/catch2-build",
      "type": "directory",
      "scan_errors": []
    },
    {
      "path": "note-c/build/_deps/catch2-build/CMakeFiles",
      "type": "directory",
      "scan_errors": []
    },
    {
      "path": "note-c/build/_deps/catch2-build/generated-includes",
      "type": "directory",
      "scan_errors": []
    },
...

truncated for readability

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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