Skip to content

Commit

Permalink
Add ability to provide default options for run_scancode #37
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Druez <tdruez@nexb.com>
  • Loading branch information
tdruez committed Nov 6, 2020
1 parent 4deed90 commit 65fa330
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 4 additions & 1 deletion scancodeio/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@

USE_TZ = True


# Static files (CSS, JavaScript, Images)

STATIC_URL = "/static/"
Expand Down Expand Up @@ -200,3 +199,7 @@
env = environ.Env()

SECRET_KEY = env.str("SECRET_KEY")

# ScanCode.io custom settings

SCANCODE_DEFAULT_OPTIONS = env.str("SCANCODE_DEFAULT_OPTIONS", [])
5 changes: 5 additions & 0 deletions scanpipe/pipes/scancode.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
# ScanCode.io is a free software code scanning tool from nexB Inc. and others.
# Visit https://github.com/nexB/scancode.io for support and download.

from django.conf import settings

import packagedcode
from packageurl import PackageURL
from scancode.resource import VirtualCodebase
Expand Down Expand Up @@ -52,9 +54,12 @@ def run_scancode(location, output_file, options):
"""
Scan `location` content and write results into `output_file`.
"""
default_options = getattr(settings, "SCANCODE_DEFAULT_OPTIONS", [])

scancode_args = [
get_bin_executable("scancode"),
location,
*default_options,
*options,
f"--json-pp {output_file}",
]
Expand Down

0 comments on commit 65fa330

Please sign in to comment.