Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upDev sprint ideas: More tests, type hints and less complexity #2128
Comments
|
We push all new contributions to use type hints as discussed in CONTRIBUTING.md.
We do this already https://github.com/TheAlgorithms/Python/blob/master/.travis.yml#L17 |
|
@cclauss How about a dev sprint kind of thing where we go about adding all such improvements? |
|
Cool idea! Another thing (a sprint topic?) that is bugging me is code complexity which we currently set to 25 but I would be much happier to see it at 15. We would need to ensure that the files have strong type hints and tests before modifying them to reduce their cyclomatic complexity. |
|
Another cool sprint topic would be to add doctests to Python files that have <10% test coverage. Some files like file_transfer/send_file.py and the web programming files are difficult to write tests for but others should be fair game. |
|
Should we have a short sprint or a long one? One idea would be 24 hour sprint — given that tomorrow is summer solstice (longest day of the year) — the sprint could start at midnight tonight (in whatever timezone the contributer is in) and last for 24 hours. #2128 could be our tracking issue for keeping track of tasks and accomplishments. Thoughts on this Summer Solstice Special Sprint idea. |
|
Seems awesome, we can gain some attention by Summer Solstice Special Sprint, I am up on gitter if you want to discuss |
Work In Progress Draft: Do not merge if test are not passing!! Related to #2128, find all files that contain algorithms with > 15% McCabe complexity.
Difficult but not impossible. We can create issue with some labels. Perhaps we find someone who will write tests or even code (for example simple server for response) for testing it |
* Euler problem 551 sol 1: Reduce McCabe code complexity As discussed in #2128 * fixup! Format Python code with psf/black push Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
* hamming_code.py: Reduce McCabe code complexity As discussed in #2128 * fixup! Format Python code with psf/black push Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
also modified the main script to be testable I also had to change the line that handled `delete` section Fixes TheAlgorithms#2128
also modified the main script to be testable I also had to change the line that handled `delete` section Fixes TheAlgorithms#2128
… (#2335) * Added static type checking to linear_algebra/src/polynom-for-points.py * Fixed TravisCI errors * Update polynom-for-points.py Co-authored-by: Christian Clauss <cclauss@me.com>
- Test lists were not ordered, this is required for Fibonacci search - Place documentation of function inside function - Create multiple different tests including, float, char and negatives - Add type hints in line with TheAlgorithms#2128
|
Concerning complexity and maintainability, I've run the repo through wily (https://github.com/tonybaloney/wily), a command-line application for tracking, reporting on the complexity of Python tests and applications. Here are the results for maintainability index [0..100] per module. The scale considers anything lower than 25 as hard to maintain, and anything over 75 as easy to maintain.
This allows us to track the overall maintainability of the repo (=77.3) and focus improvements on the less maintainable files. For new files, a threshold of 75 could be set for the maintainability index. |
|
Please pick one directory (and ONLY one directory) [like |
* Fix: Multiple errors in fibonacci search. - Test lists were not ordered, this is required for Fibonacci search - Place documentation of function inside function - Create multiple different tests including, float, char and negatives - Add type hints in line with #2128 * Fix: sort of modules and delete typehint. * Apply suggestions from code review Co-authored-by: Dhruv <dhruvmanila@gmail.com> * Correct invocation of lru_cache. * Add check for input in fibonacci and doctest. * Correct typehints to comply to numpy style. * Correct ValueError to TypeError. Co-authored-by: Dhruv <dhruvmanila@gmail.com> * Correct doctest for TypeError. * Rename single letter names as mentioned in CONTRIBUTING.md. * Fix: Bug in big lists. * Remove print(.) in doctests. * Refactor iterator to while loop. * Update searches/fibonacci_search.py Co-authored-by: Dhruv <dhruvmanila@gmail.com>
this is a child of a previous PR TheAlgorithms#2443 its ancestor is TheAlgorithms#2128
currently, some of the programs use static type checking like this program but some of the programs did not use static typing.
it's a good practice to use static typing as it makes code more clear and readable, should we make it a standard for this repository.we can use mypy for testing code
more on static typing
thank you
Dev sprint ideas:
flake8 --max-complexity=15(Ensure files have strong tests before refactoring). Test results from #2139...