コード例 #1
0
ファイル: de_varscoper.py プロジェクト: exil/de_coldfusion
    def __parseXmlResult(self, xmlResult):
        result = de_util.getResultObject()

        try:
            xmlDoc = minidom.parseString(xmlResult)

            functionNodes = xmlDoc.getElementsByTagName("function")

            for fNode in functionNodes:
                fName = fNode.getAttribute("name")
                fDetail = fNode.firstChild

                fVariable = fDetail.getElementsByTagName(
                    "type")[0].firstChild.nodeValue
                fLineNumber = fDetail.getElementsByTagName(
                    "line_number")[0].firstChild.nodeValue

                errorText = "Function [ %s ] :: Variable [ %s ] " % (fName,
                                                                     fVariable)
                errorCaption = "Varscoper :: %s " % (fLineNumber)

                result["errors"].append(
                    de_util.returnErrorArray(errorCaption, errorText))
                result["regions"].append(
                    self.baseLinter.getRegion(fLineNumber))

        except Exception as e:
            de_util.log("Error parsing xml results :: " + str(e))

        return result
コード例 #2
0
ファイル: de_varscoper.py プロジェクト: exil/de_coldfusion
	def __parseXmlResult(self, xmlResult):
		result = de_util.getResultObject()

		try:
			xmlDoc = minidom.parseString(xmlResult)

			functionNodes =xmlDoc.getElementsByTagName("function")

			for fNode in functionNodes:
				fName = fNode.getAttribute("name")
				fDetail = fNode.firstChild

				fVariable = fDetail.getElementsByTagName("type")[0].firstChild.nodeValue
				fLineNumber = fDetail.getElementsByTagName("line_number")[0].firstChild.nodeValue
				
				errorText = "Function [ %s ] :: Variable [ %s ] " % (fName, fVariable)
				errorCaption = "Varscoper :: %s " % (fLineNumber)

				result["errors"].append(de_util.returnErrorArray(errorCaption, errorText))
				result["regions"].append(self.baseLinter.getRegion(fLineNumber))

		except Exception as e:
			de_util.log("Error parsing xml results :: " + str(e))

		return result
コード例 #3
0
ファイル: de_linter.py プロジェクト: exil/de_coldfusion
	def __getErrorResults(self, linters):
		result = de_util.getResultObject()

		for linter, value in linters.iteritems():
			errorResult = self.__getLinterResult(linter, value)

			if errorResult is not None:
				result = de_util.mergeResults(result, errorResult)

		return result
コード例 #4
0
ファイル: de_linter.py プロジェクト: exil/de_coldfusion
    def __getErrorResults(self, linters):
        result = de_util.getResultObject()

        for linter, value in linters.iteritems():
            errorResult = self.__getLinterResult(linter, value)

            if errorResult is not None:
                result = de_util.mergeResults(result, errorResult)

        return result
コード例 #5
0
ファイル: de_standard.py プロジェクト: exil/de_coldfusion
	def getResult(self, view):
		self.view = view
		self.baseLinter = de_base.LinterBase(view)

		errorResult = de_util.getResultObject()
		options = de_util.getSettings("de_standard_options")

		for option, value in options.iteritems():
			optionResult = self.__getOptionResult(option, value)

			if optionResult is not None:
				errorResult = de_util.mergeResults(errorResult, optionResult)

		return errorResult
コード例 #6
0
ファイル: de_standard.py プロジェクト: exil/de_coldfusion
    def getResult(self, view):
        self.view = view
        self.baseLinter = de_base.LinterBase(view)

        errorResult = de_util.getResultObject()
        options = de_util.getSettings("de_standard_options")

        for option, value in options.iteritems():
            optionResult = self.__getOptionResult(option, value)

            if optionResult is not None:
                errorResult = de_util.mergeResults(errorResult, optionResult)

        return errorResult
コード例 #7
0
ファイル: de_standard.py プロジェクト: exil/de_coldfusion
	def __getErrors(self, regex=None, errorText=None, selections=None):
		if selections is None:
			selections = self.view.find_all(regex, sublime.IGNORECASE)

		errorResult = None

		if selections:
			errorResult = de_util.getResultObject()
			errorResult["regions"] = selections

			for region in selections:
				lineNumber = self.baseLinter.getLineNumber(region)
				errorCaption = "DE Standard :: %+5s " % (str(lineNumber))

				errorResult["errors"].append(de_util.returnErrorArray(errorCaption, errorText))

		return errorResult
コード例 #8
0
ファイル: de_standard.py プロジェクト: exil/de_coldfusion
	def __checkCloseExpressionTag(self):
		expressionTags = constants.CF_EXPRESSION_TAGS.split(",")
		result = None

		if expressionTags:
			result = de_util.getResultObject()

			for tag in expressionTags:
				tagResult1 = self.__getErrors(regex="<" + tag + ".*[^\/-]>", errorText=constants.STANDARD_CLOSING_TAG_MSG)
				tagResult2 = self.__getErrors(regex="<" + tag + ".*((\s{2,})\/>|([^\s])\/>)", errorText=constants.STANDARD_CLOSING_TAG_MSG)
				
				if tagResult1 is not None:
					result = de_util.mergeResults(result, tagResult1)

				if tagResult2 is not None:
					result = de_util.mergeResults(result, tagResult2)

		return result
コード例 #9
0
ファイル: de_standard.py プロジェクト: exil/de_coldfusion
    def __getErrors(self, regex=None, errorText=None, selections=None):
        if selections is None:
            selections = self.view.find_all(regex, sublime.IGNORECASE)

        errorResult = None

        if selections:
            errorResult = de_util.getResultObject()
            errorResult["regions"] = selections

            for region in selections:
                lineNumber = self.baseLinter.getLineNumber(region)
                errorCaption = "DE Standard :: %+5s " % (str(lineNumber))

                errorResult["errors"].append(
                    de_util.returnErrorArray(errorCaption, errorText))

        return errorResult
コード例 #10
0
ファイル: de_standard.py プロジェクト: exil/de_coldfusion
    def __checkCloseExpressionTag(self):
        expressionTags = constants.CF_EXPRESSION_TAGS.split(",")
        result = None

        if expressionTags:
            result = de_util.getResultObject()

            for tag in expressionTags:
                tagResult1 = self.__getErrors(
                    regex="<" + tag + ".*[^\/-]>",
                    errorText=constants.STANDARD_CLOSING_TAG_MSG)
                tagResult2 = self.__getErrors(
                    regex="<" + tag + ".*((\s{2,})\/>|([^\s])\/>)",
                    errorText=constants.STANDARD_CLOSING_TAG_MSG)

                if tagResult1 is not None:
                    result = de_util.mergeResults(result, tagResult1)

                if tagResult2 is not None:
                    result = de_util.mergeResults(result, tagResult2)

        return result