0ad/build/arclint
wraitii c9f37fc613 Lint update: use arclint, remove JSHint, remove coala on CI.
This runs linting using the "arc lint" command of arcanist, which
notably gets run automatically as part of the arc diff workflow.

Changes:
- The major change is that arc lint reports, by default, only issues on
changed lines instead of changed files (--lintall changes that).
- JSHint is largely redundant with eslint and does not support some of
the new Javascript functionality that we are able to use in 0 A.D., such
as conditional chaining, thus it is removed (of course, users can still
run it manually).
- Eslint 7 is supported out of the box and updated to ES 2020
- cppcheck and eslint are optional - if the executable is not found
(e.g. in PATH), it will fallback to a 'dummy' PHP script that does
nothing. This has been tested on windows, mac and Debian (CI).
- The licence year linter now suggests replacement, and has been
rewritten as an arcanist linter.
- Add a JSON error linter.

The intention is to have non-intrusive external linting, and largely the
same text linting.

Coala has largely gone unmaintained in the past few years (more so than
arcanist anyways) and installing it on modern Python is convoluted.

Differential Revision: https://code.wildfiregames.com/D3639
This was SVN commit r25056.
2021-03-15 15:14:28 +00:00
..
configs Lint update: use arclint, remove JSHint, remove coala on CI. 2021-03-15 15:14:28 +00:00
dummies Lint update: use arclint, remove JSHint, remove coala on CI. 2021-03-15 15:14:28 +00:00
pyrolint Lint update: use arclint, remove JSHint, remove coala on CI. 2021-03-15 15:14:28 +00:00
LICENCE.txt Lint update: use arclint, remove JSHint, remove coala on CI. 2021-03-15 15:14:28 +00:00
README.md Lint update: use arclint, remove JSHint, remove coala on CI. 2021-03-15 15:14:28 +00:00

Linting

This folder tools for linting 0 A.D. code Linting is done via Arcanist: https://secure.phabricator.com/book/phabricator/article/arcanist_lint/

Linters

  • text is configured to detect whitespace issues.
  • json detects JSON syntax errors.
  • licence-year detects Copyright header years and compares against modification time.
  • eslint, if installed, will run on javascript files.
  • cppcheck, if installed, will run on C++ files.

Installation

This assumes you have arcanist already installed. If not, consult https://trac.wildfiregames.com/wiki/Phabricator#UsingArcanist .

The linting is done via custom PHP scripts, residing in pyrolint/. Configuration is at the root of the project, under .arclint.

Installing linters

We provide dummy replacement for external linters, so that they are not required.

eslint

Installation via npm is recommended. The linter assumes a global installation of both eslint and the "brace-rules" plugin. npm install -g eslint@latest eslint-plugin-brace-rules

See also https://eslint.org/docs/user-guide/getting-started

cppcheck

Cppcheck is available on various package managers, including HomeBrew on macOS. An installer is available on windows. See http://cppcheck.sourceforge.net for details.