Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Source code as an input

Source code as an input

Talk by Paul Taykalo (originally posted here: https://speakerdeck.com/paultaykalo/source-code-as-input).

Паша расскажет об инструментах, которые участвуют в обработке исходного кода - SourceKit, SourceKitten, libSyntax. Вас ожидает увлекательное интро, в ходе которого вы узнаете:
- о роли и ответственностях каждого из инструментов
- практическое применение тех или иных возможностей в работе
- текущий статус разработки, каких возможностей можно ожидать от инструментов в будущем
- чего ожидать вообще не стоит :)

This talk was made for CocoaFriday #1 ( https://cocoaheads.org.ua/cocoafriday/1 ) which took place Mar 1, 2019.

Video is available here: https://youtu.be/0NH-G77BivU

CocoaHeads Ukraine

March 01, 2019
Tweet

More Decks by CocoaHeads Ukraine

Other Decks in Programming

Transcript

  1. Source Code as an the input 1 — Source Code

    as Input, by Paul Taykalo, MacPaw
  2. When just writing a code is not enough 2 —

    Source Code as Input, by Paul Taykalo, MacPaw
  3. A lot of source - not a problem - Code

    style ❓ - Documentation ❓ - Refactoring ❓ - Code generation ❓ - Error detection ❓ - Obsfuscation ❓ 3 — Source Code as Input, by Paul Taykalo, MacPaw
  4. Source Obvious, we'll work with Swi! and ObjC 12 —

    Source Code as Input, by Paul Taykalo, MacPaw
  5. Destination - Docs - More code! - Code Checks -

    Images 14 — Source Code as Input, by Paul Taykalo, MacPaw
  6. Rules disabled_rules: # rule identifiers to exclude from running -

    colon - comma - control_statement opt_in_rules: # some rules are only opt-in - empty_count # Find all the available rules by running: # swiftlint rules included: # paths to include during linting. `--path` is ignored if present. - Source excluded: # paths to ignore during linting. Takes precedence over `included`. - Carthage - Pods - Source/ExcludedFolder - Source/ExcludedFile.swift - Source/*/ExcludedFile.swift # Exclude files with a wildcard 16 — Source Code as Input, by Paul Taykalo, MacPaw
  7. Tools for processing Code Regex-based solutions - IR: Strings -

    Somewhat unreliable 18 — Source Code as Input, by Paul Taykalo, MacPaw
  8. Tools for processing Code Custom Parser Solutions - IR: (DSL)

    - Trying to parse code on its own - Using own AST 19 — Source Code as Input, by Paul Taykalo, MacPaw
  9. Tools for processing Code Sourcekit based solutions - IR: AST,

    Binary, JSON* - Using Sourcekit library - Always up to date 20 — Source Code as Input, by Paul Taykalo, MacPaw
  10. SourceKit is... Welcome to SourceKit! SourceKit is a framework for

    supporting IDE features like indexing, syntax- coloring, code-completion, etc. In general it provides the infrastructure that an IDE needs for excellent language support. SourceKit currently only supports the Swi! language. 25 — Source Code as Input, by Paul Taykalo, MacPaw
  11. SourceKit - Code Completion - Cursor Info - Demangling/Demangling -

    Documentation - Module interface generation - Indexing* 26 — Source Code as Input, by Paul Taykalo, MacPaw
  12. SourceKit options - C Interface - sourcekitd.framework - libsourcekitdInProc.dylib -

    Official Python Binding - Unofficial Swi" Binding: SourceKitten 27 — Source Code as Input, by Paul Taykalo, MacPaw
  13. SourceKitten - ✅ Command Line Util - ✅ Framework -

    ✅ Wrapper over SourceKit - ✅ Writtent in Swi! 29 — Source Code as Input, by Paul Taykalo, MacPaw
  14. Tools with Sourcekitten - ✅ Swi!Lint: Swi! style and conventions.

    - ✅ Jazzy: Docs for Swi! & Objective-C. - ✅ Sourcery: Meta-programming for Swi! - ✅ Cuckoo: Mocking framework for Swi!. 30 — Source Code as Input, by Paul Taykalo, MacPaw
  15. Tools with Sourcekitten - ✅ Swi!yMocky: Framework for mock genertion.

    - ✅ SourceKittenDaemon: Auto Completions . - ✅ SourceDocs: Markdown documentation. - ✅ Taylor: Measure Swi! code metrics 31 — Source Code as Input, by Paul Taykalo, MacPaw
  16. SourceKitten uses SwiftLint, which is based on SourceKitten 32 —

    Source Code as Input, by Paul Taykalo, MacPaw
  17. libsyntax - C library SwithSyntax - Swi! wrapper library 34

    — Source Code as Input, by Paul Taykalo, MacPaw
  18. Source Code as Input by Paul Taykalo, MacPaw @TT_Kilew 41

    — Source Code as Input, by Paul Taykalo, MacPaw