Skip to content

Added more options to config file (spaces, line length and safety checks) #352

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 12, 2025

Conversation

e-gleba
Copy link
Contributor

@e-gleba e-gleba commented Jan 18, 2025

This PR adds configuration file support for formatting options that were previously only available via command line.

Added Configuration Options:

  • line_length: Controls maximum line length
  • use_spaces: Controls indentation type (spaces vs tabs)
  • safety_checks: Controls parse tree validation and formatting stability checks

Priority Logic:
Command line arguments still take precedence over config file settings, maintaining backward compatibility while adding configuration flexibility.

Example Configuration:

# Core formatting options
line_length: 100
use_spaces: true
safety_checks: true

# Existing options remain unchanged
excluded_directories: !!set
  .git: null
  addons: null

Changes:

  • Updated main function to respect config-based settings with proper fallbacks
  • Maintained existing CLI argument priority over config values
  • Small reformatting of imports, sorted them alphabetically (used python black formatter)

The changes are minimal and focused solely on moving three existing CLI-only options into the configuration file system.

@e-gleba
Copy link
Contributor Author

e-gleba commented Jan 18, 2025

Dedicated issue - #345

@e-gleba e-gleba marked this pull request as draft February 10, 2025 09:51
@e-gleba e-gleba marked this pull request as ready for review February 10, 2025 10:06
@e-gleba
Copy link
Contributor Author

e-gleba commented Feb 10, 2025

Fixed failing tests by aligning with the repository's code style requirements. The issue stemmed from enforcing 4-space indentation while the default configuration uses tabs. Initially missed the failures since I was running tests via pytest directly instead of using the repository's tox-based workflow. Tests now pass after conforming to the specifications in the GitHub workflow file.

@Scony Scony merged commit 5df5952 into Scony:master Feb 12, 2025
12 checks passed
@Scony
Copy link
Owner

Scony commented Feb 12, 2025

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants