SwiftyJSONAccelerator icon indicating copy to clipboard operation
SwiftyJSONAccelerator copied to clipboard

Provide a complete set of swift keywords, quote their usage

Open TheMadBug opened this issue 3 years ago • 2 comments

fixes #118 Handle keyword "private" - I've extended this to all swift keywords.

Note that my solution did involve removing the old replaceKeywords method which would append Property, and instead escapes keywords with the "`" character.

e.g. {"class": 123} used to generate a variable called classProperty where now it generates a variable called class but all referencs to it are escaped with quotes. I'm not sure if this is going to cause issues with existing users.

Lastly I moved the detection of keywords to the bottom of fixVariableName rather than the top, so if any other processing converts the variable to a reserved word, e.g. " private".trim() -> "private" it's caught.

TheMadBug avatar Oct 10 '20 02:10 TheMadBug

Pull Request Test Coverage Report for Build 381

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 0.0%

Totals Coverage Status
Change from base Build 365: 0.0%
Covered Lines: 0
Relevant Lines: 0

💛 - Coveralls

coveralls avatar Oct 10 '20 03:10 coveralls

Codecov Report

Merging #122 into dev will decrease coverage by 0.08%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev     #122      +/-   ##
==========================================
- Coverage   98.96%   98.88%   -0.09%     
==========================================
  Files          16       16              
  Lines         873      808      -65     
==========================================
- Hits          864      799      -65     
  Misses          9        9              
Impacted Files Coverage Δ
Core/Generator/NameGenerator.swift 100.00% <100.00%> (ø)
...iftyJSONAcceleratorTests/ModelGeneratorTests.swift 99.47% <100.00%> (-0.05%) :arrow_down:
...AcceleratorTests/MultipleModelGeneratorTests.swift 96.00% <0.00%> (-0.35%) :arrow_down:
Core/Helpers/JSONHelper.swift 97.14% <0.00%> (-0.05%) :arrow_down:
Core/Generator/ModalGenerator.swift 100.00% <0.00%> (ø)
Core/Generator/FileGeneratorExtension.swift 100.00% <0.00%> (ø)
Core/Generator/MultipleModelGenerator.swift 100.00% <0.00%> (ø)
SwiftyJSONAcceleratorTests/StringTests.swift 100.00% <0.00%> (ø)
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update dc9e802...725bf64. Read the comment docs.

codecov[bot] avatar Oct 10 '20 03:10 codecov[bot]