Skip to content

Conversation

@christophebedard
Copy link
Contributor

@christophebedard christophebedard commented Mar 26, 2023

Fixes #255

The parsing code (get_repos_in_vcstool_format()) already provides a useful error message when an attribute is missing (e.g., url:). However, as shown in the issue above, it doesn't handle/detect empty repository entries. Therefore, check if the repository is empty before trying to access its attributes. Otherwise, provide a useful error message:

$ cat bad.repos
repositories:
  empty_entry:
  missing_url:
    type: git
$ vcs validate --input bad.repos 
Repository 'empty_entry' is empty
Repository 'missing_url' does not provide the necessary information: 'url'

Before this change, validation fails on empty_entry (and does not validate missing_url):

$ vcs validate --input bad.repos 
Input data is not valid format: 'NoneType' object is not subscriptable

I've also updated the tests to cover this.

@caioaamaral
Copy link

friendly ping @dirk-thomas

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bad non-descriptive error message 'NoneType' object is not subscriptable

2 participants