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

Add code quality tests #8

Closed
czgdp1807 opened this issue Jun 20, 2019 · 9 comments · Fixed by #72
Closed

Add code quality tests #8

czgdp1807 opened this issue Jun 20, 2019 · 9 comments · Fixed by #72
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@czgdp1807
Copy link
Member

Description of the problem

Currently there are no tests to check the quality of the code, example each file should end with new line, there should be no trailing white space.
A good place to add code quality tests will be, pydatastructs.utils.tests.test_code_quality.

Example of the problem

References/Other comments

Refer, https://github.com/sympy/sympy/blob/master/sympy/utilities/tests/test_code_quality.py

@czgdp1807 czgdp1807 added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Jun 20, 2019
@czgdp1807 czgdp1807 pinned this issue Jun 20, 2019
@Kartikei-12
Copy link

Suggested external resource, Codacy

The Code quality check can be automated with Codacy, without any explicit code in the repo.

Example reference Kartikei-12/Pyrunc/

@czgdp1807
Copy link
Member Author

Thanks for the idea. AFAICFO, I think Codacy needs to be installed and then we need to update .travis.yml. Am I right?

@Kartikei-12
Copy link

No Codacy installation is not required, and provides code quality measures directly in browser, an can be configured in the same way.
You just need to login with github and turn on repo monitoring.
Also it provided badge which can be added in README

@czgdp1807
Copy link
Member Author

Thanks for the clarification. I will take a look into it.

@npalladium
Copy link

You could also look into setting up black and running it on every commit with git hooks. pre-commit might make setting the git hook up easier.

@czgdp1807
Copy link
Member Author

We will add our own tests in the root directory.
A file, test_code_quality.py will have functions for testing various issues with code like trailing whitespace, no newline at the end of the file, more than one new line at the end of the line, and much more. Any new quality parameter can be tested by adding a new function for it.

@npalladium
Copy link

Can you provide a list of parameters you wish to test at the moment?

@czgdp1807
Copy link
Member Author

Currently, we need tests for trailing white spaces and new line issues at the end of the file.

@npalladium
Copy link

These seem to be more code style tests than code quality. black actual fixes the EOF empty line issue and enforces consistent formatting. Afaik, while it currently doesn't fix trailing whitespaces, there is an open issue to do the same. Could you look into it even if you have a separate code quality/style test module?
Likewise using flake8 also might be helpful.
Again, I might be speaking without exact knowledge of the situation. Is there any reason not to use them?
Kinda unrelated, but are there any thoughts of introducing type annotation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants