Commit Graph

301 Commits

Author SHA1 Message Date
Simon Heimberg
11469e2f90 check-code: compile filters when loading 2013-06-08 20:20:14 +02:00
Simon Heimberg
1f8c40a6d5 check-code: compile all patterns on initialisation
They where compiled once for every checked file (when calling finditer).
2013-06-08 20:20:14 +02:00
Simon Heimberg
5fb5cb59f5 check-code: only fix patterns once
The patterns were fixed once for every file. Now only do it once when loading
the file.
2013-06-08 20:20:14 +02:00
Matt Mackall
7446e64692 check-code: add another Windows pathsep rule 2013-05-09 15:22:54 -05:00
Brendan Cully
94ee9d1cb5 tests: check path separator in moves 2013-05-03 14:19:30 -07:00
Matt Mackall
2d6d229def check-code: add more path sep glob checks 2013-05-02 15:21:47 -05:00
Kevin Bullock
1b16c815cb check-code: fix sed 'i' command rule newline matching
The regular expression was meant to match cases where an 'i' command was
not followed by precisely a '\' and then a newline; it failed to match
the newline, so cases with a '\' but no newline would erroneously pass.
2013-04-23 16:57:51 -05:00
Kevin Bullock
2f2218183e check-code: expand sed rule to include more offenders
Expands the rule added in a3f00ef2b622 to include cases where the
address is a line number instead of a regular expression, and fixes an
instance of this pattern in test-unionrepo.t.
2013-04-22 16:50:08 -05:00
Kevin Bullock
5747742d25 check-code: add a rule against a GNU sed-ism
BSD sed requires the 'i' command to be followed with a backslash and a
newline, like so:

  $ sed -e '/^@/i\
  > other'

We've encountered this problem before, e.g. in test-mq.t (215a8789129e).
This change adds a check-code rule and fixes two instances of the
problem in test-record.t.
2013-04-22 16:33:28 -05:00
Matt Mackall
3109d84a82 check-code: add check for lock release order 2013-04-17 14:38:02 -05:00
Mads Kiilerich
eeb6ef563e check-code: check txt files for trailing whitespace 2013-04-15 01:37:23 +02:00
Mads Kiilerich
b7f720181a check-code: catch trailing space in comments 2013-04-15 01:37:23 +02:00
Bryan O'Sullivan
1d04c93909 check-code: fix a check-code failure in check-code
The irony is delicious.
2013-03-27 08:57:45 -07:00
Simon Heimberg
7dfe048bd9 check-code: re-add check for missing glob
As suggested by mpm reintroducing this test failure on windows is
prevented by a code-check. One line in a unix test is ignored.

This pattern matches 20 windows glob lines.
2013-03-01 00:59:22 +01:00
Simon Heimberg
6321f3dc40 tests: append missing glob to filename output and check-code it 2013-03-01 00:03:51 +01:00
Simon Heimberg
f94731fd38 check-code: extract windows glob warning message
it will be used often
2013-02-28 23:45:51 +01:00
Simon Heimberg
0e27bb618e check-code: do not prepend "warning" to a failure message
The prefix has not been removed when this check changed from a warning to a
failure.
2013-03-09 22:14:46 +01:00
Simon Heimberg
4be0e80cbe check-code: warn about line glob match with no glob character (?*/) 2013-02-13 21:51:47 +01:00
Kevin Bullock
72b1fbb751 check-code: warn to use killdaemons instead of kill cat PIDFILE
We have a bunch of tests that still use

    kill `cat hg.pid`

or worse,

    kill `cat hg.pid`; while kill -0 `cat hg.pid`; sleep 0; done

Cleaning these up to use tests/killdaemons.py is non-trivial, so for now
we just add a warning.
2013-02-08 19:32:56 +00:00
Mads Kiilerich
8d4726b241 tests: use pwd instead of ${PWD} in test-convert-git.t - because of Solaris 2013-01-31 02:39:55 +01:00
Augie Fackler
6f81622e24 check-code: disallow defunct <> operator
Added a test for that and one other python3 check in
test-check-code.t.
2013-01-01 13:05:22 -06:00
Augie Fackler
a52590ca42 check-code: disallow two-argument form of raise
Using this old form makes any attempt to port to Python 3 harder, and
the new syntax is supported in 2.4 already.
2013-01-01 12:58:21 -06:00
Mads Kiilerich
0c831b0b94 check-code: make 'missing whitespace in assignment' more aggressive
New warnings:

 >     a.b=ab
 missing whitespace in assignment
(the pattern did not accept '.' on the left hand side)

 >     a=a
 missing whitespace in assignment
(the right hand side pattern never matched a single character)

 >     a=a + 7
 missing whitespace in assignment
(the pattern only matched one character after the identifier following =)
2012-12-09 23:33:16 +01:00
Mads Kiilerich
ac8e1fc147 check-code: there must also be whitespace between ')' and operator
The check pattern only checked for whitespace between keyword and operator.

Now it also warns:
 >     x = f(),7
 missing whitespace after ,
 >     x = f()+7
 missing whitespace in expression
2012-12-09 23:33:16 +01:00
Matt Mackall
90a48b1c9f check-code: move i18n check from warning to error 2012-11-25 13:57:00 -06:00
Idan Kamara
4922480923 check-code: replace heredocs in unified tests
Heredocs are usually fed to other commands and
shouldn't follow the standard conventions of shell
commands.

This restores the old behaviour of how heredocs
were handled in old-style test files.
2012-10-03 22:09:18 +02:00
Thomas Arendsen Hein
23c6bfee41 check-code: catch yield inside try/finally (with tests)
This is not allowed in Python 2.4.
2012-09-19 12:29:12 +02:00
Mads Kiilerich
5e3dc3e383 avoid using abbreviations that look like spelling errors 2012-08-27 23:14:27 +02:00
Mads Kiilerich
2f4504e446 fix trivial spelling errors 2012-08-15 22:38:42 +02:00
Mads Kiilerich
59664fd950 check-code: fix check for trailing whitespace on continued lines too
The tests in test-annotate.t and test-import-git.t that relied on trailing
space in a file created by a here string is now masked by a literal 'EOL'
string that is removed.
2012-08-08 18:10:37 +02:00
Mads Kiilerich
cdcad9a14c check-code: fix check for trailing whitespace on empty lines
It seems like the intention with c4ecbbd282fe was to catch lines with only
one whitespace too.
2012-08-08 18:10:30 +02:00
Mads Kiilerich
9cddfd19ab check-code: fix check for trailing whitespace on sh command lines
The $ has been without necessary escaping since introduced in c4ecbbd282fe.
2012-08-08 18:10:16 +02:00
Mads Kiilerich
688b9e2048 check-code: indent 4 spaces in py files 2012-07-31 03:30:42 +02:00
Pierre-Yves David
6bb5e54b11 check-code: recognise %= as an operator 2012-07-06 19:48:19 +02:00
Mads Kiilerich
2108c6e927 check-code: verify that 'saved backup bundle to ...' is '(glob)'ed
This is the most frequent trivial reason tests fail on Windows.
2012-07-05 00:49:26 +02:00
Mads Kiilerich
a4be6ed644 test-alias: adapt for Windows
The test used 'echo' to test '!' style aliases. On Windows 'echo' is handled
by cmd and thus behaves very differently from the 'normal' echo command.

The simple workaround used here for using the same alias on all platforms
is to use 'printf' instead. Msys 'printf' will also handle sh quoting and
escaping in cmd.

Environment variable expansion with sh syntax is handled by launching sh.
2012-06-16 21:57:42 +02:00
Brodie Rao
7f47d4e347 check-code: ignore naked excepts with a "re-raise" comment
This also promotes the naked except check from a warning to an error.
2012-05-13 13:18:06 +02:00
Brodie Rao
391c9b5bf1 check-code: improve detection of naked except clauses 2012-05-13 13:17:50 +02:00
Brodie Rao
47a3ca1c2f check-code: promote 80+ character line warning to an error 2012-05-13 13:17:27 +02:00
Brodie Rao
d6a6abf2b0 cleanup: eradicate long lines 2012-05-12 15:54:54 +02:00
Mads Kiilerich
80eee013e1 tests: unify the last sh tests
This requires a slightly smarter check-code check for sed output filtering.
2012-04-25 01:35:39 +02:00
Mads Kiilerich
f4efda66d8 tests: run most check-code sh checks on continued lines too
Some false errors are degraded to warnings and whitelisted.
2012-04-25 01:35:39 +02:00
Martin Geisler
24e4bf05a3 check-code: catch unnecessary s.strip().split() calls 2012-05-07 10:02:50 +02:00
Mads Kiilerich
b7e85cefa1 tests: avoid tab indent on all kinds of lines of sh commands 2012-04-23 01:56:48 +02:00
Mads Kiilerich
f64bae7ea3 tests: use 'do sleep 0' instead of 'do true', also on first line of command
2cd44a791e66 established that '... do true ...' shouldn't be used, but that was
only enforced on continued lines.
2012-04-23 01:56:48 +02:00
Mads Kiilerich
ca99a3d167 check-code: put grouping around regexps generated from testpats
This removes the pitfall that would make the testpath r'a|b' match 'b' on all
lines in .t tests.
2012-04-23 01:56:48 +02:00
Mads Kiilerich
b1160b7ec5 tests: don't use /dev/urandom for largefiles testing
There is no need to use entropy here just to create some content that only will
be used for hashing and ignored.

This avoids a problem where dd from /dev/urandom on solaris generates too short
output.
2012-04-23 01:56:48 +02:00
Mads Kiilerich
4c1897dde5 tests: fix incorrect markup of continued lines of sh commands 2012-04-23 01:39:26 +02:00
Mads Kiilerich
9f4ca6b4df check-code: 'printf \0' is apparently fine - accept it in check-code
Nobody complained over '\0' in test-eol.t.

The too strict check becomes a problem when this check is applied to more
lines.
2012-04-23 01:39:26 +02:00
Mads Kiilerich
e5bed4bfb4 tests: solaris sh can not negate exit status with '!' 2012-04-23 01:39:26 +02:00
Mads Kiilerich
d63ff4f9a5 tests: ^ must be quoted when used on solaris sh
The check was broken when it was introduced in 8924361c0202.
2012-04-23 01:39:26 +02:00
Matt Mackall
4ca25d50f9 merge with stable 2012-04-14 01:39:35 -05:00
Patrick Mezard
bdf6ede885 mq: replace hasattr() with util.safehasattr(), update check-code.py 2012-04-13 15:07:13 +02:00
Matt Mackall
05bbeed32b check-code: avoid false-positive on ++ 2012-04-12 20:22:18 -05:00
Jim Hague
77587a4c7a tests: avoid test-hup hanging on AIX
test-hup hangs on AIX. Under ksh89 on AIX (the default shell),

echo Hello; while [ ! -s not-there ]; do true; done

produces no output while the loop executes. Replacing 'true' with 'sleep 0'
fixes, as does using a less broken shell. ksh93 is fine.

Update check-code.py to look for this, and make same change in test-serve.t.
In fact test-serve works fine, probably because of additional commands between
echo and the loop, but that's a subtlety not easy to test for.
2012-04-05 12:31:21 +01:00
Matt Mackall
560dd93d34 merge with stable 2012-04-06 15:18:14 -05:00
Matt Mackall
4325ad525f tests: remove sed -i from test-record 2012-04-01 13:59:11 -05:00
Matt Mackall
cc8b3a2b01 pvec: introduce pvecs 2012-03-12 13:37:39 -05:00
Matt Mackall
bd04c54a71 check-code: check for % inside _() 2012-03-08 15:59:44 -06:00
Jim Hague
78a686772b tests: tighten checks for octal escapes in shell printf.
printf on AIX default shell ksh (89) says \1 is an invalid escape. It insists
on at least 2 digits. This causes failures in test-keyword.t and test-status.t.

check-code.py already looks out for \NNN and recommends using Python
for outputting octal values. Extend the check to \NN and \N and fix up
resulting failures.
2012-02-08 16:56:00 +00:00
Mads Kiilerich
e347788597 tests: don't use alias
alias doesn't work in Solaris sh.
2012-01-27 03:00:03 +01:00
Mads Kiilerich
9acd1868fa tests: keep track of all check-code.py warnings 2012-01-11 01:56:05 +01:00
Matt Mackall
e82c2e671f merge with stable 2011-12-05 17:48:40 -06:00
Patrick Mezard
7a8d1bb9db test-svn-subrepo: fix reference output for svn 1.7
I modified check-code.py "$?" detection because I thought my use was legit, we
cannot test exit status of pipelines commands except for the last one without
this. So it now tolerates "[$?" which is unlikely to be added by mistake.

Tested on:
- OSX + svn 1.7.1
- Linux + svn 1.6.12
2011-12-02 16:50:48 +01:00
Mads Kiilerich
1cbfae386c check-code: fix return code initialization
Don't crash when nothing is tested, but return failure when other files than
the last one fails.
2011-11-22 01:37:26 +01:00
Mads Kiilerich
ef0024b865 check-code: add --nolineno option for hiding line numbers
This makes the output more stable when it is used as a whitelist.
2011-11-11 01:25:47 +01:00
Matt Mackall
a5d3d42e92 tests: use md5sum.py instead of sha1sum, add check 2011-10-31 14:22:11 -05:00
Matt Mackall
8971e5af3c check-code: fix issues with finding patterns in unified tests, fix tests
- old-style patterns without ^ were getting improperly anchored
- finditer was matching against beginning of line poorly
- \s was matching newlines
- [^x] was matching newlines

so we:

- remove earlier hacks for multiline matching
- fix unified test anchoring by adding .*
- replace \s with [ \t]
- replace [^x] with [^\nx]
- force all matches into multiline mode so ^ anchors work

This uncovers a number of test issues that are then repaired.
2011-10-27 17:22:04 -05:00
Matt Mackall
4b52621903 tests: fix check-code detection of anchored expressions, fix echo -n usage 2011-10-26 12:56:27 -05:00
Matt Mackall
b7430f065a check-code: catch BaseException and os.path.relpath 2011-10-21 16:52:23 -05:00
Matt Mackall
b22c536335 check-code: report suspicious string joins
This detects patterns of the form:

ui.write("this is missing"
         "a space at the join\n")
2011-10-17 17:27:33 -05:00
Matt Mackall
e1cab56645 merge with crew 2011-10-16 22:15:43 -05:00
Matt Mackall
db1431fe95 check-code: support multiline matches like try/except/finally
- match one pattern at a time against entire file
- find line containing match
- sort matches by line number
2011-10-16 20:26:20 -05:00
Mads Kiilerich
4578a9a76b tests: don't use 'test -e'
On Solaris 10:

  $ test -e f
  test: argument expected
2011-10-17 00:11:56 +02:00
Matt Mackall
d0885370c9 check-code: enable camelcase check, fix up problems 2011-11-09 16:36:54 -06:00
Augie Fackler
3a3e79d5b5 check-code: disallow use of hasattr()
The hasattr() builtin from Python < 3.2 [1] has slightly surprising
behavior: it catches all exceptions, even KeyboardInterrupt. This
causes it to have several surprising side effects, such as hiding
warnings that occur during attribute load and causing mysterious
failure modes when ^Cing an application. In later versions of Python
2.x [0], exception classes which do not inherit from Exception (such
as SystemExit and KeyboardInterrupt) are not caught, but other types
of exceptions may still silently cause returning False instead of
getting a reasonable exception.

[0] http://bugs.python.org/issue2196
[1] http://docs.python.org/dev/whatsnew/3.2.html
2011-07-25 14:59:31 -05:00
Jim Hague
f6f49b778c treediscovery: rename stop() in tests to fix failures on AIX.
It seems ksh, the default shell on AIX, does not permit the creation of a
function called stop(). test-treediscovery.t and test-treediscovery-legacy.t
both fail on AIX with error 'syntax error at line 25 : `(' unexpected'.

Fix by renaming stop() in the scripts to tstop(). For completeness
rename start() to tstart() to match. Both tests then pass on AIX.

Add check for the use of stop() in a shell script to check-code.
2011-07-05 11:53:32 +01:00
Thomas Arendsen Hein
4575d54a81 check-code: fix class style checking (with tests)
- old-style classes were only checked for one-letter class names
- add check for new-style classes with empty parent class, because
  this is not available in Python 2.4
2011-06-29 13:45:51 +02:00
Matt Mackall
f65681314b check-code: don't mark debug messages for translation 2011-06-21 15:21:57 -05:00
Matt Mackall
1b52b02896 check-code: catch misspellings of descendant
This word is fairly common in Mercurial, and easy to misspell.
2011-06-07 17:02:54 -05:00
Martin Geisler
af8a35e078 check-code: flag 0/1 used as constant Boolean expression 2011-06-01 12:38:46 +02:00
Sune Foldager
58e1e8aaa9 check-code: add /= to operator list 2011-05-12 18:19:28 +02:00
Matt Mackall
81206f7383 check-code: complain about set.isdisjoint 2011-05-08 11:39:24 -05:00
Mads Kiilerich
938d75f22d check-code: fix checking for sh style in .t tests
Restore checks after they were disabled by a1f828662ac8.
2011-05-06 00:34:10 +02:00
Dan Villiom Podlaski Christiansen
c1ff9b1ec7 check-code: disallow calling opener(...).read() and opener(..).write() 2011-05-02 10:11:24 +02:00
timeless
849f249718 check-code: check for repo in revlog and ui in util 2011-05-01 16:11:42 +02:00
timeless
153cb7a67b check-code: allow for checking multiple pattern sets per file 2011-05-01 16:10:51 +02:00
timeless
f74ce7db63 check-code: adding debug flag 2011-05-01 15:55:00 +02:00
Idan Kamara
169899ab9c check-code: separate warnings to avoid repetitive str.startswith 2011-04-25 13:03:26 +03:00
Idan Kamara
83e05de083 check-code: warn about naked except clauses 2011-04-23 00:52:21 +03:00
Dan Villiom Podlaski Christiansen
ecb9e72af1 osutil: replace #import with #include, and add a check for it 2011-03-23 23:05:32 +01:00
Matt Mackall
b156bda724 osutil: fix up check-code issues 2011-03-23 09:41:58 -05:00
Martin Geisler
e8a21642ee check-code: catch "echo > $HGRCPATH" too
Make error message consistent with the other error messages.
2011-03-02 14:52:31 +01:00
Martin Geisler
11500eaa6f check-code: better check for overwriting $HGRCPATH
Suggested by Mads Kiilerich on IRC.
2011-03-02 14:22:50 +01:00
Martin Geisler
83c27fb95f tests: don't overwrite HGRCPATH
Overwriting instead of appending to the file removes the [defaults]
section put into the file by run-tests.py.

It also defeats the --inotify option to run-tests.py.

(Nothing was broken yet, but the lack of -d "0 0" cause changeset
hashes to change unexpectedly in a test case I was editing.)
2011-03-01 17:01:17 +01:00
Dan Villiom Podlaski Christiansen
ec590d5cd4 explicitly close files
Add missing calls to close() to many places where files are
opened. Relying on reference counting to catch them soon-ish is not
portable and fails in environments with a proper GC, such as PyPy.
2010-12-24 15:23:01 +01:00
Martin Geisler
77e1343f88 check-code: do not complain about 'ls x | foo -v'
Such a line was introduced in test-subrepo-git.t in 686775e575f3,
which made check-code confused.
2011-01-26 12:35:02 +01:00
Matt Mackall
940fa28a3f check-code: catch os.path.relpath 2010-12-16 14:50:37 -06:00
Matt Mackall
cdcb8c0f47 check-code: catch "except as" 2010-12-16 14:50:36 -06:00
Thomas Arendsen Hein
3669dce8b1 check-code: single check for Python keywords used as a function
This replaces the specific checks for del/and/or/not/except and additionally
checks other Python keywords.
2010-12-03 12:04:31 +01:00
Thomas Arendsen Hein
31218f1044 check-code: check for gratuitous whitespace after Python keywords 2010-12-03 11:23:38 +01:00
Martin Geisler
6a3d9310ab code style: prefer 'is' and 'is not' tests with singletons 2010-11-22 18:15:58 +01:00
Adrian Buehlmann
5e2e71ea82 check-code: catch Python 'is' comparing number or string literals
The Python 'is' operator compares object identity, so it should
definitely not be applied to string or number literals, which Python
implementations are free to represent with a temporary object.

This should catch the following kinds of bogus expressions (examples):

  x is 'foo'     x is not 'foo'
  x is "bar"     x is not "bar"
  x is 42        x is not 42
  x is -36       x is not -36

As originally proposed by Martin Geisler, amended with catching
negative numbers.
2010-11-21 11:52:27 +01:00
Martin Geisler
ca016e40cb check-code: catch 'ls filename --option' case as per 8745def6e53b 2010-11-17 09:37:57 +01:00
Martin Geisler
9d82b9ed1f check-code: using and/or/not as a function is bad style 2010-11-11 00:08:09 +01:00
Matt Mackall
0f064b0796 check-code: warning and fixes for whitespace in unified tests 2010-10-20 14:57:36 -05:00
Martin Geisler
77ce66fb6a check-code: find trailing whitespace 2010-10-20 10:13:04 +02:00
Adrian Buehlmann
758fc721d8 check-code: add 'no tab indent' check for unified tests
and fix the offending tests accordingly
2010-10-16 18:09:01 +02:00
Dan Villiom Podlaski Christiansen
8e99053714 tests: compatibility fix.
'touch -d *' doesn't work on Mac OS X. In order to prevent this from
occuring again, a check for the case is added to 'check-code.py'.
2010-09-21 18:36:23 +02:00
Matt Mackall
5d9fc42983 tests: drop a bunch of sed calls from unified tests 2010-09-21 16:44:13 -05:00
Matt Mackall
0c59a109d6 check-code: add some basic support for unified tests 2010-09-21 12:41:24 -05:00
Martin Geisler
ec0bf03276 Merge with stable 2010-08-15 18:13:46 +02:00
Martin Geisler
888421d8ca check-code: catch "echo -n" in tests 2010-08-15 17:48:05 +02:00
Alecs King
00c728120d check-code: add exit status
so that we can use it in a shell command combination and/or in hg hooks.
2010-08-12 16:42:41 +08:00
Renato Cunha
f65cf06e03 check-code: added a check for calls to the builtin cmp function 2010-08-07 16:13:53 -03:00
Matt Mackall
661034417e check-code: add warning on lines over 80 characters 2010-07-25 17:10:32 -05:00
Martin Geisler
71971a8928 check-code: warn about untranslated ui.warn calls 2010-07-16 14:40:57 +02:00
Matt Mackall
6c780d7b4f check-code: add --blame switch 2010-07-16 13:26:39 -05:00
Martin Geisler
12085cad2b check-code: catch dict.has_key 2010-07-16 14:48:52 +02:00
Martin Geisler
f985c9d777 Merge with stable 2010-07-16 14:45:52 +02:00
Renato Cunha
29ee0d7c07 check-code: added check for reduce usage 2010-07-14 23:15:03 -03:00
Renato Cunha
f678753e0c check-code: check for tuple parameter unpacking (missing in py3k) 2010-07-14 23:15:00 -03:00
Martin Geisler
59385f10e8 check-code: add test for callable 2010-07-09 14:01:55 +02:00
Martin Geisler
5bd48f2f1e check-code: reformat long lines 2010-06-15 10:01:55 +02:00
Martin Geisler
28297c8184 check-code: catch format(), introduced in Python 2.6 2010-06-15 09:55:59 +02:00
Martin Geisler
5d9db0b74d check-code: fix check for any/all function
The old check would only detect any/all at the beginning of a line.
The regexp was probably just modeled after the preceding regexp which
(correctly) finds the 'with' keyword at the beginning of a line.

We now complain about 'any(' and 'all(' anywhere in a line, unless it
is preceded by 'def'. This allows us to define our own compatibility
wrapper in util and use 'util.any(' in the code.
2010-06-15 09:51:52 +02:00
Yuya Nishihara
ffeee8dfd0 check-code: add check for 'source' 2010-05-21 22:53:57 +09:00
Nicolas Dumazet
7f1a963829 pylint, pyflakes: remove unused or duplicate imports 2010-04-14 17:58:10 +09:00
Matt Mackall
062bdb8d0b check-code: add a warnings level
- demote "unwrapped ui message"
2010-04-12 17:41:32 -07:00
Matt Mackall
0726edad79 Merge with stable 2010-04-01 17:51:59 -05:00
Mads Kiilerich
6f24bc8f03 check-code.py: Check for bare ^
Solaris sh interprets ^ as some kind of piping symbol.
2010-03-31 11:07:46 +02:00
Benoit Boissinot
2fa74b1aa8 check-code: more tests and more robust python filtering 2010-03-18 16:32:03 +01:00
Matt Mackall
9ead8ddeec check-code: fix check-code complaint 2010-03-17 15:36:48 -05:00
Benoit Boissinot
4e213c5898 check-code: improve quote detection regexp, add tests 2010-03-17 14:15:33 +01:00
Pierre-Yves David
ada28ea37e check-code: add a return value to checkfile function
The checkfile function returns True if the file is correct, False
otherwise.
2010-03-17 10:51:26 +01:00
Pierre-Yves David
d5796f6daf code-code: Add a logfunc argument to checkfile
This helps external tool customisation. The logfunc argument must be a
function called to report errors. A new logger class is also added to
keep the old behaviour by default.
2010-03-16 19:53:00 +01:00
Pierre-Yves David
ffbf49397a check-code: Add a `maxerr argument to the checkfile` function
check-code.py used to halt after 15 errors. This changeset adds a new
argument to the checkfile function to control this limit.
2010-03-16 19:52:58 +01:00
Pierre-Yves David
16e40846e1 check-code: Add a `checkfile` function
The part of the code actually checking each file is moved in the
``checkfile`` function to allow external reuses.
2010-03-16 19:52:57 +01:00
Pierre-Yves David
64bcf4a5c3 check-code: Only call check-code if __name__ = "__main__".
This changeset moves the code that actually executes something to the
"if __name__ = '__main__'" section to allow the file to be imported as
a module.
2010-03-16 19:52:56 +01:00
Benoit Boissinot
57712fa835 check-code: remove simple quotes first 2010-03-16 16:39:17 +01:00
Matt Mackall
36aa3dd390 check-code: add check for any/all 2010-03-12 16:16:47 -06:00
Mads Kiilerich
badb17240e test-merge-default and check-code.py: No "export x=x" in sh 2010-03-08 03:07:35 +01:00
Matt Mackall
0bc7a87925 check-code: two more rules
- no plain Exceptions
- complain about unmarked ui messages
2010-02-13 23:20:17 -06:00
Matt Mackall
a17b73e2eb check-code: import some pylint checks 2010-02-09 13:53:24 -06:00
Martin Geisler
4817fcfe96 check-code.py: make help strings consistent 2010-02-07 10:58:51 +01:00
Mads Kiilerich
289637cadf check-code.py: escape backslash 2010-02-07 01:52:10 +01:00
Matt Mackall
1a71a75d3d check-code: del isn't a function 2010-01-28 22:44:54 -06:00
Matt Mackall
f7b37826db check-code: fix copyright date 2010-01-28 22:44:45 -06:00
Matt Mackall
6c94f28bab check-code: add some ignore hints 2010-01-28 22:44:18 -06:00
Matt Mackall
3f5075a48f check-code: check thyself 2010-01-25 01:23:34 -06:00
Matt Mackall
9b0512d1f6 Introduce check-code.py
check-code is a simple regex-based framework for checking our code and
tests for common style and portability errors. Currently, it knows a
fair amount about our Python and C style, and a little about common
shell script portability problems.
2010-01-25 00:05:22 -06:00