Java properties files can get messy. With props_check.py script you can check the properties files.
The script might be useful for:
- checking for duplicate keys, comparing keys and values, locating keys in a local repository
- checking local config files for new/obsolete keys - ie when upgrading a SW instance to a new version
- checking messages*.properties for new/obsolete keys - -dtto-
Prerequisites - You need to have installed: Python 3.12+ and Git [with git grep]
-
Download the script into a directory
-
Install requirements - currently only: tqdm - run:
$ pip install -r requirements.txt
-
Run the script to show help:
$ py props_check.py -h
There are 3 commands/actions available:
$ py props_check.py sort -h
$ py props_check.py compare -h
$ py props_check.py locate -h
$ py props_check.py sort --indir /messy_project/configs --output merged_configs.properties
-
to check for differing keys:
$ py props_check.py compare messages_en.properties messages_cs.properties
-
to check for differing keys and values:
$ py props_check.py compare new/config.properties old/config.properties --values
-
in a git repository tree
$ py props_check.py locate config.properties /messy_project/repo --branch main --subdir src --filext java,jsp,vm
-
in a git repository tree - include untracked files
$ py props_check.py locate config.properties /messy_project/repo --untracked
-
in any directory
$ py props_check.py locate config.properties /messy_project/mydir --noindex
A key is currently being looked up using git grep command - ie:
$ git grep -c [--untracked | --no-index] <key>
$ git grep -c <key> <branch> -- *.java *.vm
$ git grep -c <key> <branch> -- <subdir/>*.java <subdir/>*.vm