Opened 14 years ago
Closed 9 years ago
#2571 closed enhancement (wontfix)
[patch] [ccla] syntax checking feature
Reported by: | Owned by: | James Burke | |
---|---|---|---|
Priority: | low | Milestone: | future |
Component: | Core | Version: | 0.9 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description (last modified by )
Alter dojo.require() so that when code is pulled in from sources, we verify it against a syntax checker.. the beauty is then, your code STAYS clean because everytime you run it, it will get mad if you write bad syntax like I do. This is only true if you load dojo.syntax.*. Uses jslint.com's syntax checker currently. Other checkers could be used, but no others are supported currently.
it will only start checking after you have dojo.syntax.* loaded.
features:
allow stopping on error, or just warning on error. djConfig.syntaxWarn? Follow dojo JS guidelines as much as possible. allow it to skip dojo srcs, and only get upset with stuff in your custom namespace.
current implementation at: http://www.yuma.ca/tech/js/dojo/src/syntax/
demo/testcase: http://www.yuma.ca/tech/js/testsyntax.html
Attachments (2)
Change History (17)
Changed 14 years ago by
Attachment: | syntax.diff added |
---|
comment:1 Changed 14 years ago by
csawyer: sorry for not taking a look sooner at this. I've been busy with 0.9 changes and work. I won't be dealing with this patch soon, but some comments:
You don't need loader enhancements to plug this in. You can override dojo.hostenv.getText(), and look at the file extension. If it ends in .js, run it through the syntax checker before returning the value. Something like:
{{{{ dojo.syntax._realGetText = dojo.hostenv.getText; dojo.syntax.getText = function(uri, async_cb, fail_ok){
var contents = dojo.syntax._realGetText.apply(this.hostenv, arguments); if(contents && /*do checking for if syntax is loaded and is a .js file*/){
Do syntax checking in here.
} return contents;
} dojo.hostenv.getText = dojo.syntax.getText; }}}
Since dojo.syntax is always included after the real getText() is defined, this should work out, and allow the module to stand on its own.
comment:3 Changed 14 years ago by
Find a new attachment that brings syntax checking hopefully up to par. I got the idea jburke, thank you!
This changes a lot in the checker as well, plus overrides getText.
comment:4 Changed 14 years ago by
Milestone: | 0.9beta → 0.9 |
---|
we can't hold up beta for this. Moving to 0.9
comment:5 Changed 14 years ago by
This needs to go in dojox, due to external packages and varying licenses. Seems like the right place for it anyhow. I suppose the issue then is just getting the right hook for dojo.require()? It would be neat if we could use an aspect-oriented approach rather than hacking up dojo.require. Can we use after advice and resurrect the path from the return value of require()?
I suggest we resolve that issue then get an updated patch for dojox. Probably shouldn't be a 0.9 deliverable at this point.
comment:6 Changed 14 years ago by
peller: I agree. I've been talking with Tom about the right place for this in dojox. I was keeping it as a 0.9 issue for now, because I feel bad about letting a patch sit this long. But I agree, if I run out of time (which seems likely), I can push to 1.0.
comment:7 Changed 14 years ago by
Milestone: | 0.9 → 1.0 |
---|
I wanted to get this in for 0.9, but I'm not going to make it. Sorry to hold this off for so long.
comment:8 Changed 14 years ago by
Cathy, sorry to ask you this after us all waiting so long, but would you be interested in helping us get this updated to 1.0 APIs and experimenting with solutions for the dojo.require hooks/AOP?
comment:10 Changed 13 years ago by
Milestone: | 1.0 → 2.0 |
---|
comment:12 Changed 12 years ago by
Description: | modified (diff) |
---|---|
Milestone: | 1.3 → future |
comment:13 Changed 9 years ago by
Keywords: | needsreview added |
---|---|
Priority: | high → low |
is this still relevant?
comment:14 Changed 9 years ago by
Not sure what "relevant" means in this case but I'd vote to just close as wontfix. I don't think we want to include all this "dojo.syntax" code into core, both for licensing and other reasons. If there is still interest in this maybe it would be a good project to add to github and register in packages.dojotoolkit.org?
comment:15 Changed 9 years ago by
Keywords: | needsreview removed |
---|---|
Resolution: | → wontfix |
Status: | new → closed |
Agreed.
patch of demo implementation.