-
Notifications
You must be signed in to change notification settings - Fork 3
Formatting and linting improvements. #887
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
Conversation
|
This branch is working on a ticket in the NHS England VED JIRA Project. Here's a handy link to the ticket: VED-000 |
dlzhry2nhs
left a comment
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.
Looks great - just asked question in Slack as to whether any instructions/links need to be added to the README to advise developers on how to run Python linting manually, and how to set up husky for pre-commits (if it is a step that is needed).
|
| "lint-staged": "^16.2.3", | ||
| "prettier": "^3.6.2" | ||
| }, | ||
| "lint-staged": { |
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.
Nice!
| jobs: | ||
| lint: | ||
| name: Lint specification and Python projects | ||
| lint-specification: |
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.
Do we also wanna run the same prettier checks and tf fmt check that we have for pre-commits in the pipeline in case someone does not have them switched on locally?
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.
Yeah good shout. Will create a small follow up PR for this and some README changes
* Add black for code formatting. Remove some linting exclusions. Fix errors. * Fix path. * Don't install quality_checks package. * Fix commands. * Update pre-commit script. * Add lint-staged to lint and format staged files only. * Add husky to manage commit hooks. * Add prettier for MD / YAML / JSON formatting. * Resolve some Sonar warnings. * Add .prettierignore and run prettier on all supported files. * Revert auto formatting of jsc files. * Fix lint error. * Format Terraform.
* Add black for code formatting. Remove some linting exclusions. Fix errors. * Fix path. * Don't install quality_checks package. * Fix commands. * Update pre-commit script. * Add lint-staged to lint and format staged files only. * Add husky to manage commit hooks. * Add prettier for MD / YAML / JSON formatting. * Resolve some Sonar warnings. * Add .prettierignore and run prettier on all supported files. * Revert auto formatting of jsc files. * Fix lint error. * Format Terraform.



Summary
Changes:
huskyto manage git hooks.lint-stagedto run linters & formatters on staged files.prettierto format.md,.json,.ymlfiles etc.blackto format.pyfiles.quality_checksproject using Python 3.11 so we can lint and format with the latest versions offlake8andblack..editorconfigto remove some unnecessary overrides and format.ymlfiles according to our code style.flake8andblackon all Python files. Fix lint errors (except some line too long errors in tests, which are currently ignored).terraform fmton all Terraform files.prettieron all supported files.Reviews Required
Review Checklist
ℹ️ This section is to be filled in by the reviewer.