Skip to content
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

Pre commit autoformat #846

Merged
merged 23 commits into from
Feb 12, 2024
Merged

Pre commit autoformat #846

merged 23 commits into from
Feb 12, 2024

Conversation

lmarini
Copy link
Member

@lmarini lmarini commented Dec 4, 2023

This PR introduces pre-commit hooks to run:

  • some python formatting checks
  • generation of openapi spec
  • codegen of javascript client stubs
  • javascript eslint and prettier

To setup install python library with pipenv install and setup hooks with pre-commit install.

NOTE: once in place, hooks are in the .git directory and will be run on any branch. They can be removed with pre-commit uninstall or by skipping them when git commit with --no-verify.

Use pre-commit run --all-files to run them before committing.

@lmarini lmarini requested review from ddey2 and tcnichol January 8, 2024 18:21
@lmarini lmarini marked this pull request as ready for review January 8, 2024 18:30
hooks:
- id: generate-frontend-api-client
name: generate-frontend-api-client
entry: bash -c 'cd frontend && npm run codegen:v2:file'
Copy link
Member

Choose a reason for hiding this comment

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

What's the trick that makes this command work without backend running?

Copy link
Member

Choose a reason for hiding this comment

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

oh im answering myself...
Is it because the script extract-openapi = "python backend/extract-openapi.py app.main:app" can generate openapi.json without actually having a running background?
Does that mean I can also update the github action to eliminate all the steps of starting up all docker stacks?

Copy link
Member Author

Choose a reason for hiding this comment

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

correct

Copy link
Member

@longshuicy longshuicy left a comment

Choose a reason for hiding this comment

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

Followed the steps and everything works. Approve.

hooks:
- id: generate-frontend-api-client
name: generate-frontend-api-client
entry: bash -c 'cd frontend && npm run codegen:v2:file'
Copy link
Member

Choose a reason for hiding this comment

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

oh im answering myself...
Is it because the script extract-openapi = "python backend/extract-openapi.py app.main:app" can generate openapi.json without actually having a running background?
Does that mean I can also update the github action to eliminate all the steps of starting up all docker stacks?

@lmarini lmarini changed the base branch from main to v2.0.0-beta2 February 12, 2024 20:13
@lmarini lmarini merged commit ba6835f into v2.0.0-beta2 Feb 12, 2024
2 checks passed
@lmarini lmarini deleted the pre-commit-autoformat branch February 12, 2024 21:59
longshuicy pushed a commit that referenced this pull request Mar 22, 2024
* Removed unused imports using autoflake.

* Ordered imports using isort.

* Reformatted using black.

* Setting up pre-commits.

* Ran pre-commit an all files.

* Working on creating openapi.json without running backend to be used with codegen.

* Fixed `MUI: The Tabs component doesn't accept a Fragment as a child.`

* Fixed runtime error due to replacing `== None` with 'is None'.

* Fixed runtime error due to replacing `== None` with 'is None'.

* Automatically generate openapi json file using pre-commit hook.

* Added codegen precommit hook.

* Setting up prettier and eslint.

* First run of prettier.

* Runnin eslint and prettier as hooks.

* Skip codegen directories when running eslint and prettier.

* Flake8 E711 exception. Required for Beanie query to work.

* Fixed search_users_prefix codegen stub.

* Fixed beanie query for get_dataset_folders.

* Ignore Flake8 E711 since beanie query do not support `is None`.
longshuicy added a commit that referenced this pull request Mar 22, 2024
* clear more breakpoints and move role to the Details

* bump version up

* add version to public layout too

* update changelog

* package json version

* Pre commit autoformat (#846)

* Removed unused imports using autoflake.

* Ordered imports using isort.

* Reformatted using black.

* Setting up pre-commits.

* Ran pre-commit an all files.

* Working on creating openapi.json without running backend to be used with codegen.

* Fixed `MUI: The Tabs component doesn't accept a Fragment as a child.`

* Fixed runtime error due to replacing `== None` with 'is None'.

* Fixed runtime error due to replacing `== None` with 'is None'.

* Automatically generate openapi json file using pre-commit hook.

* Added codegen precommit hook.

* Setting up prettier and eslint.

* First run of prettier.

* Runnin eslint and prettier as hooks.

* Skip codegen directories when running eslint and prettier.

* Flake8 E711 exception. Required for Beanie query to work.

* Fixed search_users_prefix codegen stub.

* Fixed beanie query for get_dataset_folders.

* Ignore Flake8 E711 since beanie query do not support `is None`.

* bump keycloak chart version to 13 so it's using keycloak appversion 20

* update chart lock

* add login to github repo

* push set to true

* revert login to github repo

* version updates

* revert

* no v in the appVersion

* change to make keycloak point to external url (#942)

* 929 message on empty page if there is no datasets (#930)

* basic message, need to improve

* adding a login or register button

* removing buttons

* links to login or register if no public datasets

* changing text

* srink the version and align to left (#950)

* moved key to grid instead of card

* adding admin mode to the authwrapper (#951)

* Fixed dataset parameters. They weren't being included in rabbtimq message. (#957)

* fix extractor bugs and deployment script bug (#958)

* Use --host 0.0.0.0 when running uvicorn to make backend listen on host IP.

* fix missing add metadata button on dataset
pycharm was complaining about missing publicView boolean in DisplayMetadata

* Drag and Drop One or More Files (#935)

* initial commit, add dependency, new class
will eventually combine all file uploads

* working on adding upload drag and drop

* page does not load

* drag and drop does not actually work

* addign fileinputdrop as independent component

* add fileupload drop inside uploadfiledraganddrop

* drag and drop does not add files
select selects files but misses the first one

* drag and drop works now, is overwritten if file selected using button, need to fix

* uploads but overwrites, need to fix

* works for the select, need to fix other

* should work for drop now too

* was not an array

* delete icon works
removing console logs

* drag and drop and select means other upload methods no longer needed

* removing text in drag and drop

* added to styles but not using because it does not work

* some changes, not sure how to do rest

* fix button

* return to dataset

* remove unnecessary imports

---------

Co-authored-by: Chen Wang <cwang138@illinois.edu>

* precommits

---------

Co-authored-by: Luigi Marini <lmarini@illinois.edu>
Co-authored-by: Todd Nicholson <40038535+tcnichol@users.noreply.github.com>
Co-authored-by: toddn <tcnichol@illinois.edu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants