[Commits] [wesnoth/wesnoth] 728204: fix code problems found by luacheck (#2388)

GitHub noreply at github.com
Tue Jan 23 19:35:05 UTC 2018


  Branch: refs/heads/master
  Home:   https://github.com/wesnoth/wesnoth
  Commit: 728204665c284be137c11ded387913cb1e76fc54
      https://github.com/wesnoth/wesnoth/commit/728204665c284be137c11ded387913cb1e76fc54
  Author: vgaming <33452702+vgaming at users.noreply.github.com>
  Date:   2018-01-23 (Tue, 23 Jan 2018)

  Changed paths:
    M data/lua/wml/endlevel.lua
    M data/lua/wml/find_path.lua
    M data/lua/wml/harm_unit.lua
    M data/lua/wml/items.lua
    M data/lua/wml/kill.lua
    M data/lua/wml/message.lua
    M data/lua/wml/micro_ai.lua
    M data/lua/wml/objectives.lua
    M data/lua/wml/random_placement.lua
    M data/lua/wml/role.lua
    M data/lua/wml/set_variable.lua

  Log Message:
  -----------
  fix code problems found by luacheck (#2388)

fix code problems found by luacheck

Second iteration of the process, now handling data/lua/wml/*.lua

luacheck command used to find bugs:
  luacheck ./*.lua --globals wesnoth wml --codes --ignore 542 213
Additionally, error code 211 (unused variables) could be ignored,
as using underscore convention `_` is controversial in
wesnoth ( see https://github.com/wesnoth/wesnoth/pull/2380#discussion_r162519341 )

Actual bugs found:
* items.lua, access of global `write_name` instead of local `cfg.write_name`
* kill.lua, typo `primary_unit` -> `primary`
* bad code style: global `i` instead of local `i`
  (would conflict with 3-rd party code if it would use global `i`, too)





More information about the Commits mailing list