Changeset 25056

Timestamp:
Mar 15, 2021, 4:14:28 PM (3 years ago)
Author:
wraitii
Message:

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

Location:
ps/trunk
Files:
16 added
4 deleted
4 edited
1 moved

Legend:

Unmodified
Added
Removed
  • ps/trunk/.arcconfig

    r19056 r25056  
    11{
    22  "phabricator.uri" : "https://code.wildfiregames.com/",
    3   "repository.callsign" : "P"
     3  "repository.callsign" : "P",
     4  "load": ["build/arclint/pyrolint"]
    45}
  • ps/trunk/.arclint

    r22021 r25056  
    44    "(^build/premake/premake5/)",
    55    "(^source/third_party/)",
     6
    67    "(^libraries/)"
    78  ],
     
    1516        "5": "disabled"
    1617      }
     18
     19
     20
     21
     22
     23
     24
     25
     26
     27
     28
     29
     30
     31
     32
     33
     34
     35
     36
    1737    }
    1838  }
  • ps/trunk/LICENSE.txt

    r24267 r25056  
    4242  /build
    4343    Various (unspecified)
     44
     45
     46
     47
     48
     49
    4450
    4551  /build/premake/premake5
  • ps/trunk/build/arclint/configs/eslintrc.json

    • Property svn:mime-type set to text/json
    r24937 r25056  
    11{
    22    "parserOptions": {
    3         "ecmaVersion": 6
     3        "ecmaVersion":
    44    },
    55    "plugins": [
  • ps/trunk/build/jenkins/pipelines/docker-differential.Jenkinsfile

    r23971 r25056  
    1 /* Copyright (C) 2020 Wildfire Games.
     1/* Copyright (C) 202 Wildfire Games.
    22 * This file is part of 0 A.D.
    33 *
     
    148148                script {
    149149                    try {
    150                         withDockerContainer("0ad-coala:latest") {
    151                             sh '''
    152                             svn st | grep '^[AM]' | cut -c 9- | xargs coala -d build/coala --ci --disable-caching \
    153                               --format '{{ "name": "{origin}", "code": "{origin}", "severity": "{severity_str}", "path": "{file}", "line": {line}, "description": "`{message}`" }}' \
    154                               --limit-files > coala-report
    155                             '''
    156                         }
     150                        sh 'arc lint --output json > .phabricator-lint'
    157151                    } catch (e) {
    158                         sh 'sed -i "s|$(pwd)/||g" coala-report'
    159                         sh 'sed -e "s/INFO/advice/g" -e "s/NORMAL/warning/g" -e "s/MAJOR/error/g" coala-report > .phabricator-lint'
     152                        sh 'echo \"{ \\\"name\\\": \\\"error\\\", \\\"severity\\\": \\\"error\\\", \\\"code\\\": \\\"0\\\", \\\"description\\\": \\\"lint could not run\\\" }\" > .phabricator-lint '
    160153                    }
    161154                }
Note: See TracChangeset for help on using the changeset viewer.