Skip to content

Commit

Permalink
processors/awesome_lint: make the list of required fields/attributes …
Browse files Browse the repository at this point in the history
…for `platforms` configurable

- through `platforms_required_fields` module option (default to `['description']`)
  • Loading branch information
nodiscc committed Nov 30, 2023
1 parent 639cfa5 commit 9275310
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/).

#### [v1.2.3](https://github.com/nodiscc/hecat/releases/tag/1.2.3) - UNRELEASED

**Added:**
- processors/awesome_lint: make the list of required fields/attributes for `platforms` configurable through `platforms_required_fields` module option (default to `['description']`)

**Changed:**
- processors/awesome_lint: check that `depends_3rdparty` is a valid boolean value (`true/false/True/False`)

Expand Down
6 changes: 4 additions & 2 deletions hecat/processors/awesome_lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
- https://github.com/abrenaut/posio # simple/no maintenance required
- https://github.com/knrdl/bicimon # simple/no maintenance required
- https://github.com/Kshitij-Banerjee/Cubiks-2048 # simple/no maintenance required
platforms_required_fields: ['description'] # (optional, default ['description']) attributes that must be defined for all platforms
source_directory: path to directory where data can be found. Directory structure:
Expand Down Expand Up @@ -48,7 +49,6 @@
SOFTWARE_REQUIRED_FIELDS = ['description', 'website_url', 'source_code_url', 'licenses', 'tags']
SOFTWARE_REQUIRED_LISTS = ['licenses', 'tags']
TAGS_REQUIRED_FIELDS = ['description']
PLATFORMS_REQUIRED_FIELDS = ['description']
LICENSES_REQUIRED_FIELDS= ['identifier', 'name', 'url']

def check_required_fields(item, errors, required_fields=[], required_lists=[], severity=logging.error):
Expand Down Expand Up @@ -209,6 +209,8 @@ def awesome_lint(step):
step['module_options']['licenses_files'] = ['/licenses.yml']
if 'last_updated_skip' not in step['module_options']:
step['module_options']['last_updated_skip'] = []
if 'platforms_required_fields' not in step['module_options']:
step['module_options']['platforms_required_fields'] = ['description']
licenses_list = []
for filename in step['module_options']['licenses_files']:
licenses_list = licenses_list + load_yaml_data(step['module_options']['source_directory'] + '/' + filename)
Expand All @@ -224,7 +226,7 @@ def awesome_lint(step):
check_required_fields(tag, errors, required_fields=TAGS_REQUIRED_FIELDS, severity=logging.warning)
check_tag_has_at_least_items(tag, software_list, tags_with_redirect, errors, min_items=3)
for platform in platforms_list:
check_required_fields(platform, errors, required_fields=PLATFORMS_REQUIRED_FIELDS)
check_required_fields(platform, errors, required_fields=step['module_options']['platforms_required_fields'])
for software in software_list:
check_required_fields(software, errors, required_fields=SOFTWARE_REQUIRED_FIELDS, required_lists=SOFTWARE_REQUIRED_LISTS)
check_description_syntax(software, errors)
Expand Down

0 comments on commit 9275310

Please sign in to comment.