This is lint reported by the new lint-checking functionality in beautify.py.
(We can change to a different lint checker if we have a better one, but it
would probably still flag these same problems.)
Lint checking can help a lot, but only if we get the lint under control.
The CSS style that Pocketlint expects is just too different from what we
have. Don't check those files for now.
Also, a maximum line length of 300 still gives too many warnings, so I'm
regretfully dumping the default to 400 characters. The traditional 80
characters are already longer than the measured optimum for human reading,
so I hope some day we can address this!
Choose which action(s) you want for each run: --format and/or --lint.
Many different types of files are lint-checkable, but you need Pocketlint
installed (plus ideally, its plugins for the various languages).
Also, added option to control batching of the commands.
This is about the last that isn't in contrib or generated files. At this
point we can start doing regular lint checks, at least on the Python files,
without being completely inundated with warnings.
I used mainly pocketlint, a very good Python linter, but also Syntastic,
a vim plugin. Didn't get anywhere near fixing all of Syntastic's complaints
though.
Once I've cleaned up all (or at least most) of the Python lint, we can
start doing regular automated lint checks and keep the code clean.
The path prefixes listed in .beautify-ignore, in the project root, will not
be cleaned up. C and C++ files everywhere else will be.
Also fixes bugs in the prefix-matching code, and makes the matching a little
bit more powerful: the prefix can now extend down into the directory tree.
The new version is much longer, but hopefully extensible, reusable, and
easy to read. With a few more changes it will let us do three things:
1. Apply more checks and cleanups.
2. Clean up additional file types.
3. Use the same script for mgiza++, so we get a uniform code style.
The "more cleanups" could be more things like the removal of trailing
whitespace which we just added. We may even want to run lint checkers of
some sort.
Additional file types could be e.g. Perl scripts, build configuration,
or documentation.
In order to make the script reusable we'll have to generalize the
skip_at_root list in list_c_like_files into something like a configuration
file.
The case where !m_fixed passed m_map_size to mmap(), but the "else"
clause passed map_size. In replacing mmap() with the portable wrapper,
I accidentally changed that to be m_map_size as well.
Besides fixing that, I'm changing the name of the variable to be more
clearly distinguishable from m_map_size.
Part of symal was still written in K&R C (though with an anachronistic C99
version comment!). Updating it to ANSI C, adding const in many places for
clarity. Reordering functions to eliminate forward declarations.
Moving definition of Cmd_T into cmd.c, since it's local to that file.
Adding some wrappers to reduce the casts around Cmd_T.p. Narrowing the
scope of some variables.
Also updating the C++: use anonymous namespace for "static" definitions,
use enums and constants instead of preprocessor macros, use false/true as
boolean constants, throw exceptions instead of print-and-exit, avoid use of
"final" as an identifier since it's now a reserved word.