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

Style Automation #304

Merged
merged 31 commits into from
Jan 30, 2023
Merged

Style Automation #304

merged 31 commits into from
Jan 30, 2023

Conversation

ryanohoro
Copy link
Collaborator

@ryanohoro ryanohoro commented Jan 27, 2023

Describe the change

In order to more evenly apply the projects PEP8 style guidelines, this PR applies black, isort, and flake8 formatting to pre-commit hooks, and push/PR workflows.

Most python files in the repository have been reformatted. Files auto-generated for protos are excluded.

Documentation has been updated to reflect these changes.

To use pre-commit hooks (which will reformat and warn of needed changes, and prevent rejected pushes/PRs)

cd src/python/
pip install -r requirements.txt
pre-commit install

If pre-commit hooks fix a problem, the commit will need to be run again to complete successfully.

The style tools can be run manually:

python -m black --extend-exclude .*_pb2.*\.py src/python
python -m flake8 --exclude src/python/build/,src/python/strelka/proto/ src/python
python -m isort --extend-skip-glob *_pb2*.py --profile black src/python

mypy has not been included in this PR due to the large number of changes needed

yamlfix has not been included in this PR, it was causing type conversion issues with the repo

Closes #303

Describe testing procedures

============================= test session starts ==============================
platform linux -- Python 3.10.6, pytest-7.2.0, pluggy-1.0.0
rootdir: /strelka
plugins: mock-3.10.0, unordered-0.5.2
collected 102 items

tests/test_distribute.py .
tests/test_required_for_scanner.py .
tests/test_scan_base64.py .
tests/test_scan_base64_pe.py .
tests/test_scan_batch.py .
tests/test_scan_bmp_eof.py .
tests/test_scan_bzip2.py .
tests/test_scan_capa.py ...
tests/test_scan_ccn.py .
tests/test_scan_delay.py .
tests/test_scan_dmg.py ...
tests/test_scan_docx.py .
tests/test_scan_elf.py .
tests/test_scan_email.py .
tests/test_scan_encrypted_doc.py ....
tests/test_scan_encrypted_zip.py ..
tests/test_scan_entropy.py .
tests/test_scan_exception.py .
tests/test_scan_exiftool.py ..
tests/test_scan_footer.py ..
tests/test_scan_gif.py .
tests/test_scan_gzip.py .
tests/test_scan_hash.py .
tests/test_scan_header.py ..
tests/test_scan_html.py ..
tests/test_scan_ini.py .
tests/test_scan_iso.py .
tests/test_scan_javascript.py ..
tests/test_scan_jpeg.py ..
tests/test_scan_json.py .
tests/test_scan_libarchive.py ......
tests/test_scan_lnk.py .
tests/test_scan_lzma.py .
tests/test_scan_macho.py .
tests/test_scan_manifest.py .
tests/test_scan_msi.py .
tests/test_scan_nf.py ....
tests/test_scan_ocr.py ...
tests/test_scan_ole.py ....
tests/test_scan_pcap.py ..
tests/test_scan_pdf.py .
tests/test_scan_pe.py .
tests/test_scan_pgp.py ....
tests/test_scan_plist.py .
tests/test_scan_png_eof.py ...
tests/test_scan_qr.py ...
tests/test_scan_rar.py .
tests/test_scan_seven_zip.py .....
tests/test_scan_strings.py .
tests/test_scan_tar.py .
tests/test_scan_tlsh.py .
tests/test_scan_upx.py .
tests/test_scan_url.py ..
tests/test_scan_vhd.py ..
tests/test_scan_x509.py ..
tests/test_scan_xl4ma.py .
tests/test_scan_xml.py .
tests/test_scan_yara.py .
tests/test_scan_zip.py ..

====================== 102 passed, 29 warnings in 39.83s =======================

Sample output

No changes.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of and tested my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

Copy link
Contributor

@phutelmyer phutelmyer left a comment

Choose a reason for hiding this comment

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

Reference to mpy use in the proposed README change which is not active in this PR, but is intended in the future.

Besides that, LGTM.

@phutelmyer phutelmyer merged commit 7241cbb into target:master Jan 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Automate Style with Standard Libraries
2 participants