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

Remove global state #35

Merged
merged 4 commits into from
Sep 15, 2023
Merged

Remove global state #35

merged 4 commits into from
Sep 15, 2023

Conversation

drdavella
Copy link
Member

@drdavella drdavella commented Sep 14, 2023

Overview

Remove the use of global state; other miscellaneous code cleanup

Description

  • The main change here is the removal of global state for storing the working directory
  • The DependencyManager also effectively stored global state since it's implemented in terms of a Singleton
  • All codemods now receive a CodemodExecutionContext which is used to store centralized state
  • This PR also fixes a circular dependency that was exposed when running tests
  • I also introduced a Makefile to consolidate some of our testing and linting commands

@drdavella drdavella marked this pull request as ready for review September 14, 2023 18:06

[tool.pytest.ini_options]
# Ignore integration tests and ci tests by default
testpaths = ["tests"]
Copy link
Member Author

Choose a reason for hiding this comment

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

We could include integration tests here if we want but mainly I want to avoid running the webgoat tests by accident.

@codecov-commenter
Copy link

Codecov Report

Merging #35 (71cf85b) into main (979abed) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #35      +/-   ##
==========================================
+ Coverage   95.67%   95.69%   +0.01%     
==========================================
  Files          38       37       -1     
  Lines        1340     1346       +6     
==========================================
+ Hits         1282     1288       +6     
  Misses         58       58              
Files Changed Coverage Δ
src/codemodder/change.py 100.00% <ø> (ø)
src/codemodder/__main__.py 96.87% <100.00%> (-0.07%) ⬇️
src/codemodder/codemods/api/__init__.py 95.58% <100.00%> (+0.06%) ⬆️
src/codemodder/codemods/base_codemod.py 95.71% <100.00%> (+0.63%) ⬆️
src/codemodder/codemods/base_visitor.py 96.87% <100.00%> (-0.19%) ⬇️
src/codemodder/codemods/django_debug_flag_on.py 100.00% <100.00%> (ø)
...odder/codemods/django_session_cookie_secure_off.py 98.30% <100.00%> (+0.05%) ⬆️
src/codemodder/codemods/https_connection.py 93.54% <100.00%> (-0.21%) ⬇️
src/codemodder/codemods/order_imports.py 92.85% <100.00%> (-0.63%) ⬇️
...rc/codemodder/codemods/process_creation_sandbox.py 100.00% <100.00%> (ø)
... and 7 more

@drdavella drdavella merged commit 77d5aad into main Sep 15, 2023
6 checks passed
@drdavella drdavella deleted the fix-global-state branch September 15, 2023 17:32
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.

3 participants