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

Improve preprocessor #2579

Merged
merged 15 commits into from
Sep 10, 2024
Merged

Conversation

og-mrk
Copy link
Contributor

@og-mrk og-mrk commented Aug 19, 2024

Type of Change

  • Bug fix
  • Refactoring

Description (Highlighted Changes)

  • Using Push-Location & Pop-Location instead of 'workingdir', which'll deduplicate a lot of un-needed pre-fixes when dealing with paths, it's a nice & simple approach to this problem.. can't remember which repo I found it 😅.. but hay, here it is.
  • Improve overall Invoke-Preprocessing script, now it actually excludes files that it shouldn't be processing.
  • Now the mis-behaving RegEx in Invoke-Preprocessing works as intended! (See Additional Information for more info about this "mis-behaving" RegEx)
    needed to rethink what it should be looking for.. and again, this RegEx approach is "good enough" for now, it's better in the long-run to parse & make AST for every powershell script file.

Testing

Ran the compiled winutil.ps1 file, as well as through Compile.ps1 -Run, both worked as expected.

Impact

this PR won't have that impact to end-user, nor will it (hopefully) impact other open PRs.. not sure on the later part.

Additional Information

  • The previously outlined "mis-behaving" RegEx in PR Description is referring to last RegEx in the list, which'll remove the whitespace between type cast & variable name, like [string] $MyString -> [string]$MyString, see screenshot below for more context.
Click to Expand

a Screenshot showing git log output, showing the result of preprocessing function

Checklist

  • My code adheres to the coding and style guidelines of the project.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no errors/warnings/merge conflicts.

@og-mrk og-mrk requested a review from ChrisTitusTech as a code owner August 19, 2024 18:46
@og-mrk
Copy link
Contributor Author

og-mrk commented Aug 19, 2024

@ChrisTitusTech
image

@MyDrift-user
Copy link
Contributor

Thanks @og-mrk for fixing this :)

@og-mrk og-mrk force-pushed the improve-preprocessor branch from b3be4b6 to d65bac4 Compare August 31, 2024 06:51
@ChrisTitusTech ChrisTitusTech merged commit c1009c3 into ChrisTitusTech:main Sep 10, 2024
1 check passed
@ChrisTitusTech ChrisTitusTech added the skip-changelog Skip Change Logs label Sep 10, 2024
@og-mrk og-mrk deleted the improve-preprocessor branch September 22, 2024 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip-changelog Skip Change Logs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants