This is a proposal for the basis of a linting suite using Coala.
This linting would happen before the build+tests pass in Jenkins.
Differential D213
Linting with Coala Itms on Mar 11 2017, 9:53 PM. Authored by
Details
This is a proposal for the basis of a linting suite using Coala. This linting would happen before the build+tests pass in Jenkins. Test the script.
Diff Detail
Event TimelineThere are a very large number of changes, so older changes are hidden. Show Older Changes
Comment Actions IMO we don't have enough python or perl around to really worry about those, and we can always fix things later. That said the perl config is missing. @Itms Comment Actions
Comment Actions Why not split python and perl to a separate diff before we start mixing reviews of all 4 linters in one page? RE eslint:
Comment Actions Build is green Updating workspaces. Build (release)... Build (debug)... Running release tests... Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK! Running debug tests... Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK! http://jw:8080/job/phabricator/1371/ for more details.
Comment Actions I could split indeed, but I don't think we have anybody with strong opinions on the good ways to write scripts in Python/Perl. Also we only use them as side tools, our scripts don't directly impact the quality of the game. So I think we should just follow the widespread and recommended configuration which is in those files, and tweak them when we update the scripts.
Comment Actions Then why is this uploaded for review? I don't feel comfortable with accepting two linters reviewed to the bone and two linters not even read. If we don't really care about these two linters (works for me) then I propose to commit sh file, pylint and perlcritic without review as a placeholder and update this differential revision proposal for the reviewed part.
Comment Actions Executing section Default... Executing section Source... Executing section JS... Executing section XML GUI... Executing section Python... Executing section Perl... http://jw:8080/job/phabricator_lint/57/ for more details. Comment Actions Build is green Updating workspaces. Build (release)... Build (debug)... Running release tests... Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK! Running debug tests... Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK! Checking XML files... http://jw:8080/job/phabricator/1374/ for more details.
Comment Actions There are still warnings of the type Use '===' to compare with '0'.left. So either add "-W041": false or wait for the next release, which will remove this warning (https://github.com/jshint/jshint/commit/376fa624d7eacc8f7b85c721bcd48a07ecf2643b) Comment Actions ESLint complains about such things as colorizeHotkey("%(hotkey)s" + " ", "session.kill") which is done to make people changing this line not forgetting about this space. Comment Actions I also get this error, when executing coala with the .coafile specified here: [WARNING][18:11:18] Implicit 'Default' section inheritance is deprecated. It will be removed soon. To silence this warning remove settings in the 'Default' section from your coafile. You can use dots to specify inheritance: the section 'all.python' will inherit all settings from 'all'. I fixed it by removing the Default section. (But I don't know, if this fix is correct) Comment Actions For eslint we should also add: "space-in-parens": 1, "space-before-function-paren": ["warn", "never"], "space-infix-ops": 1, "space-unary-ops": 1, "spaced-comment": ["warn", "always"], "comma-spacing": 1, "semi-spacing": 1, "brace-style": ["warn", "allman", { "allowSingleLine": true }], "no-multi-assign": 1, "no-trailing-spaces": 1, "object-curly-spacing": ["warn", "always"], "operator-assignment": 1, "operator-linebreak": ["warn", "after"], "semi": 1, "yoda": 1, "curly": ["warn", "multi"], "quote-props": 1, "indent": ["warn", "tab"], "no-mixed-spaces-and-tabs": ["warn", "smart-tabs"], "key-spacing": 1 We should also use http://eslint.org/docs/rules/linebreak-style. bar.filter(el => { doo; something; } This plugin: https://github.com/jrsearles/eslint-plugin-brace-rules can enforce different brace styles for each block type (forin, forof, try, switch, arrow func,...), so we just have to discuss which exceptions we want. (see https://wildfiregames.com/forum/index.php?/topic/21949-linting/#comment-328472) (I tested the plugin and it works quite well) Edit: Fixed operator-linebreak Comment Actions We should change "no-multi-spaces": 1 to "no-multi-spaces": ["warn", { "ignoreEOLComments": true }], to allow aligning end of line comments like: let foo; // init foo foo += 32; // add 32 Comment Actions here is the config part for the curly option: "brace-rules/brace-on-same-line": ["warn", { "FunctionDeclaration": "never", "FunctionExpression": "ignore", "ArrowFunctionExpression": "always", "IfStatement": "never", "TryStatement": "ignore", "CatchClause": "ignore", "DoWhileStatement": "never", "WhileStatement": "never", "ForStatement": "never", "ForInStatement": "never", "ForOfStatement": "never", "SwitchStatement": "never" }, { "allowSingleLine": true }], We also need to add "plugins": [ "brace-rules" ], after "parserOptions": { "ecmaVersion": 6 }, and install the plugin brace-rules Comment Actions The Linter and Build Bot should use spoilers, as they can be seen in https://code.wildfiregames.com/D615#32677 Comment Actions I followed Imarok's suggestions except for a thing: space-infix-ops does not help us because we often write things like foo[i+1] in case where foo[i + 1] hurts readability. I also agree with elexis that it's not good to have those unreviewed Python rules (and Perl ones for the same reason). On top of that our Python scripts are so badly written that the linter would be extremely noisy. I'll try to devise rules while fixing the scripts themselves. Comment Actions Executing section Default... Executing section Source... Executing section JS... Executing section XML GUI... http://jenkins-master:8080/job/phabricator_lint/574/ for more details. Comment Actions Build is green Updating workspaces... Build (release)... Build (debug)... Running release tests... Running cxxtest tests (307 tests)...................................................................................................................................................................................................................................................................................................................OK! Running debug tests... Running cxxtest tests (307 tests)...................................................................................................................................................................................................................................................................................................................OK! Checking XML files... http://jenkins-master:8080/job/phabricator/2101/ for more details. Comment Actions Sorry, yes I did when updating the patch. If things are looking good for you guys I can commit the script and the configurations. Comment Actions Looks good (Only talking about js linting). Comment Actions I updated jshint and I am now going to commit this script. Thanks a lot for your help with this! |