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

Source Code as Input

Sponsored · SiteGround - Reliable hosting with speed, security, and support you can count on. →

Source Code as Input

Avatar for Paul Taykalo

Paul Taykalo

March 01, 2019

More Decks by Paul Taykalo

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