Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Prevent the config-lint script erroring out on any sample_config changes #9562

Merged
merged 2 commits into from
Mar 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/9562.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix spurious errors reported by the `config-lint.sh` script.
9 changes: 7 additions & 2 deletions scripts-dev/config-lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@
# Find linting errors in Synapse's default config file.
# Exits with 0 if there are no problems, or another code otherwise.

# cd to the root of the repository
cd `dirname $0`/..

# Restore backup of sample config upon script exit
trap "mv docs/sample_config.yaml.bak docs/sample_config.yaml" EXIT

# Fix non-lowercase true/false values
sed -i.bak -E "s/: +True/: true/g; s/: +False/: false/g;" docs/sample_config.yaml
rm docs/sample_config.yaml.bak

# Check if anything changed
git diff --exit-code docs/sample_config.yaml
diff docs/sample_config.yaml docs/sample_config.yaml.bak
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script will now just compare the modified sample config against the *.bak file, and no longer uses git diff for comparison. diff will report the same error codes.

The trap statement will move the original sample config (*.bak) on top of the modified one upon script exit.