aboutcode-org / aboutcode-org/license-expression

Convert regular exceptions into ExpressionError

Đang mở
#97 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
73
Fork
33
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

I currently try to run validation of SPDX expression from arbitrary inputs. If something is wrong with the expression, I would have expected it to always populate the `errors` attribute instead of raising exceptions. Apparently, this is not the case in every situation.

Let's consider the following snippet:

```python3
from license_expression import get_spdx_licensing

licensing = get_spdx_licensing()
expression = '(Apache-2.0) AND ()'
result = licensing.validate(expression)
print(result.errors)
```

This fails with an *IndexError* during validation:

```
[...]
File "/home/user/lib/python3.9/site-packages/license_expression/__init__.py", line 778, in validate
parsed_expression = self.parse(expression, strict=strict)
File "/home/user/lib/python3.9/site-packages/license_expression/__init__.py", line 545, in parse
expression = super(Licensing, self).parse(tokens)
File "/home/user/lib/python3.9/site-packages/boolean/boolean.py", line 316, in parse
ast[0].append(ast[2])
IndexError: list index out of range
```

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.