-
Notifications
You must be signed in to change notification settings - Fork 348
Create .editorconfig #1225
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
Create .editorconfig #1225
Conversation
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.
Pull Request Overview
Adds a comprehensive EditorConfig setup to standardize code formatting across the repository. The PR introduces an .editorconfig
file with rules for various file types and implements automated checking via GitHub Actions to enforce these formatting standards.
- Creates
.editorconfig
with specific formatting rules for different file types (Python, YAML, JSON, etc.) - Adds automated EditorConfig validation through GitHub Actions workflow
- Fixes formatting issues in test files to comply with the new EditorConfig rules
Reviewed Changes
Copilot reviewed 5 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
.editorconfig |
Defines formatting standards for various file types including indentation, line endings, and character encoding |
.editorconfig-checker.json |
Configuration for the EditorConfig checker with exclusions and disabled rules |
.github/workflows/main.yml |
Adds EditorConfig validation job to CI pipeline |
tests/test_fixtures.py |
Reformats code to comply with EditorConfig rules, fixing line breaks and indentation |
tests/test_django_settings_module.py |
Reformats multiline function calls and dictionary definitions to match EditorConfig standards |
I'd recommend putting the checker into tox or pre-commit configs since those would have better cross-env integrations and aren't locked to just the CI. |
It has a native integration with the pre-commit framework: https://github.com/editorconfig-checker/editorconfig-checker/blob/main/.pre-commit-hooks.yaml. So just add a In my projects, it looks like this: https://github.com/ansible/awx-plugins/actions/runs/16881280962/job/47817646031. Overall, having pre-commit invoked in CI through tox probably deserves a dedicated PR. Once it's in, adding any new linters and/or formatters would be going through the pre-commit framework and would work in CI, locally through tox and even if editor integrations somehow call pre-commit outside this infra. Also, there's a wrapper that does work with |
PS. I did this quick PR to ensure the authors would catch issues like putting tabs into places were the norm is spaces and I or others not to have to point it out. |
Then, I'd definitelly go for the pre-commit framework as it has native fixers for this sort of things: https://github.com/ansible/awx-plugins/blob/12091e4/.pre-commit-config.yaml#L65-L68. Check out https://pre-commit.com/hooks.html for more fun stuff. |
@webknjaz I see, I get it; but @bluetech is going to have to authorize pre-commit.ci Does it make sense to merge this in the interim, while we wait for the integration? Seems to me that the only thing we would remove is the changes to .github/workflows/main.yml -- everything else would stay in place. Plus, adding the hook config files. What do you think? This PR being a stop-gap. |
@kingbuzzman I edited one of the previous comments with the |
Note that his is a nice to have. Using it in GHA through tox isn't blocked as the GH App isn't needed for that. I'm rather surprised that there's no linting job in CI already. |
OH wow. I completely missed this! -- ok ok, let me patch it 😇 |
@webknjaz DOPE suggestions as always! Thank you so much!! ❤️ |
@kingbuzzman a note while pulling this into my PR: The new linting seems to freak out on pycache files in my local editor: tests/pycache/test_unittest.cpython-311-pytest-8.4.1.pyc: Is it worth making an issue to manage exclusions, or may I be doing something wrong on my setup? |
It should be fixed in the repo |
Adds: