X-Git-Url: http://nitlanguage.org diff --git a/contrib/pep8analysis/src/pep8analysis_web.nit b/contrib/pep8analysis/src/pep8analysis_web.nit index bb314f1..8b87b3e 100644 --- a/contrib/pep8analysis/src/pep8analysis_web.nit +++ b/contrib/pep8analysis/src/pep8analysis_web.nit @@ -1,3 +1,24 @@ +# This file is part of the pep8analysis project (http://xymus.net/pep8/) +# +# Copyright 2013-2014 Alexis Laferrière +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Web version of the pep8analysis tool +# +# Takes the entire Pep/8 source code as argument and prints out the +# analysis results. The result graph will be sent to the JavaScript function +# `show_graph` with the source of the graph in Graphviz's dot. module pep8analysis_web import emscripten @@ -45,10 +66,17 @@ redef class AnalysisManager print_notes if notes.is_empty then print "Success: Nothing wrong detected" + var of = new StringOStream + cfg.print_dot(of, true) + of.close + show_graph(of.to_s) + # Ready next reset clear end + + fun show_graph(content: String) do "show_graph('{content.escape_to_c}');".run_js end class StringIStream