SMAT-Lab / Scalpel

Scalpel: The Python Static Analysis Framework
Apache License 2.0
295 stars 46 forks source link

Integrate Best Practices for a More Robust and Maintainable Code Base #96

Closed ashwinprasadme closed 1 year ago

ashwinprasadme commented 1 year ago

This pull request aims to improve the overall quality and maintainability of the project by refactoring the code base and implementing common best practices. The following changes have been made:

  1. Linting: Added ruff, isort, and black as linting tools to ensure that the code adheres to PEP8 standards. Configured the tools to run automatically via pre-commit hooks. Currently it is not very strict as the existing code base produces a lot of warnings and errors. This needs to be refactored in-depth, which is planned next. Furthermore, all files inside the scalpel directory are now linted.

  2. Makefile: Introduced a Makefile to simplify and standardize common tasks such as linting and testing the application. This will make it easier for contributors to work on the project.

  3. Test Scripts: Created a test script to run all tests in the tests directory. Integrated test script execution into the Makefile. Currently, Scalpel uses both pytest and unittest as raised in issue #81. This is planned to be made uniform going forward. Furthermore, the ground truth for type inference test cases are now consolidated into different files for easy debugging.

  4. Pre-commit: Installed pre-commit to manage pre-commit hooks. Configured hooks to run linting tasks automatically before committing changes.

  5. Setup Scripts: Created setup.sh and requirements.txt to manage dependencies, install pre-commit hooks, and streamline the installation process for contributors. This will help ensure that all developers work with the same package versions and minimize issues related to package version discrepancies.

  6. Documentation: Updated the README.md file with instructions on how to set up the development environment, use the Makefile, and run tests.

These changes will help maintain a clean, consistent, and more maintainable code base, while also making it easier for new contributors to get started with the project.

Please review the changes and let me know if you have any suggestions or concerns.