Example #1
0
	def display_report(self, src_code, index):
		try:
			file_data = fileparser.get_file_data_from_content("cleanjs", src_code)

			result = reviewer.review(file_data, working_dir=os.getcwd() + os.sep + "cleanjs")

			message_bag = result.message_bag
			rating = result.rate

			lines = file_data.lines.all_lines
			file_lines = []
			for line in lines:
				messages = message_bag.get_messages_on_line(line.line_number)
				file_lines.append({"messages": messages, "message_count": len(messages), "line": line})
		
			reportdb.add_file_to_global_stats(src_code, file_data, rating, message_bag)

			self.writeTemplateToResponse("report.html", {
				"bag" : message_bag,
				"lines" : file_lines,
				"rating": rating,
				"pb64": pb64.encodeB64Padless(index),
				"nb_total_lines": len(lines),
				"nb_code_lines": len(file_data.lines.get_code_lines()),
				"nb_comments_lines": len(file_data.lines.get_comments_lines())
			})
		except Exception as error:
			self.writeTemplateToResponse("error.html", {"error": error})
Example #2
0
	def post(self):
		src_code = self.request.get('code')
		src_code = unicodedata.normalize('NFKD', src_code).encode('ascii','ignore')
		
		if src_code == "":
			self.redirect("/")
		else:
			index = self.store_file(src_code)
			self.redirect("/" + pb64.encodeB64Padless(index))
Example #3
0
    def post(self):
        src_code = self.request.get('code')
        src_code = unicodedata.normalize('NFKD',
                                         src_code).encode('ascii', 'ignore')

        if src_code == "":
            self.redirect("/")
        else:
            index = self.store_file(src_code)
            self.redirect("/" + pb64.encodeB64Padless(index))
Example #4
0
    def display_report(self, src_code, index):
        try:
            file_data = fileparser.get_file_data_from_content(
                "cleanjs", src_code)

            result = reviewer.review(file_data,
                                     working_dir=os.getcwd() + os.sep +
                                     "cleanjs")

            message_bag = result.message_bag
            rating = result.rate

            lines = file_data.lines.all_lines
            file_lines = []
            for line in lines:
                messages = message_bag.get_messages_on_line(line.line_number)
                file_lines.append({
                    "messages": messages,
                    "message_count": len(messages),
                    "line": line
                })

            reportdb.add_file_to_global_stats(src_code, file_data, rating,
                                              message_bag)

            self.writeTemplateToResponse(
                "report.html", {
                    "bag": message_bag,
                    "lines": file_lines,
                    "rating": rating,
                    "pb64": pb64.encodeB64Padless(index),
                    "nb_total_lines": len(lines),
                    "nb_code_lines": len(file_data.lines.get_code_lines()),
                    "nb_comments_lines": len(
                        file_data.lines.get_comments_lines())
                })
        except Exception as error:
            self.writeTemplateToResponse("error.html", {"error": error})
Example #5
0
	def get(self, id):
		self.redirect("/" + pb64.encodeB64Padless(id))
Example #6
0
 def get(self, id):
     self.redirect("/" + pb64.encodeB64Padless(id))