Skip to content

Commit

Permalink
Merge pull request #71 from candlepin/alikins/830949
Browse files Browse the repository at this point in the history
Alikins/830949
  • Loading branch information
wottop committed Jun 14, 2012
2 parents f86a275 + ee158bb commit 254b8a3
Show file tree
Hide file tree
Showing 3 changed files with 229 additions and 55 deletions.
23 changes: 22 additions & 1 deletion Makefile
Expand Up @@ -32,6 +32,7 @@ RHSMCERTD_FLAGS=`pkg-config --cflags --libs glib-2.0`
PYFILES=`find src/ -name "*.py"`
TESTFILES=`find test/ -name "*.py"`
STYLEFILES=$(PYFILES) $(BIN_FILES)
GLADEFILES=`find src/subscription_manager/gui/data -name "*.glade"`

# note, set STYLETEST to something if you want
# make stylish to check the tests code
Expand Down Expand Up @@ -323,6 +324,24 @@ trailinglint:

whitespacelint: tablint trailinglint

# find widgets used via get_widget
# find widgets used as passed to init of SubscriptionManagerTab,
# find the widgets we actually find in the glade files
# see if any used ones are not defined
find-missing-widgets:
@TMPFILE=`mktemp` || exit 1; \
USED_WIDGETS="used_widgets_make.txt" ||exit 1; \
DEFINED_WIDGETS=`mktemp` ||exit 1; \
perl -n -e "if (/get_widget\([\'|\"](.*?)[\'|\"]\)/) { print(\"\$$1\n\")}" $(STYLEFILES) > $$USED_WIDGETS; \
pcregrep -h -o -M "(?:widgets|widget_names) = \[.*\s*.*?\s*.*\]" $(STYLEFILES) | perl -0 -n -e "my @matches = /[\'|\"](.*?)[\'|\"]/sg ; $$,=\"\n\"; print(@matches);" >> $$USED_WIDGETS; \
perl -n -e "if (/<widget class=\".*?\" id=\"(.*?)\">/) { print(\"\$$1\n\")}" $(GLADEFILES) > $$DEFINED_WIDGETS; \
while read line; do grep -F "$$line" $$DEFINED_WIDGETS > /dev/null ; STAT="$$?"; if [ "$$STAT" -ne "0" ] ; then echo "$$line"; fi; done < $$USED_WIDGETS | tee $$TMPFILE; \
! test -s $$TMPFILE

# look for python string formats that are known to break xgettext
# namely constructs of the forms: _("a" + "b")
# _("a" + \
# "b")
gettext_lint:
@TMPFILE=`mktemp` || exit 1; \
pcregrep -n --color=auto -M "_\(.*[\'|\"].*[\'|\"]\s*\+.*?\s*[\"|\'].*[\"|\'].*\)" $(STYLEFILES) | tee $$TMPFILE; \
Expand All @@ -338,6 +357,8 @@ rpmlint:
rpmlint -f rpmlint.config subscription-manager.spec | grep -v "^.*packages and .* specfiles checked\;" | tee $$TMPFILE; \
! test -s $$TMPFILE

stylish: pyflakes whitespacelint pep8 gettext_lint rpmlint
stylish: find-missing-widgets pyflakes whitespacelint pep8 gettext_lint rpmlint

jenkins: stylish coverage-jenkins


0 comments on commit 254b8a3

Please sign in to comment.