This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Add config linting script that checks for bool casing #6203
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
5d40685
Add config linting script; checks for bool casing
anoadragon453 6f5e6f6
Add changelog
anoadragon453 44f0d50
gen config
anoadragon453 11c7336
Have config-lint print corrections made
anoadragon453 25a7977
Update scripts-dev/config-lint.sh
anoadragon453 ffb5832
Merge branch 'anoa/lowercase_config_defaults' of github.com:matrix-or…
anoadragon453 5dd459e
Put True/False lowercase linting under check_codestyle
anoadragon453 2a324d2
Debug CI
anoadragon453 0155478
Fix script name in tox config
anoadragon453 534b1c5
Fix and print changes in sample config, not python config files
anoadragon453 6c6e78a
Lowercase boolean options in ACME config
anoadragon453 1e1c470
Cleanup and comment
anoadragon453 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Enforce that all boolean configuration values are lowercase in CI. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,7 +86,7 @@ pid_file: DATADIR/homeserver.pid | |
# Whether room invites to users on this server should be blocked | ||
# (except those sent by local server admins). The default is False. | ||
# | ||
#block_non_admin_invites: True | ||
#block_non_admin_invites: true | ||
|
||
# Room searching | ||
# | ||
|
@@ -239,7 +239,7 @@ listeners: | |
|
||
# Global blocking | ||
# | ||
#hs_disabled: False | ||
#hs_disabled: false | ||
#hs_disabled_message: 'Human readable reason for why the HS is blocked' | ||
#hs_disabled_limit_type: 'error code(str), to help clients decode reason' | ||
|
||
|
@@ -261,15 +261,15 @@ listeners: | |
# sign up in a short space of time never to return after their initial | ||
# session. | ||
# | ||
#limit_usage_by_mau: False | ||
#limit_usage_by_mau: false | ||
#max_mau_value: 50 | ||
#mau_trial_days: 2 | ||
|
||
# If enabled, the metrics for the number of monthly active users will | ||
# be populated, however no one will be limited. If limit_usage_by_mau | ||
# is true, this is implied to be true. | ||
# | ||
#mau_stats_only: False | ||
#mau_stats_only: false | ||
|
||
# Sometimes the server admin will want to ensure certain accounts are | ||
# never blocked by mau checking. These accounts are specified here. | ||
|
@@ -294,7 +294,7 @@ listeners: | |
# | ||
# Uncomment the below lines to enable: | ||
#limit_remote_rooms: | ||
# enabled: True | ||
# enabled: true | ||
# complexity: 1.0 | ||
# complexity_error: "This room is too complex." | ||
|
||
|
@@ -411,7 +411,7 @@ acme: | |
# ACME support is disabled by default. Set this to `true` and uncomment | ||
# tls_certificate_path and tls_private_key_path above to enable it. | ||
# | ||
enabled: False | ||
enabled: false | ||
|
||
# Endpoint to use to request certificates. If you only want to test, | ||
# use Let's Encrypt's staging url: | ||
|
@@ -786,7 +786,7 @@ uploads_path: "DATADIR/uploads" | |
# connect to arbitrary endpoints without having first signed up for a | ||
# valid account (e.g. by passing a CAPTCHA). | ||
# | ||
#turn_allow_guests: True | ||
#turn_allow_guests: true | ||
|
||
|
||
## Registration ## | ||
|
@@ -829,7 +829,7 @@ uploads_path: "DATADIR/uploads" | |
# where d is equal to 10% of the validity period. | ||
# | ||
#account_validity: | ||
# enabled: True | ||
# enabled: true | ||
# period: 6w | ||
# renew_at: 1w | ||
# renew_email_subject: "Renew your %(app)s account" | ||
|
@@ -971,7 +971,7 @@ account_threepid_delegates: | |
|
||
# Enable collection and rendering of performance metrics | ||
# | ||
#enable_metrics: False | ||
#enable_metrics: false | ||
|
||
# Enable sentry integration | ||
# NOTE: While attempts are made to ensure that the logs don't contain | ||
|
@@ -1023,7 +1023,7 @@ metrics_flags: | |
# Uncomment to enable tracking of application service IP addresses. Implicitly | ||
# enables MAU tracking for application service users. | ||
# | ||
#track_appservice_user_ips: True | ||
#track_appservice_user_ips: true | ||
|
||
|
||
# a secret which is used to sign access tokens. If none is specified, | ||
|
@@ -1149,7 +1149,7 @@ saml2_config: | |
# - url: https://our_idp/metadata.xml | ||
# | ||
# # By default, the user has to go to our login page first. If you'd like | ||
# # to allow IdP-initiated login, set 'allow_unsolicited: True' in a | ||
# # to allow IdP-initiated login, set 'allow_unsolicited: true' in a | ||
# # 'service.sp' section: | ||
# # | ||
# #service: | ||
|
@@ -1262,13 +1262,13 @@ password_config: | |
# smtp_port: 25 # SSL: 465, STARTTLS: 587 | ||
# smtp_user: "exampleusername" | ||
# smtp_pass: "examplepassword" | ||
# require_transport_security: False | ||
# require_transport_security: false | ||
# notif_from: "Your Friendly %(app)s Home Server <[email protected]>" | ||
# app_name: Matrix | ||
# | ||
# # Enable email notifications by default | ||
# # | ||
# notif_for_new_users: True | ||
# notif_for_new_users: true | ||
# | ||
# # Defining a custom URL for Riot is only needed if email notifications | ||
# # should contain links to a self-hosted installation of Riot; when set | ||
|
@@ -1446,11 +1446,11 @@ password_config: | |
# body: >- | ||
# To continue using this homeserver you must review and agree to the | ||
# terms and conditions at %(consent_uri)s | ||
# send_server_notice_to_guests: True | ||
# send_server_notice_to_guests: true | ||
# block_events_error: >- | ||
# To continue using this homeserver you must review and agree to the | ||
# terms and conditions at %(consent_uri)s | ||
# require_at_registration: False | ||
# require_at_registration: false | ||
# policy_name: Privacy Policy | ||
# | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
# Find linting errors in Synapse's default config file. | ||
# Exits with 0 if there are no problems, or another code otherwise. | ||
|
||
# Fix non-lowercase true/false values | ||
sed -i -E "s/: +True/: true/g; s/: +False/: false/g;" docs/sample_config.yaml | ||
|
||
# Check if anything changed | ||
git diff --exit-code docs/sample_config.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -302,13 +302,13 @@ def generate_config_section(self, config_dir_path, server_name, **kwargs): | |
# smtp_port: 25 # SSL: 465, STARTTLS: 587 | ||
# smtp_user: "exampleusername" | ||
# smtp_pass: "examplepassword" | ||
# require_transport_security: False | ||
# require_transport_security: false | ||
# notif_from: "Your Friendly %(app)s Home Server <[email protected]>" | ||
# app_name: Matrix | ||
# | ||
# # Enable email notifications by default | ||
# # | ||
# notif_for_new_users: True | ||
# notif_for_new_users: true | ||
# | ||
# # Defining a custom URL for Riot is only needed if email notifications | ||
# # should contain links to a self-hosted installation of Riot; when set | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it might be simpler just to grep for the incorrect formats, rather than try to correct them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I considered this at first, but I wanted to be able to add this to
scripts-dev/lint.sh
which could get run in a pre-commit hook for instance.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not quite sure that follows...
lint.sh
doesn't correct for incorrect imports or pep8 failures, it just complains if they are wrong.There might be value in having a script to correct the problems, but given how often it's likely to be a problem versus the added complexity of this script, I don't think it's worthwhile?