Skip to content

Commit

Permalink
Improve feature name readability in conformance reports
Browse files Browse the repository at this point in the history
Add feature name processing to remove redundant prefixes and improve
readability in conformance comparison tables. Changes include:

- Remove "HTTPRoute" and "Gateway" prefixes from feature names
- Split camelCase words into space-separated words
- Add process_feature_name() function for consistent text processing
- Update generate_profiles_report() to use processed feature names

This makes the conformance reports easier to read
  • Loading branch information
08volt committed Jan 22, 2025
1 parent bdd64d2 commit ce5c24b
Showing 1 changed file with 20 additions and 1 deletion.
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][a-z]*|$)|[A-Z]{2,}(?=[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

0 comments on commit ce5c24b

Please sign in to comment.