Skip to content

Commit

Permalink
Merge pull request steemit#390 from steemit/388-check-reflect-exit-code
Browse files Browse the repository at this point in the history
Add process exit code to check_reflect.py
  • Loading branch information
Michael Vandeberg authored Sep 15, 2016
2 parents 966da95 + 75d6c7b commit eb08d0b
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 6 deletions.
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ RUN \
./tests/chain_test && \
rm -rf /usr/local/src/steemtest

RUN \
cd /usr/local/src/steem && \
doxygen && \
programs/build_helpers/check_reflect.py

RUN \
cd /usr/local/src/steem && \
cmake \
Expand Down
2 changes: 1 addition & 1 deletion Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -1558,7 +1558,7 @@ EXTRA_SEARCH_MAPPINGS =
# If the GENERATE_LATEX tag is set to YES, doxygen will generate LaTeX output.
# The default value is: YES.

GENERATE_LATEX = YES
GENERATE_LATEX = NO

# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a
# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class account_statistics_plugin : public steemit::app::plugin
};

struct account_stats_bucket_object
: public abstract_object< account_stats_bucket_object >
{
fc::time_point_sec open; ///< Open time of the bucket
uint32_t seconds = 0; ///< Seconds accounted for in the bucket
Expand Down Expand Up @@ -122,6 +123,7 @@ struct account_stats_bucket_object
};

struct account_activity_bucket_object
: public abstract_object< account_activity_bucket_object >
{
fc::time_point_sec open; ///< Open time for the bucket
uint32_t seconds = 0; ///< Seconds accounted for in the bucket
Expand All @@ -132,7 +134,9 @@ struct account_activity_bucket_object

} } // steemit::account_statistics

FC_REFLECT( steemit::account_statistics::account_stats_bucket_object,
FC_REFLECT_DERIVED(
steemit::account_statistics::account_stats_bucket_object,
(graphene::db::object),
(open)
(seconds)
(name)
Expand Down Expand Up @@ -196,3 +200,14 @@ FC_REFLECT( steemit::account_statistics::account_stats_bucket_object,
(total_pow)
(estimated_hashpower)
)

FC_REFLECT_DERIVED(
steemit::account_statistics::account_activity_bucket_object,
(graphene::db::object),

(open)
(seconds)
(active_market_accounts)
(active_forum_accounts)
(active_market_and_forum_accounts)
)
18 changes: 14 additions & 4 deletions programs/build_helpers/check_reflect.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
import json
import os
import re
import sys
import xml.etree.ElementTree as etree

other_issues = []

def process_node(path, node):
"""
if node.tag == "TestCase":
Expand Down Expand Up @@ -81,14 +84,15 @@ def bubble_list(x):
if not (filename.endswith(".cpp") or filename.endswith(".hpp")):
continue
try:
with open( os.path.join(root, filename), "r" ) as f:
with open( os.path.join(root, filename), "r", encoding="utf8" ) as f:
content = f.read()
for m in re_reflect.finditer(content):
cname = m.group(1)
members = bubble_list(m.group(2))
name2members_re[cname] = members
if cname.endswith("_object"):
print("FC_REFLECT on {} should be FC_REFLECT_DERIVED".format(cname))
other_issues.append("FC_REFLECT on {} should be FC_REFLECT_DERIVED".format(cname))
print(other_issues[-1])
for m in re_reflect_derived.finditer(content):
cname = m.group(1)
members = bubble_list(m.group(3))
Expand Down Expand Up @@ -137,6 +141,12 @@ def validate_members(name2members_ref, name2members_test):
for item in error_items:
print(item)

return
return {"ok_items" : ok_items, "ne_items" : ne_items, "error_items" : error_items, "other_issues" : other_issues}

validate_members(name2members_doxygen, name2members_re)
if __name__ == "__main__":
result = validate_members(name2members_doxygen, name2members_re)
if len(result["error_items"]) + len(result["other_issues"]) == 0:
exit_code = 0
else:
exit_code = 1
sys.exit(exit_code)

0 comments on commit eb08d0b

Please sign in to comment.