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 handling of behindPreprocessorFlag argument in @Spyable attribute #85

Merged
merged 2 commits into from
Feb 5, 2024

Conversation

Matejkob
Copy link
Owner

@Matejkob Matejkob commented Feb 2, 2024

This commit refines the implementation and diagnostic handling of the behindPreprocessorFlag argument for the @Spyable attribute. The key improvements include:

  1. Enhanced Argument Extraction:

    • Updated the extraction logic for the behindPreprocessorFlag argument in the SpyableMacro.swift and Extractor.swift files. The new approach is more robust, ensuring the flag is accurately identified and processed within the macro expansion context.
  2. Diagnostic Improvements:

    • Introduced a specific diagnostic message for cases where the behindPreprocessorFlag argument does not conform to the expected static string literal format. This change aims to provide immediate, actionable feedback to developers, aiding in quicker resolution of configuration errors.
  3. Test Suite Expansion:

    • Enhanced the test suite to include scenarios testing the behindPreprocessorFlag argument's behavior. These tests validate both the successful extraction of the flag and the emission of diagnostics when the argument format is incorrect.

Fixes #84.

Copy link

codecov bot commented Feb 2, 2024

Codecov Report

Attention: 6 lines in your changes are missing coverage. Please review.

Comparison is base (4e093c3) 96.70% compared to head (622cdac) 98.36%.

Files Patch % Lines
...s/SpyableMacro/Diagnostics/SpyableDiagnostic.swift 66.66% 3 Missing ⚠️
.../SpyableMacro/Diagnostics/SpyableNoteMessage.swift 66.66% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #85      +/-   ##
==========================================
+ Coverage   96.70%   98.36%   +1.65%     
==========================================
  Files          17       18       +1     
  Lines         699      736      +37     
==========================================
+ Hits          676      724      +48     
+ Misses         23       12      -11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

MatthewXk

This comment was marked as outdated.

@MatthewXk MatthewXk self-requested a review February 2, 2024 19:54
@Matejkob Matejkob merged commit 8ced7a5 into main Feb 5, 2024
@Matejkob Matejkob deleted the add-argument-extracting-diagnostic branch February 5, 2024 16:30
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.

Refer to a String that can be set to a flag from a variable
2 participants