##// END OF EJS Templates
hgweb: add .jshintrc with some basic rules...
av6 -
r35163:bdd2e18b default
parent child Browse files
Show More
@@ -0,0 +1,11
1 {
2 // Enforcing
3 "eqeqeq" : true, // true: Require triple equals (===) for comparison
4 "forin" : true, // true: Require filtering for..in loops with obj.hasOwnProperty()
5 "freeze" : true, // true: prohibits overwriting prototypes of native objects such as Array, Date etc.
6 "nonbsp" : true, // true: Prohibit "non-breaking whitespace" characters.
7 "undef" : true, // true: Require all non-global variables to be declared (prevents global leaks)
8
9 // Environments
10 "browser" : true // Web Browser (window, document, etc)
11 }
@@ -1,55 +1,56
1 #require test-repo
1 #require test-repo
2
2
3 $ . "$TESTDIR/helpers-testrepo.sh"
3 $ . "$TESTDIR/helpers-testrepo.sh"
4 $ check_code="$TESTDIR"/../contrib/check-code.py
4 $ check_code="$TESTDIR"/../contrib/check-code.py
5 $ cd "$TESTDIR"/..
5 $ cd "$TESTDIR"/..
6
6
7 New errors are not allowed. Warnings are strongly discouraged.
7 New errors are not allowed. Warnings are strongly discouraged.
8 (The writing "no-che?k-code" is for not skipping this file when checking.)
8 (The writing "no-che?k-code" is for not skipping this file when checking.)
9
9
10 $ testrepohg locate \
10 $ testrepohg locate \
11 > -X contrib/python-zstandard \
11 > -X contrib/python-zstandard \
12 > -X hgext/fsmonitor/pywatchman \
12 > -X hgext/fsmonitor/pywatchman \
13 > -X mercurial/thirdparty \
13 > -X mercurial/thirdparty \
14 > | sed 's-\\-/-g' | "$check_code" --warnings --per-file=0 - || false
14 > | sed 's-\\-/-g' | "$check_code" --warnings --per-file=0 - || false
15 Skipping i18n/polib.py it has no-che?k-code (glob)
15 Skipping i18n/polib.py it has no-che?k-code (glob)
16 Skipping mercurial/httpclient/__init__.py it has no-che?k-code (glob)
16 Skipping mercurial/httpclient/__init__.py it has no-che?k-code (glob)
17 Skipping mercurial/httpclient/_readers.py it has no-che?k-code (glob)
17 Skipping mercurial/httpclient/_readers.py it has no-che?k-code (glob)
18 Skipping mercurial/selectors2.py it has no-che?k-code (glob)
18 Skipping mercurial/selectors2.py it has no-che?k-code (glob)
19 Skipping mercurial/statprof.py it has no-che?k-code (glob)
19 Skipping mercurial/statprof.py it has no-che?k-code (glob)
20 Skipping tests/badserverext.py it has no-che?k-code (glob)
20 Skipping tests/badserverext.py it has no-che?k-code (glob)
21
21
22 @commands in debugcommands.py should be in alphabetical order.
22 @commands in debugcommands.py should be in alphabetical order.
23
23
24 >>> import re
24 >>> import re
25 >>> commands = []
25 >>> commands = []
26 >>> with open('mercurial/debugcommands.py', 'rb') as fh:
26 >>> with open('mercurial/debugcommands.py', 'rb') as fh:
27 ... for line in fh:
27 ... for line in fh:
28 ... m = re.match("^@command\('([a-z]+)", line)
28 ... m = re.match("^@command\('([a-z]+)", line)
29 ... if m:
29 ... if m:
30 ... commands.append(m.group(1))
30 ... commands.append(m.group(1))
31 >>> scommands = list(sorted(commands))
31 >>> scommands = list(sorted(commands))
32 >>> for i, command in enumerate(scommands):
32 >>> for i, command in enumerate(scommands):
33 ... if command != commands[i]:
33 ... if command != commands[i]:
34 ... print('commands in debugcommands.py not sorted; first differing '
34 ... print('commands in debugcommands.py not sorted; first differing '
35 ... 'command is %s; expected %s' % (commands[i], command))
35 ... 'command is %s; expected %s' % (commands[i], command))
36 ... break
36 ... break
37
37
38 Prevent adding new files in the root directory accidentally.
38 Prevent adding new files in the root directory accidentally.
39
39
40 $ testrepohg files 'glob:*'
40 $ testrepohg files 'glob:*'
41 .arcconfig
41 .arcconfig
42 .clang-format
42 .clang-format
43 .editorconfig
43 .editorconfig
44 .hgignore
44 .hgignore
45 .hgsigs
45 .hgsigs
46 .hgtags
46 .hgtags
47 .jshintrc
47 CONTRIBUTING
48 CONTRIBUTING
48 CONTRIBUTORS
49 CONTRIBUTORS
49 COPYING
50 COPYING
50 Makefile
51 Makefile
51 README.rst
52 README.rst
52 hg
53 hg
53 hgeditor
54 hgeditor
54 hgweb.cgi
55 hgweb.cgi
55 setup.py
56 setup.py
General Comments 0
You need to be logged in to leave comments. Login now