R.swift icon indicating copy to clipboard operation
R.swift copied to clipboard

Refactor warnings so that it's not an sideeffect anymore

Open mac-cain13 opened this issue 8 years ago • 1 comments

Functions should just return warnings they have encountered. Later on we can print them at once.

This makes code clearer, easier to test and gives us the ability to suppress warnings. We could even add meta data so specific types of warnings could be shown/hidden etc.

mac-cain13 avatar Dec 16 '15 21:12 mac-cain13

Plan of attack for part of this, related to identifier warnings:

  • [x] Create a separate SwiftIdentifier type instead of a string
  • [x] Refactor all data types (Struct, Let, etc) to use SwiftIdentifier
  • [x] Refactor code in SanitizedSwiftName.swift to use SwiftIdentifier
  • [ ] Move all code related to identifier checking (duplicates, empty names) into a single (parameterised function), instead of repeating it across all validators. This should fix https://github.com/mac-cain13/R.swift/issues/175

Continuing on:

  • [ ] Identify a list of all other warning types
  • [ ] Create an enum for those
  • [ ] Figure out how to return those best from functions (return value, inout param, or mutable object passed around?)

tomlokhorst avatar May 29 '16 13:05 tomlokhorst