Skip to content

Commit 90c91f9

Browse files
committed
Change some error wording.
Signed-off-by: Chin Yeung Li <[email protected]>
1 parent 238ce59 commit 90c91f9

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

src/attributecode/cmd.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,7 @@ def attrib(input, output, api_url, api_key, scancode, min_license_score, referen
368368

369369
rendered = ''
370370
license_dict = {}
371+
errors = []
371372

372373
if not quiet:
373374
print_version()
@@ -392,7 +393,7 @@ def attrib(input, output, api_url, api_key, scancode, min_license_score, referen
392393
click.echo(msg)
393394
sys.exit(1)
394395

395-
if input.endswith('.json') or input.endswith('.csv'):
396+
if input.endswith('.json') or input.endswith('.csv') or input.endswith('.xlsx'):
396397
is_about_input = False
397398
from_attrib = True
398399
if not reference:
@@ -409,8 +410,12 @@ def attrib(input, output, api_url, api_key, scancode, min_license_score, referen
409410
errors, abouts = collect_inventory(input)
410411

411412
if not abouts:
412-
msg = 'No ABOUT file or reference is found from the input. Attribution generation halted.'
413-
click.echo(msg)
413+
if errors:
414+
errors = unique(errors)
415+
errors_count = report_errors(errors, quiet, verbose, log_file_loc=output + '-error.log')
416+
else:
417+
msg = 'No ABOUT file or reference is found from the input. Attribution generation halted.'
418+
click.echo(msg)
414419
sys.exit(1)
415420

416421
if not is_about_input:

src/attributecode/model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,7 @@ def validate_fields(fields, about_file_path, running_inventory, base_dir,
717717
def validate_field_name(name):
718718
if not is_valid_name(name):
719719
msg = ('Field name: %(name)r contains illegal name characters: '
720-
'0 to 9, a to z, A to Z and _. (or empty spaces)')
720+
'0 to 9, a to z, A to Z and _. (or empty spaces) and is ignored.')
721721
return Error(CRITICAL, msg % locals())
722722

723723

tests/test_model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ def test_About_rejects_non_ascii_names_and_accepts_unicode_values(self):
581581
test_file = get_test_loc('test_model/parse/non_ascii_field_name_value.about')
582582
a = model.About(test_file)
583583
expected = [
584-
Error(CRITICAL, "Field name: 'mat\xedas' contains illegal name characters: 0 to 9, a to z, A to Z and _. (or empty spaces)")
584+
Error(CRITICAL, "Field name: 'mat\xedas' contains illegal name characters: 0 to 9, a to z, A to Z and _. (or empty spaces) and is ignored.")
585585
]
586586
assert expected == a.errors
587587

0 commit comments

Comments
 (0)