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

Improve feature name readability in conformance reports #3564

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
21 changes: 20 additions & 1 deletion hack/mkdocs-generate-conformance.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,27 @@
from fnmatch import fnmatch
import glob
import os
import re

log = logging.getLogger('mkdocs')


def process_feature_name(feature):
"""
Process feature names by:
1. Removing HTTPRoute and Gateway prefixes
2. Splitting camelCase into space-separated words
"""
# Remove prefixes
feature = re.sub(r'^(HTTPRoute|Gateway)', '', feature)

# Split camelCase
words = re.findall(r'[A-Z]+(?=[A-Z][a-z]|\d|\W|$)|[A-Z][a-z]+|\d+', feature)

# Join words with spaces and title case each word
return ' '.join(word.title() for word in words)


@plugins.event_priority(100)
def on_pre_build(config, **kwargs):
log.info("generating conformance")
Expand Down Expand Up @@ -114,7 +131,9 @@ def generate_profiles_report(reports, route,version):
for row in http_table.itertuples():
if type(row._4) is list:
for feat in row._4:
http_table.loc[row.Index, feat] = ':white_check_mark:'
# Process feature name before using it as a column
processed_feat = process_feature_name(feat)
http_table.loc[row.Index, processed_feat] = ':white_check_mark:'
http_table = http_table.fillna(':x:')
http_table = http_table.drop(['extended.supportedFeatures'], axis=1)

Expand Down