forked from qt-creator/qt-creator
Squish: Fix warnings
Warnings from static code checks, that is, not test.warning() at runtime. Change-Id: I651d13491106583908059ecdb5f700f539b6d9c8 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -37,7 +37,7 @@ def getBuildIssues():
|
||||
def checkLastBuild(expectedToFail=False, createTasksFileOnError=True):
|
||||
try:
|
||||
# can't use waitForObject() 'cause visible is always 0
|
||||
buildProg = findObject("{type='ProjectExplorer::Internal::BuildProgress' unnamed='1' }")
|
||||
findObject("{type='ProjectExplorer::Internal::BuildProgress' unnamed='1' }")
|
||||
except LookupError:
|
||||
test.log("checkLastBuild called without a build")
|
||||
return
|
||||
|
@@ -24,7 +24,6 @@
|
||||
############################################################################
|
||||
|
||||
import __builtin__
|
||||
import operator
|
||||
|
||||
# for easier re-usage (because Python hasn't an enum type)
|
||||
class Targets:
|
||||
|
@@ -23,8 +23,6 @@
|
||||
#
|
||||
############################################################################
|
||||
|
||||
import re
|
||||
|
||||
def handleDebuggerWarnings(config, isMsvcBuild=False):
|
||||
if isMsvcBuild:
|
||||
try:
|
||||
@@ -71,8 +69,8 @@ def setBreakpointsForCurrentProject(filesAndLines):
|
||||
if not filesAndLines or not isinstance(filesAndLines, (list,tuple)):
|
||||
test.fatal("This function only takes a non-empty list/tuple holding dicts.")
|
||||
return False
|
||||
navTree = waitForObject("{type='Utils::NavigationTreeView' unnamed='1' visible='1' "
|
||||
"window=':Qt Creator_Core::Internal::MainWindow'}")
|
||||
waitForObject("{type='Utils::NavigationTreeView' unnamed='1' visible='1' "
|
||||
"window=':Qt Creator_Core::Internal::MainWindow'}")
|
||||
for current in filesAndLines:
|
||||
for curFile,curLine in current.iteritems():
|
||||
if not openDocument(curFile):
|
||||
|
@@ -106,7 +106,7 @@ def openContextMenuOnTextCursorPosition(editor):
|
||||
# param direction is one of "Left", "Right", "Up", "Down", but "End" and combinations work as well
|
||||
# param typeCount defines how often the cursor will be moved in the given direction (while marking)
|
||||
def markText(editor, direction, typeCount=1):
|
||||
for i in range(typeCount):
|
||||
for _ in range(typeCount):
|
||||
type(editor, "<Shift+%s>" % direction)
|
||||
|
||||
# works for all standard editors
|
||||
@@ -173,7 +173,7 @@ def verifyHoveringOnEditor(editor, lines, additionalKeyPresses, expectedTypes, e
|
||||
# param expectedVals a dict holding property value pairs that must match
|
||||
def __handleTextTips__(textTip, expectedVals, alternativeVals):
|
||||
props = object.properties(textTip)
|
||||
expFail = altFail = False
|
||||
expFail = False
|
||||
eResult = verifyProperties(props, expectedVals)
|
||||
for val in eResult.itervalues():
|
||||
if not val:
|
||||
@@ -182,7 +182,6 @@ def __handleTextTips__(textTip, expectedVals, alternativeVals):
|
||||
if expFail and alternativeVals != None:
|
||||
aResult = verifyProperties(props, alternativeVals)
|
||||
else:
|
||||
altFail = True
|
||||
aResult = None
|
||||
if not expFail:
|
||||
test.passes("TextTip verified")
|
||||
@@ -360,7 +359,7 @@ def invokeContextMenuItem(editorArea, command1, command2 = None):
|
||||
def invokeFindUsage(editor, line, typeOperation, n=1):
|
||||
if not placeCursorToLine(editor, line, True):
|
||||
return False
|
||||
for i in range(n):
|
||||
for _ in range(n):
|
||||
type(editor, typeOperation)
|
||||
snooze(1)
|
||||
invokeContextMenuItem(editor, "Find Usages")
|
||||
|
@@ -42,7 +42,7 @@ def switchViewTo(view):
|
||||
text = ""
|
||||
pattern = ViewConstants.getToolTipForViewTab(view)
|
||||
if re.match(pattern, unicode(text), re.UNICODE):
|
||||
test.passes("ToolTip verified")
|
||||
test.passes("ToolTip verified")
|
||||
else:
|
||||
test.warning("ToolTip does not match", "Expected pattern: %s\nGot: %s" % (pattern, text))
|
||||
mouseClick(waitForObject("{type='Core::Internal::FancyTabBar' unnamed='1' visible='1' "
|
||||
@@ -158,7 +158,7 @@ def addAndActivateKit(kit):
|
||||
kitString = Targets.getStringForTarget(kit)
|
||||
switchViewTo(ViewConstants.PROJECTS)
|
||||
try:
|
||||
treeView = waitForObject(":Projects.ProjectNavigationTreeView")
|
||||
waitForObject(":Projects.ProjectNavigationTreeView")
|
||||
wanted = getQModelIndexStr("text='%s'" % kitString, bAndRIndex)
|
||||
index = findObject(wanted)
|
||||
if str(index.toolTip).startswith(clickToActivate):
|
||||
|
@@ -458,7 +458,7 @@ def iterateQtVersions(keepOptionsOpen=False, alreadyOnOptionsDialog=False,
|
||||
currResult = additionalFunction(target, version, *argsForAdditionalFunc)
|
||||
except:
|
||||
import sys
|
||||
t,v,tb = sys.exc_info()
|
||||
t,v,_ = sys.exc_info()
|
||||
currResult = None
|
||||
test.fatal("Function to additionally execute on Options Dialog could not be found or "
|
||||
"an exception occurred while executing it.", "%s(%s)" % (str(t), str(v)))
|
||||
@@ -521,7 +521,7 @@ def iterateKits(keepOptionsOpen=False, alreadyOnOptionsDialog=False,
|
||||
currResult = additionalFunction(item, kitName, *argsForAdditionalFunc)
|
||||
except:
|
||||
import sys
|
||||
t,v,tb = sys.exc_info()
|
||||
t,v,_ = sys.exc_info()
|
||||
currResult = None
|
||||
test.fatal("Function to additionally execute on Options Dialog could not be "
|
||||
"found or an exception occurred while executing it.", "%s(%s)" %
|
||||
|
@@ -98,7 +98,7 @@ def main():
|
||||
test.fail("Could not open %s.h - continuing." % className.lower())
|
||||
continue
|
||||
editor = getEditorForFileSuffix("%s.h" % className.lower())
|
||||
oldContent = str(editor.plainText)
|
||||
str(editor.plainText)
|
||||
placeCursorToLine(editor, "class %s.*" % className, True)
|
||||
snooze(4) # avoid timing issue with the parser
|
||||
invokeContextMenuItem(editor, "Refactor", "Insert Virtual Functions of Base Classes")
|
||||
|
@@ -70,7 +70,7 @@ def main():
|
||||
openDocument("openglwindow.Sources.main\\.cpp")
|
||||
if not placeCursorToLine(editorWidget, 'm_posAttr = m_program->attributeLocation("posAttr");'):
|
||||
return
|
||||
for i in range(13):
|
||||
for _ in range(13):
|
||||
type(editorWidget, "<Left>")
|
||||
type(editorWidget, "<Ctrl+Shift+u>")
|
||||
# wait until search finished and verify search results
|
||||
|
@@ -76,7 +76,7 @@ def main():
|
||||
# select some other word in .cpp file and select "Edit" -> "Find/Replace".
|
||||
clickButton(waitForObject(":Qt Creator.CloseFind_QToolButton"))
|
||||
placeCursorToLine(editorWidget, "void Trianglefind::render()")
|
||||
for i in range(10):
|
||||
for _ in range(10):
|
||||
type(editorWidget, "<Left>")
|
||||
markText(editorWidget, "Left", 12)
|
||||
invokeMenuItem("Edit", "Find/Replace", "Find/Replace")
|
||||
|
@@ -107,7 +107,7 @@ def main():
|
||||
checkIfObjectExists(manualQModelIndex, verboseOnFail = True),
|
||||
"Verifying if all folders and bookmarks are present")
|
||||
mouseClick(waitForObject(":Qt Creator_Bookmarks_TreeView"), 5, 5, 0, Qt.LeftButton)
|
||||
for i in range(6):
|
||||
for _ in range(6):
|
||||
type(waitForObject(":Qt Creator_Bookmarks_TreeView"), "<Right>")
|
||||
type(waitForObject(":Qt Creator_Bookmarks_TreeView"), "<Return>")
|
||||
test.verify(textForQtVersion("Building and Running an Example") in getHelpTitle(),
|
||||
|
@@ -48,7 +48,7 @@ def main():
|
||||
"Verifying if error is properly reported")
|
||||
# repair error - go to written line
|
||||
placeCursorToLine(editorArea, testingCodeLine)
|
||||
for i in range(14):
|
||||
for _ in range(14):
|
||||
type(editorArea, "<Left>")
|
||||
markText(editorArea, "Right")
|
||||
type(editorArea, "c")
|
||||
|
@@ -90,7 +90,7 @@ def main():
|
||||
if not placeCursorToLine(editorArea, "Rectangle {"):
|
||||
invokeMenuItem("File", "Exit")
|
||||
return
|
||||
for i in range(5):
|
||||
for _ in range(5):
|
||||
type(editorArea, "<Left>")
|
||||
invokeContextMenuItem(editorArea, "Find Usages")
|
||||
# check if usage was properly found
|
||||
@@ -109,7 +109,7 @@ def main():
|
||||
if not placeCursorToLine(editorArea, "anchors { left: parent.left; top: parent.top; right: parent.right; bottom: parent.verticalCenter }"):
|
||||
invokeMenuItem("File", "Exit")
|
||||
return
|
||||
for i in range(87):
|
||||
for _ in range(87):
|
||||
type(editorArea, "<Left>")
|
||||
invokeMenuItem("Tools", "QML/JS", "Find Usages")
|
||||
# check if usage was properly found
|
||||
@@ -128,7 +128,7 @@ def main():
|
||||
if not placeCursorToLine(editorArea, "SequentialAnimation on opacity {"):
|
||||
invokeMenuItem("File", "Exit")
|
||||
return
|
||||
for i in range(5):
|
||||
for _ in range(5):
|
||||
type(editorArea, "<Left>")
|
||||
type(editorArea, "<Ctrl+Shift+u>")
|
||||
# check if usage was properly found
|
||||
|
@@ -37,7 +37,7 @@ def main():
|
||||
saveAndExit()
|
||||
return
|
||||
placeCursorToLine(editorArea, "TextEdit {")
|
||||
for i in range(5):
|
||||
for _ in range(5):
|
||||
type(editorArea, "<Left>")
|
||||
# invoke Refactoring - Move Component into separate file
|
||||
invokeContextMenuItem(editorArea, "Refactoring", "Move Component into Separate File")
|
||||
|
@@ -32,13 +32,13 @@ def main():
|
||||
homeKey = "<Home>"
|
||||
if platform.system() == "Darwin":
|
||||
homeKey = "<Ctrl+Left>"
|
||||
for i in range(2):
|
||||
for _ in range(2):
|
||||
type(editorArea, homeKey)
|
||||
type(editorArea, "<Return>")
|
||||
type(editorArea, "<Up>")
|
||||
type(editorArea, "<Tab>")
|
||||
type(editorArea, "Item { x: 10; y: 20; width: 10 }")
|
||||
for i in range(30):
|
||||
for _ in range(30):
|
||||
type(editorArea, "<Left>")
|
||||
invokeMenuItem("File", "Save All")
|
||||
# activate menu and apply 'Refactoring - Split initializer'
|
||||
|
@@ -32,14 +32,14 @@ def main():
|
||||
homeKey = "<Home>"
|
||||
if platform.system() == "Darwin":
|
||||
homeKey = "<Ctrl+Left>"
|
||||
for i in range(2):
|
||||
for _ in range(2):
|
||||
type(editorArea, homeKey)
|
||||
type(editorArea, "<Return>")
|
||||
type(editorArea, "<Up>")
|
||||
type(editorArea, "<Tab>")
|
||||
testingItemText = "Item { x: 10; y: 20; width: 10 }"
|
||||
type(editorArea, testingItemText)
|
||||
for i in range(30):
|
||||
for _ in range(30):
|
||||
type(editorArea, "<Left>")
|
||||
invokeMenuItem("File", "Save All")
|
||||
# invoke Refactoring - Wrap Component in Loader
|
||||
|
@@ -31,7 +31,7 @@ def main():
|
||||
return
|
||||
type(editorArea, "<Return>")
|
||||
type(editorArea, "Color")
|
||||
for i in range(3):
|
||||
for _ in range(3):
|
||||
type(editorArea, "<Left>")
|
||||
invokeMenuItem("File", "Save All")
|
||||
# invoke Refactoring - Add a message suppression comment.
|
||||
|
@@ -71,7 +71,7 @@ def main():
|
||||
return
|
||||
# cancel indentation
|
||||
type(editorArea, "<Ctrl+a>")
|
||||
for i in range(5):
|
||||
for _ in range(5):
|
||||
type(editorArea, "<Shift+Backtab>")
|
||||
# select unindented block
|
||||
type(editorArea, "<Ctrl+a>")
|
||||
|
@@ -68,7 +68,6 @@ def debuggerHasStopped():
|
||||
|
||||
def getQmlJSConsoleOutput():
|
||||
try:
|
||||
result = []
|
||||
consoleView = waitForObject(":DebugModeWidget_Debugger::Internal::ConsoleView")
|
||||
model = consoleView.model()
|
||||
# old input, output, new input > 2
|
||||
@@ -135,7 +134,7 @@ def main():
|
||||
switchViewTo(ViewConstants.EDIT)
|
||||
# start debugging
|
||||
clickButton(fancyDebugButton)
|
||||
locAndExprTV = waitForObject(":Locals and Expressions_Debugger::Internal::WatchTreeView")
|
||||
waitForObject(":Locals and Expressions_Debugger::Internal::WatchTreeView")
|
||||
rootIndex = getQModelIndexStr("text='Rectangle'",
|
||||
":Locals and Expressions_Debugger::Internal::WatchTreeView")
|
||||
# make sure the items inside the root item are visible
|
||||
|
@@ -117,7 +117,7 @@ def fetchItems(index, valIndex, treeView):
|
||||
tree.setName(name)
|
||||
tree.setValue(value)
|
||||
for row in range(model.rowCount(index)):
|
||||
tree.addChild(fetchItems(model.index(row, 0, index), model.index(row, 1, index), treeView))
|
||||
tree.addChild(fetchItems(model.index(row, 0, index), model.index(row, 1, index), treeView))
|
||||
return tree
|
||||
|
||||
def checkForEmptyRows(items, isRootCheck=True):
|
||||
|
@@ -44,7 +44,6 @@ def prepareQmlFile():
|
||||
editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
|
||||
isDarwin = platform.system() == 'Darwin'
|
||||
for i in range(3):
|
||||
content = "%s" % editor.plainText
|
||||
if not placeCursorToLine(editor, 'title: qsTr("Hello World")'):
|
||||
test.fatal("Couldn't find line(s) I'm looking for - QML file seems to "
|
||||
"have changed!\nLeaving test...")
|
||||
|
@@ -118,7 +118,7 @@ def testRenameMacroAfterSourceMoving():
|
||||
return True
|
||||
|
||||
def performMacroRenaming(newMacroName):
|
||||
for i in range(10):
|
||||
for _ in range(10):
|
||||
type(cppEditorStr, "<Left>")
|
||||
invokeContextMenuItem(waitForObject(cppEditorStr), "Refactor",
|
||||
"Rename Symbol Under Cursor")
|
||||
|
@@ -24,7 +24,6 @@
|
||||
############################################################################
|
||||
|
||||
source("../../shared/qtcreator.py")
|
||||
import re
|
||||
|
||||
SpeedCrunchPath = ""
|
||||
|
||||
|
@@ -45,7 +45,6 @@ def main():
|
||||
projects = catModel.index(0, 0)
|
||||
test.compare("Projects", str(projects.data()))
|
||||
comboBox = findObject(":New.comboBox_QComboBox")
|
||||
targets = zip(*kits.values())[0]
|
||||
test.verify(comboBox.enabled, "Verifying whether combobox is enabled.")
|
||||
test.compare(comboBox.currentText, "All Templates")
|
||||
try:
|
||||
|
@@ -26,8 +26,6 @@
|
||||
source("../../shared/qtcreator.py")
|
||||
|
||||
import re
|
||||
import tempfile
|
||||
import __builtin__
|
||||
|
||||
currentSelectedTreeItem = None
|
||||
warningOrError = re.compile('<p><b>((Error|Warning).*?)</p>')
|
||||
|
@@ -139,9 +139,9 @@ def verifyOutline(outlinePseudoTree, datasetFileName):
|
||||
"Found %d elements, but expected %d" % (len(outlinePseudoTree), len(expected)))
|
||||
return
|
||||
for counter, (expectedItem, foundItem) in enumerate(zip(expected, outlinePseudoTree)):
|
||||
if expectedItem != foundItem:
|
||||
test.fail("Mismatch in element number %d for '%s'" % (counter + 1, fileName),
|
||||
if expectedItem != foundItem:
|
||||
test.fail("Mismatch in element number %d for '%s'" % (counter + 1, fileName),
|
||||
"%s != %s" % (str(expectedItem), str(foundItem)))
|
||||
return
|
||||
return
|
||||
test.passes("All nodes (%d) inside outline match expected nodes for '%s'."
|
||||
% (len(expected), fileName))
|
||||
|
@@ -34,7 +34,6 @@ def main():
|
||||
|
||||
for qtVersion, controls in available:
|
||||
targ = [Targets.DESKTOP_5_6_1_DEFAULT]
|
||||
quick = "2.6"
|
||||
# using a temporary directory won't mess up a potentially existing
|
||||
workingDir = tempDir()
|
||||
checkedTargets = createNewQtQuickApplication(workingDir, targets=targ,
|
||||
|
@@ -92,7 +92,7 @@ def __clickCommit__(count):
|
||||
test.fail("Could not find the %d. commit - leaving test" % count)
|
||||
return False
|
||||
placeCursorToLine(gitEditor, line)
|
||||
for i in range(30):
|
||||
for _ in range(30):
|
||||
type(gitEditor, "<Left>")
|
||||
# get the current cursor rectangle which should be positioned on the commit ID
|
||||
rect = gitEditor.cursorRect()
|
||||
@@ -234,7 +234,7 @@ def deleteProject():
|
||||
if os.path.exists(path):
|
||||
try:
|
||||
# Make files in .git writable to remove them
|
||||
for root, dirs, files in os.walk(path):
|
||||
for root, _, files in os.walk(path):
|
||||
for name in files:
|
||||
os.chmod(os.path.join(root, name), stat.S_IWUSR)
|
||||
shutil.rmtree(path)
|
||||
|
Reference in New Issue
Block a user