Opened 6 months ago

Closed 5 months ago

Last modified 5 months ago

#6544 closed enhancement (fixed)

Include list of unused data json files in checkrefs.py

Reported by: Langbart Owned by: marder
Priority: If Time Permits Milestone: Alpha 26
Component: Simulation Keywords:
Cc: Patch: Phab:D4663 Phab:D4725

Description (last modified by Langbart)

Having fewer files to translate is good. To find unused files automatically, it should be integrated into the python script checkrefs.py.

Aura

Name Removed from template with Removed from the Game
structures/rotary_mill [25561] [26900]
units/han_minister_cost unused in the main game [26900]
units/elephant_worker [26898] [26900]
han_hero_wei_qing_3.json [26980] [26992]

Technologies

Name Removed from template with Removed from the Game
upgrade_rank_advanced_crossbow unused in the main game [26900]
upgrade_rank_elite_crossbow unused in the main game [26900]
pair_unlock_arrows_type [26469] [26900]
shell function

used for finding unlisted data json files in the simulation folder

function unusedJSON {
  CURRENT_DIR=$(pwd)
  cd ~/0ad/binaries/data/mods/public/simulation/data/auras || return 1
  printf "\e[1;97mList unused Auras:\e[0m\n"
  for a in $(find . -name "*.json" | sed 's|./||;s|.json||'); do
    if [[ $(grep --include=\*.xml -rw ~/0ad/binaries/data/mods/public/simulation -e "$a" | wc -c) -eq 0 ]]; then
      echo "$a"
    fi
  done
  cd ~/0ad/binaries/data/mods/public/simulation/data/technologies || return 1
  printf "\e[1;97m\nList unused Technologies:\e[0m\n"
  for t in $(find . -name "*.json" | xargs grep -Le 'autoResearch.*true' | sed 's|./||;s|.json||'); do
    if [[ $(grep --include={*.xml,test_Researcher.js,pair_unlock*.json} -rw ~/0ad/binaries/data/mods/public/simulation -e "$t" | wc -c) -eq 0 ]]; then
      echo "$t"
    fi
  done
  cd "${CURRENT_DIR}" || return 1
}

related tickets

Change History (10)

comment:1 by Stan‘, 6 months ago

Nice findings. I suppose they should be reported by checkrefs -u

comment:2 by marder, 6 months ago

Owner: set to marder
Resolution: fixed
Status: newclosed

In 26900:

Delete some unused techs/ auras

detected by @Langbart
Fixes #6544

Differential revision: https://code.wildfiregames.com/D4663

comment:3 by Langbart, 6 months ago

Patch: Phab:D4663

comment:4 by Langbart, 5 months ago

Description: modified (diff)
Priority: Should HaveIf Time Permits
Resolution: fixed
Status: closedreopened
Summary: List of unused data json filesInclude list of unused data json files in checkrefs.py
Type: defectenhancement
  • Adding a new unused json file from [26980]
  • The ticket should only be closed if the checkrefs.py script can find these files.

comment:5 by Stan‘, 5 months ago

Nice function, it's not cross-platform though, so I have to rewrite it to be:

  • mod compatible
  • windows compatible (e.g the CI doesn't care but modders might)

comment:6 by Stan‘, 5 months ago

Patch: Phab:D4663Phab:D4663 Phab:D4725

comment:7 by Langbart, 5 months ago

Description: modified (diff)

han_hero_wei_qing_3 moved from the tech to the aura table.

comment:8 by Stan, 5 months ago

In 26991:

Add techs and auras to the list of possibly missing files.
Refs: #6544
Accepted by: @Langbart
Differential Revision: https://code.wildfiregames.com/D4725

comment:9 by Stan, 5 months ago

Resolution: fixed
Status: reopenedclosed

In 26992:

Remove unused han_hero_wei_qing_3.json aura.
Reported by: @Langbart
Fixes #6544
Fixes Phab:rP26980

comment:10 by Langbart, 5 months ago

Description: modified (diff)

update Aura table

Note: See TracTickets for help on using tickets.