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

Discuss about code style checkers #197

Open
jorgepiloto opened this issue May 21, 2022 · 3 comments
Open

Discuss about code style checkers #197

jorgepiloto opened this issue May 21, 2022 · 3 comments
Assignees
Labels
discussion Discussion topics enhancement New feature or request

Comments

@jorgepiloto
Copy link

🐞 Problem

The different scripts and notebooks are not being tested from the point of view of code style. I am aware of the different languages being used in this repo, such as C#, Python, Matlab...

Nevertheless, it should be feasible to implement a .github/workflow/style.yml to check for custom-defined code style guidelines. This would ensure that all the code for a particular programming language looks the same, no matter the original author.

💡 Solution

If you are interested in implementing this feature, I could go for it.

We could start by implementing a Python code style checker based on black, isort and flake8. These tools can also be used in the Jupyter Notebooks.

Please, let me know what you think about this and if it would be of your interes.

@jpthompson212
Copy link
Contributor

@jorgepiloto I think this is a great idea, and if you'd like to take the first shot at it that would be much appreciated!

Please let me know if you have any questions or issues along the way

@jpthompson212 jpthompson212 self-assigned this Jan 20, 2023
@jpthompson212 jpthompson212 added enhancement New feature or request discussion Discussion topics labels Jan 20, 2023
@jpthompson212
Copy link
Contributor

@jorgepiloto I have finally got around to working on this. I have gone about adding both black and isort to a pre-commit file so that these can be run prior to any code commits.

These can also be added to a github action, just have not done that yet...

I also have not integrated flake8 yet but can do that.

@jorgepiloto
Copy link
Author

Thanks for working on this, @jpthompson212.

Some months ago, we created pyansys/actions. This repository is a collection of reusable GitHub workflows. These allow to simplify the common CI/CD pipelines of a project. The pyansys/actions/style@v3 action installs, reads and runs the pre-commit-config.yaml file.

Since this is not a Python project, the use-python-cache argument needs to be equal to false.

code-style:
  name: "Running code style checks"
  runs-on: ubuntu-latest
  steps:
    - name: "Install pre-commit and run it"
      uses: pyansys/actions/code-style@v3
      with:
        use-python-cache: false

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Discussion topics enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants