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

Refactor of cpg-language-python #1282

Merged
merged 71 commits into from
Nov 30, 2023
Merged

Refactor of cpg-language-python #1282

merged 71 commits into from
Nov 30, 2023

Conversation

maximiliankaul
Copy link
Contributor

@maximiliankaul maximiliankaul commented Aug 17, 2023

This PR aims at minimizing Python code in favor of Kotlin code in our CPG. This will benefit the overall experience as

  • the code will be easier to maintain (debugging, similarity to other frontends, ...)
  • we can get rid of a lot of file handling background magic

This goal is achieved in a similar manner as with the other frontends (i.e. cpg-language-go). We will still use Python's ast module to parse Python code but then map all Python objects to a Kotlin interface. All logic will be implemented in Kotlin.

Open todos:

  • make everything work as good as before (or better ;))
  • update README
  • fix the PythonLanguageFrontend functions (getCode(), ...) -> need to store the file name somewhere
  • remove all pycodestyle references (github runner, ...)
  • remove spotless checks for Python files (as there will be no more Python files) @oxisto

Sorry, something went wrong.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@oxisto oxisto mentioned this pull request Nov 29, 2023
@oxisto
Copy link
Member

oxisto commented Nov 29, 2023

I did a first cleanup pass on this. I removed everything which was breaking things in other language frontends. I also added initial type parsing and some type inference work, which we sill can improve later on, but it works for the tests.

@oxisto oxisto marked this pull request as ready for review November 29, 2023 13:49
@oxisto oxisto requested a review from KuechA as a code owner November 30, 2023 09:23
This PR implements the `ScopeProvider` interface in the `Pass` class. This should now enable passes to use the information in the stored `scopeManager` when creating new nodes with the node builder.
@oxisto oxisto enabled auto-merge (squash) November 30, 2023 14:42
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 38 Code Smells

62.8% 62.8% Coverage
0.0% 0.0% Duplication

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

@oxisto oxisto merged commit 70ea9c2 into main Nov 30, 2023
@oxisto oxisto deleted the mk/pythonRewrite branch November 30, 2023 14:56
oxisto pushed a commit that referenced this pull request Dec 30, 2023
oxisto pushed a commit that referenced this pull request Dec 30, 2023
oxisto pushed a commit that referenced this pull request Dec 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants