Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing bugs #143

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,42 +16,47 @@
logger.propagate = True

def main():
args = parseArguments()

logLevel = ""
if args.debug:
logLevel = logging.DEBUG
logger.debug("Debug logging is ON")
else:
logLevel = logging.INFO

logging.basicConfig(
format='%(asctime)s - %(levelname)s - %(message)s',
level=logLevel,
handlers=[
logging.FileHandler("log.log"), # Write logs to a file
logging.StreamHandler()
])

if args.version:
reportVersion()
sys.exit(0)

logger.debug("Start parsing.")

filePath = str(args.input)
validator = Validator()
try:
args = parseArguments()

reference_logic = args.reference_logic
if None == reference_logic:
reference_logic = "none"
result, problems = validator.validate(filePath,
args.strict_purl_check,
args.strict_url_check,
referringLogic=args.reference_logic)

exitCode = reportCli(result, problems, args.nr_of_errors, args.input)
sys.exit(exitCode)
logLevel = ""
if args.debug:
logLevel = logging.DEBUG
logger.debug("Debug logging is ON")
else:
logLevel = logging.INFO

logging.basicConfig(
format='%(asctime)s - %(levelname)s - %(message)s',
level=logLevel,
handlers=[
logging.FileHandler("log.log"), # Write logs to a file
logging.StreamHandler()
])

if args.version:
reportVersion()
sys.exit(0)

logger.debug("Start parsing.")

filePath = str(args.input)
validator = Validator()

reference_logic = args.reference_logic
if None == args.reference_logic:
reference_logic = "none"

result, problems = validator.validate(filePath,
args.strict_purl_check,
args.strict_url_check,
referringLogic=reference_logic)

exitCode = reportCli(result, problems, args.nr_of_errors, args.input)
sys.exit(exitCode)
except KeyboardInterrupt:
print(" Ctrl-C pressed. Terminating...")
sys.exit(2)

class Argument:
def __init__(self, argument, action, help):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def validate(self,
problems.append("File error", "General", "General", f"JSON syntax error at line {e.lineno} column {e.colno}", file)
return False, problems
except SPDXParsingError as e:
logger.error("ERROR! The file is not an SPDX file")
logger.error(f"ERROR! The file ({filePath}) is not an SPDX file")
all_messages = ""
for message in e.messages:
logger.error(message)
Expand All @@ -211,7 +211,7 @@ def validate(self,

errors = validate_full_spdx_document(doc)
if errors:
logger.error("ERROR! The file is not a valid SPDX file")
logger.error(f"ERROR! The file ({filePath}) is not a valid SPDX file")
for error in errors:
logger.debug(f"Validation error: {error.context.parent_id} - {error.context.full_element} - {error.validation_message}")
spdxId = "General"
Expand Down
Loading