editing JavaScript with Spreadsheet, getting statistics, also XMLrepresentation of Script.

P

pantagruel

Hi,

The company I work for currently has a really bad library of
JavaScripts for its main web-based product (yet surprisingly better
than its competitors), last week I had an idea to modify jslint to
recurse over a filesystem of scripts and output an XML representation
of each scripts errors. I then took that XML documentation of the
errors and combined it with the output of some code I had written to
dump an XML representation of all the JavaScript in the file. Output
looks something like this (fragment follows)

errors:
<document>
<errors count="4">
- <error number="1">
<line>12</line>
<char>25</char>
<reason>Line breaking error ')'.</reason>
<evidence>if(formElement.checked)</evidence>
</error>
....</errors>
<source>
....
<variable>var</variable>
<definition>formItemValue</definition>
<assignment>=</assignment>
<definition>formElement</definition>
<dot>.</dot>
<keyword>value</keyword>
<symbol>;</symbol>
<comment>// form Element lookup</comment>
</source>
</document>

Now the idea of this was to use the XML generated for various things,
generation of graphs showing most common errors, reuse of definitions
etc. As well as to place the XML in an XML database and query over it,
which I have done the initial work of that.

Originally I was going to use the XML to generate StatDataML to feed
to R to do my statistics but then I had the weird idea, hey how about
generating an Excel spreadsheet.

I figured if I did that I could still manage to do the statistics but
other opportunities come up, for example comparing multiple files and
such in the spreadsheet, editing the files from the spreadsheet (not
sure how good idea that is but it may be for controlling a large
library of Scripts that a Spreadsheet may be useful, also because I am
familiar with this strategy for generating XML from Excel)

The structure I have for the spreadsheet so far is:

Worksheet - the set of files in a particular folder, start new sheet
for new folder.

Columns:

Filename Code
Errors Comments


The structure of code is basically each line of code is then entered
in a row of code, for example the following fragment if(columnCount
%7==0) { might be on a row in the code column, in the Errors column
it will say Line: 230, character 29 Error Description: Use '==='
to compare with '0'. Evidence: if (columnCount % 7 == 0) {
and in the Comments column it will say // START A NEW ROW WHEN
NECESSARY

Now I realize that this may all be an example of misusing Excel such
as I tend to hate, but it was quite easy to do so I did it, now that I
look at it it doesn't look that irritating to work with (perhaps
because I am suffering the early stages of Excel derangement syndrome)
so what I would like is some comments on it, problems that one sees,
improvements to structure (hoping comments are more constructive than
you obviously know nothing about programming and you are an idiot that
should die but hey, I can handle those as well)

Also I am wondering if anyone is familiar with any other Excel based
tools for working with JavaScript in a similar manner and how they
work, their design, hard to google that kind of stuff so its easier to
ask people that might know.

Hope this misuse of several technologies at one sitting has not caused
anyone to have a coronary.

Cheers.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top